OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_out_of_flow_layout_part.h" | 5 #include "core/layout/ng/ng_out_of_flow_layout_part.h" |
6 | 6 |
7 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
8 #include "core/layout/ng/layout_ng_block_flow.h" | 8 #include "core/layout/ng/layout_ng_block_flow.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 </div> | 59 </div> |
60 </div> | 60 </div> |
61 </div> | 61 </div> |
62 )HTML"); | 62 )HTML"); |
63 | 63 |
64 // Test whether the oof fragments have been collected at NG->Legacy boundary. | 64 // Test whether the oof fragments have been collected at NG->Legacy boundary. |
65 Element* rel = document().getElementById("rel"); | 65 Element* rel = document().getElementById("rel"); |
66 LayoutNGBlockFlow* block_flow = toLayoutNGBlockFlow(rel->layoutObject()); | 66 LayoutNGBlockFlow* block_flow = toLayoutNGBlockFlow(rel->layoutObject()); |
67 NGConstraintSpace* space = | 67 NGConstraintSpace* space = |
68 NGConstraintSpace::CreateFromLayoutObject(*block_flow); | 68 NGConstraintSpace::CreateFromLayoutObject(*block_flow); |
69 NGBlockNode node(block_flow); | 69 NGBlockNode* node = new NGBlockNode(block_flow); |
70 RefPtr<NGPhysicalFragment> fragment = node.Layout(space); | 70 RefPtr<NGPhysicalFragment> fragment = node->Layout(space); |
71 EXPECT_EQ(fragment->OutOfFlowDescendants().size(), (size_t)2); | 71 EXPECT_EQ(fragment->OutOfFlowDescendants().size(), (size_t)2); |
72 | 72 |
73 // Test the final result. | 73 // Test the final result. |
74 Element* fixed_1 = document().getElementById("fixed1"); | 74 Element* fixed_1 = document().getElementById("fixed1"); |
75 Element* fixed_2 = document().getElementById("fixed2"); | 75 Element* fixed_2 = document().getElementById("fixed2"); |
76 // fixed1 top is static: #abs.top + #pad.height | 76 // fixed1 top is static: #abs.top + #pad.height |
77 EXPECT_EQ(fixed_1->offsetTop(), LayoutUnit(99)); | 77 EXPECT_EQ(fixed_1->offsetTop(), LayoutUnit(99)); |
78 // fixed2 top is positioned: #fixed2.top | 78 // fixed2 top is positioned: #fixed2.top |
79 EXPECT_EQ(fixed_2->offsetTop(), LayoutUnit(9)); | 79 EXPECT_EQ(fixed_2->offsetTop(), LayoutUnit(9)); |
80 }; | 80 }; |
81 } | 81 } |
82 } | 82 } |
OLD | NEW |