OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/layout/ng/ng_block_layout_algorithm.h" | 5 #include "core/layout/ng/ng_block_layout_algorithm.h" |
6 | 6 |
7 #include "core/dom/NodeComputedStyle.h" | 7 #include "core/dom/NodeComputedStyle.h" |
8 #include "core/dom/TagCollection.h" | 8 #include "core/dom/TagCollection.h" |
9 #include "core/layout/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
10 #include "core/layout/ng/layout_ng_block_flow.h" | 10 #include "core/layout/ng/layout_ng_block_flow.h" |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 <div id='block'></div> | 1167 <div id='block'></div> |
1168 <div id='adjoining-clearance'></div> | 1168 <div id='adjoining-clearance'></div> |
1169 </div> | 1169 </div> |
1170 )HTML"); | 1170 )HTML"); |
1171 | 1171 |
1172 const NGPhysicalBoxFragment* clerance_fragment; | 1172 const NGPhysicalBoxFragment* clerance_fragment; |
1173 const NGPhysicalBoxFragment* body_fragment; | 1173 const NGPhysicalBoxFragment* body_fragment; |
1174 const NGPhysicalBoxFragment* container_fragment; | 1174 const NGPhysicalBoxFragment* container_fragment; |
1175 const NGPhysicalBoxFragment* block_fragment; | 1175 const NGPhysicalBoxFragment* block_fragment; |
1176 const NGPhysicalBoxFragment* adjoining_clearance_fragment; | 1176 const NGPhysicalBoxFragment* adjoining_clearance_fragment; |
| 1177 RefPtr<const NGPhysicalBoxFragment> fragment; |
1177 auto run_with_clearance = [&](EClear clear_value) { | 1178 auto run_with_clearance = [&](EClear clear_value) { |
1178 RefPtr<NGPhysicalBoxFragment> fragment; | |
1179 Element* el_with_clear = document().getElementById("clearance"); | 1179 Element* el_with_clear = document().getElementById("clearance"); |
1180 el_with_clear->mutableComputedStyle()->setClear(clear_value); | 1180 el_with_clear->mutableComputedStyle()->setClear(clear_value); |
1181 std::tie(fragment, std::ignore) = RunBlockLayoutAlgorithmForElement( | 1181 std::tie(fragment, std::ignore) = RunBlockLayoutAlgorithmForElement( |
1182 document().getElementsByTagName("html")->item(0)); | 1182 document().getElementsByTagName("html")->item(0)); |
1183 ASSERT_EQ(1UL, fragment->Children().size()); | 1183 ASSERT_EQ(1UL, fragment->Children().size()); |
1184 body_fragment = toNGPhysicalBoxFragment(fragment->Children()[0].get()); | 1184 body_fragment = toNGPhysicalBoxFragment(fragment->Children()[0].get()); |
1185 container_fragment = | 1185 container_fragment = |
1186 toNGPhysicalBoxFragment(body_fragment->Children()[0].get()); | 1186 toNGPhysicalBoxFragment(body_fragment->Children()[0].get()); |
1187 ASSERT_EQ(3UL, container_fragment->Children().size()); | 1187 ASSERT_EQ(3UL, container_fragment->Children().size()); |
1188 clerance_fragment = | 1188 clerance_fragment = |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2362 | 2362 |
2363 child = iterator.NextChild(); | 2363 child = iterator.NextChild(); |
2364 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(100)), child->Size()); | 2364 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(100)), child->Size()); |
2365 EXPECT_EQ(NGPhysicalOffset(LayoutUnit(0), LayoutUnit(40)), child->Offset()); | 2365 EXPECT_EQ(NGPhysicalOffset(LayoutUnit(0), LayoutUnit(40)), child->Offset()); |
2366 | 2366 |
2367 EXPECT_FALSE(iterator.NextChild()); | 2367 EXPECT_FALSE(iterator.NextChild()); |
2368 } | 2368 } |
2369 | 2369 |
2370 } // namespace | 2370 } // namespace |
2371 } // namespace blink | 2371 } // namespace blink |
OLD | NEW |