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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 | 632 |
633 ASSERT_EQ(frag->Children().size(), 1UL); | 633 ASSERT_EQ(frag->Children().size(), 1UL); |
634 | 634 |
635 // div1 | 635 // div1 |
636 const NGPhysicalFragment* child = frag->Children()[0].get(); | 636 const NGPhysicalFragment* child = frag->Children()[0].get(); |
637 EXPECT_EQ(kBorderLeft + kPaddingLeft + kWidth + kPaddingRight + kBorderRight, | 637 EXPECT_EQ(kBorderLeft + kPaddingLeft + kWidth + kPaddingRight + kBorderRight, |
638 child->Width()); | 638 child->Width()); |
639 EXPECT_EQ(kBorderTop + kPaddingTop + kHeight + kPaddingBottom + kBorderBottom, | 639 EXPECT_EQ(kBorderTop + kPaddingTop + kHeight + kPaddingBottom + kBorderBottom, |
640 child->Height()); | 640 child->Height()); |
641 | 641 |
642 ASSERT_TRUE(child->Type() == NGPhysicalFragment::kFragmentBox); | 642 ASSERT_TRUE(child->IsBox()); |
643 ASSERT_EQ(static_cast<const NGPhysicalBoxFragment*>(child)->Children().size(), | 643 ASSERT_EQ(static_cast<const NGPhysicalBoxFragment*>(child)->Children().size(), |
644 1UL); | 644 1UL); |
645 | 645 |
646 // div2 | 646 // div2 |
647 child = static_cast<const NGPhysicalBoxFragment*>(child)->Children()[0].get(); | 647 child = static_cast<const NGPhysicalBoxFragment*>(child)->Children()[0].get(); |
648 EXPECT_EQ(kBorderTop + kPaddingTop, child->TopOffset()); | 648 EXPECT_EQ(kBorderTop + kPaddingTop, child->TopOffset()); |
649 EXPECT_EQ(kBorderLeft + kPaddingLeft, child->LeftOffset()); | 649 EXPECT_EQ(kBorderLeft + kPaddingLeft, child->LeftOffset()); |
650 } | 650 } |
651 | 651 |
652 TEST_F(NGBlockLayoutAlgorithmTest, PercentageResolutionSize) { | 652 TEST_F(NGBlockLayoutAlgorithmTest, PercentageResolutionSize) { |
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2209 | 2209 |
2210 child = iterator.NextChild(); | 2210 child = iterator.NextChild(); |
2211 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(100)), child->Size()); | 2211 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(100)), child->Size()); |
2212 EXPECT_EQ(NGPhysicalOffset(LayoutUnit(0), LayoutUnit(40)), child->Offset()); | 2212 EXPECT_EQ(NGPhysicalOffset(LayoutUnit(0), LayoutUnit(40)), child->Offset()); |
2213 | 2213 |
2214 EXPECT_FALSE(iterator.NextChild()); | 2214 EXPECT_FALSE(iterator.NextChild()); |
2215 } | 2215 } |
2216 | 2216 |
2217 } // namespace | 2217 } // namespace |
2218 } // namespace blink | 2218 } // namespace blink |
OLD | NEW |