From 584dfe961e6220d684bfd847facb4e7b2717a712 Mon Sep 17 00:00:00 2001 From: Andres Suarez Date: Sun, 10 Jan 2021 10:03:53 -0800 Subject: [PATCH] Apply clang-format update fixes Reviewed By: igorsugak Differential Revision: D25861849 fbshipit-source-id: 840dc1061e557717c7f9ffcccbc09c24b96b78e0 --- .../YogaKitSample/ViewController.m | 18 +++++++------ javascript/sources/Node.cc | 4 +-- tests/EventsTest.cpp | 4 +-- tests/YGComputedMarginTest.cpp | 26 ++++++++++--------- tests/YGComputedPaddingTest.cpp | 26 ++++++++++--------- tests/YGTreeMutationTest.cpp | 21 ++++++++------- yoga/CompactValue.h | 4 +-- yoga/Yoga.cpp | 4 +-- 8 files changed, 57 insertions(+), 50 deletions(-) diff --git a/YogaKit/YogaKitSample/YogaKitSample/ViewController.m b/YogaKit/YogaKitSample/YogaKitSample/ViewController.m index 145fa47b5a..dedf03d2c3 100644 --- a/YogaKit/YogaKitSample/YogaKitSample/ViewController.m +++ b/YogaKit/YogaKitSample/YogaKitSample/ViewController.m @@ -28,17 +28,19 @@ - (void)viewDidLoad { UIView* child2 = [UIView new]; child2.backgroundColor = [UIColor greenColor]; - child2.frame = (CGRect){.size = { - .width = 200, - .height = 100, - }}; + child2.frame = (CGRect){ + .size = { + .width = 200, + .height = 100, + }}; UIView* child3 = [UIView new]; child3.backgroundColor = [UIColor yellowColor]; - child3.frame = (CGRect){.size = { - .width = 100, - .height = 100, - }}; + child3.frame = (CGRect){ + .size = { + .width = 100, + .height = 100, + }}; [child2 addSubview:child3]; [root addSubview:child1]; diff --git a/javascript/sources/Node.cc b/javascript/sources/Node.cc index 7e6833fec9..421cfa7119 100644 --- a/javascript/sources/Node.cc +++ b/javascript/sources/Node.cc @@ -23,8 +23,8 @@ static YGSize globalMeasureFunc( Node const& node = *reinterpret_cast(YGNodeGetContext(nodeRef)); Size size = node.callMeasureFunc(width, widthMode, height, heightMode); - YGSize ygSize = {static_cast(size.width), - static_cast(size.height)}; + YGSize ygSize = { + static_cast(size.width), static_cast(size.height)}; return ygSize; } diff --git a/tests/EventsTest.cpp b/tests/EventsTest.cpp index cf887b2d6d..e830084665 100644 --- a/tests/EventsTest.cpp +++ b/tests/EventsTest.cpp @@ -303,8 +303,8 @@ EventArgs createArgs( }; EventArgs args = createArgs(node, data); - args.eventTestDataPtr = {new EventTestData{eventTestData}, - deleteEventTestData}; + args.eventTestDataPtr = { + new EventTestData{eventTestData}, deleteEventTestData}; return args; } diff --git a/tests/YGComputedMarginTest.cpp b/tests/YGComputedMarginTest.cpp index b74e417486..fedfd561f6 100644 --- a/tests/YGComputedMarginTest.cpp +++ b/tests/YGComputedMarginTest.cpp @@ -29,12 +29,13 @@ TEST(YogaTest, computed_layout_margin) { } TEST(YogaTest, margin_side_overrides_horizontal_and_vertical) { - const std::array edges = {{YGEdgeTop, - YGEdgeBottom, - YGEdgeStart, - YGEdgeEnd, - YGEdgeLeft, - YGEdgeRight}}; + const std::array edges = { + {YGEdgeTop, + YGEdgeBottom, + YGEdgeStart, + YGEdgeEnd, + YGEdgeLeft, + YGEdgeRight}}; for (float edgeValue = 0; edgeValue < 2; ++edgeValue) { for (const auto& edge : edges) { @@ -58,12 +59,13 @@ TEST(YogaTest, margin_side_overrides_horizontal_and_vertical) { } TEST(YogaTest, margin_side_overrides_all) { - const std::array edges = {{YGEdgeTop, - YGEdgeBottom, - YGEdgeStart, - YGEdgeEnd, - YGEdgeLeft, - YGEdgeRight}}; + const std::array edges = { + {YGEdgeTop, + YGEdgeBottom, + YGEdgeStart, + YGEdgeEnd, + YGEdgeLeft, + YGEdgeRight}}; for (float edgeValue = 0; edgeValue < 2; ++edgeValue) { for (const auto& edge : edges) { diff --git a/tests/YGComputedPaddingTest.cpp b/tests/YGComputedPaddingTest.cpp index 677ed3a6f4..c3aabab7f2 100644 --- a/tests/YGComputedPaddingTest.cpp +++ b/tests/YGComputedPaddingTest.cpp @@ -29,12 +29,13 @@ TEST(YogaTest, computed_layout_padding) { } TEST(YogaTest, padding_side_overrides_horizontal_and_vertical) { - const std::array edges = {{YGEdgeTop, - YGEdgeBottom, - YGEdgeStart, - YGEdgeEnd, - YGEdgeLeft, - YGEdgeRight}}; + const std::array edges = { + {YGEdgeTop, + YGEdgeBottom, + YGEdgeStart, + YGEdgeEnd, + YGEdgeLeft, + YGEdgeRight}}; for (float edgeValue = 0; edgeValue < 2; ++edgeValue) { for (const auto& edge : edges) { @@ -58,12 +59,13 @@ TEST(YogaTest, padding_side_overrides_horizontal_and_vertical) { } TEST(YogaTest, padding_side_overrides_all) { - const std::array edges = {{YGEdgeTop, - YGEdgeBottom, - YGEdgeStart, - YGEdgeEnd, - YGEdgeLeft, - YGEdgeRight}}; + const std::array edges = { + {YGEdgeTop, + YGEdgeBottom, + YGEdgeStart, + YGEdgeEnd, + YGEdgeLeft, + YGEdgeRight}}; for (float edgeValue = 0; edgeValue < 2; ++edgeValue) { for (const auto& edge : edges) { diff --git a/tests/YGTreeMutationTest.cpp b/tests/YGTreeMutationTest.cpp index bf07f39eb6..26f0b90046 100644 --- a/tests/YGTreeMutationTest.cpp +++ b/tests/YGTreeMutationTest.cpp @@ -29,8 +29,8 @@ TEST(YogaTest, set_children_adds_children_to_parent) { const std::vector expectedChildren = {root_child0, root_child1}; ASSERT_EQ(children, expectedChildren); - const std::vector owners = {YGNodeGetOwner(root_child0), - YGNodeGetOwner(root_child1)}; + const std::vector owners = { + YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)}; const std::vector expectedOwners = {root, root}; ASSERT_EQ(owners, expectedOwners); @@ -49,8 +49,8 @@ TEST(YogaTest, set_children_to_empty_removes_old_children) { const std::vector expectedChildren = {}; ASSERT_EQ(children, expectedChildren); - const std::vector owners = {YGNodeGetOwner(root_child0), - YGNodeGetOwner(root_child1)}; + const std::vector owners = { + YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)}; const std::vector expectedOwners = {nullptr, nullptr}; ASSERT_EQ(owners, expectedOwners); @@ -73,8 +73,8 @@ TEST(YogaTest, set_children_replaces_non_common_children) { const std::vector expectedChildren = {root_child2, root_child3}; ASSERT_EQ(children, expectedChildren); - const std::vector owners = {YGNodeGetOwner(root_child0), - YGNodeGetOwner(root_child1)}; + const std::vector owners = { + YGNodeGetOwner(root_child0), YGNodeGetOwner(root_child1)}; const std::vector expectedOwners = {nullptr, nullptr}; ASSERT_EQ(owners, expectedOwners); @@ -100,10 +100,11 @@ TEST(YogaTest, set_children_keeps_and_reorders_common_children) { root_child2, root_child1, root_child3}; ASSERT_EQ(children, expectedChildren); - const std::vector owners = {YGNodeGetOwner(root_child0), - YGNodeGetOwner(root_child1), - YGNodeGetOwner(root_child2), - YGNodeGetOwner(root_child3)}; + const std::vector owners = { + YGNodeGetOwner(root_child0), + YGNodeGetOwner(root_child1), + YGNodeGetOwner(root_child2), + YGNodeGetOwner(root_child3)}; const std::vector expectedOwners = {nullptr, root, root, root}; ASSERT_EQ(owners, expectedOwners); diff --git a/yoga/CompactValue.h b/yoga/CompactValue.h index be933a16ea..f398668e2e 100644 --- a/yoga/CompactValue.h +++ b/yoga/CompactValue.h @@ -125,8 +125,8 @@ class YOGA_EXPORT CompactValue { data.repr &= ~PERCENT_BIT; data.repr += BIAS; - return YGValue{data.value, - payload_.repr & 0x40000000 ? YGUnitPercent : YGUnitPoint}; + return YGValue{ + data.value, payload_.repr & 0x40000000 ? YGUnitPercent : YGUnitPoint}; } bool isUndefined() const noexcept { diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 97e640754d..2db6be21d9 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -3531,8 +3531,8 @@ static void YGNodelayoutImpl( YGNodeBoundAxisWithinMinAndMax( node, crossAxis, - YGFloatOptional{totalLineCrossDim + - paddingAndBorderAxisCross}, + YGFloatOptional{ + totalLineCrossDim + paddingAndBorderAxisCross}, crossAxisownerSize) .unwrap()), paddingAndBorderAxisCross),