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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 const NGPhysicalFragment* child1 = frag->Children()[0].Get(); | 617 const NGPhysicalFragment* child1 = frag->Children()[0].Get(); |
618 EXPECT_EQ(0, child1->TopOffset()); | 618 EXPECT_EQ(0, child1->TopOffset()); |
619 EXPECT_EQ(kHeight, child1->Height()); | 619 EXPECT_EQ(kHeight, child1->Height()); |
620 | 620 |
621 const NGPhysicalFragment* child2 = frag->Children()[1].Get(); | 621 const NGPhysicalFragment* child2 = frag->Children()[1].Get(); |
622 EXPECT_EQ(kHeight + std::max(kMarginBottom, kMarginTop), child2->TopOffset()); | 622 EXPECT_EQ(kHeight + std::max(kMarginBottom, kMarginTop), child2->TopOffset()); |
623 } | 623 } |
624 | 624 |
625 // Verifies that a child with clearance - which does nothing - still shifts its | 625 // Verifies that a child with clearance - which does nothing - still shifts its |
626 // parent's offset. | 626 // parent's offset. |
627 TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase7) { | 627 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase7) { |
628 SetBodyInnerHTML(R"HTML( | 628 SetBodyInnerHTML(R"HTML( |
629 <!DOCTYPE html> | 629 <!DOCTYPE html> |
630 <style> | 630 <style> |
631 body { | 631 body { |
632 outline: solid purple 1px; | 632 outline: solid purple 1px; |
633 width: 200px; | 633 width: 200px; |
634 } | 634 } |
635 #zero { | 635 #zero { |
636 outline: solid red 1px; | 636 outline: solid red 1px; |
637 margin-top: 10px; | 637 margin-top: 10px; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 ASSERT_EQ(1UL, frag->Children().size()); | 791 ASSERT_EQ(1UL, frag->Children().size()); |
792 | 792 |
793 const NGPhysicalFragment* child = frag->Children()[0].Get(); | 793 const NGPhysicalFragment* child = frag->Children()[0].Get(); |
794 EXPECT_EQ(LayoutUnit(kChildWidth), child->Width()); | 794 EXPECT_EQ(LayoutUnit(kChildWidth), child->Width()); |
795 EXPECT_EQ(LayoutUnit(kPaddingLeft + 10), child->LeftOffset()); | 795 EXPECT_EQ(LayoutUnit(kPaddingLeft + 10), child->LeftOffset()); |
796 EXPECT_EQ(LayoutUnit(0), child->TopOffset()); | 796 EXPECT_EQ(LayoutUnit(0), child->TopOffset()); |
797 } | 797 } |
798 | 798 |
799 // Verifies that floats can be correctly positioned if they are inside of nested | 799 // Verifies that floats can be correctly positioned if they are inside of nested |
800 // empty blocks. | 800 // empty blocks. |
801 TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatInsideEmptyBlocks) { | 801 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_PositionFloatInsideEmptyBlocks) { |
802 SetBodyInnerHTML(R"HTML( | 802 SetBodyInnerHTML(R"HTML( |
803 <style> | 803 <style> |
804 #container { | 804 #container { |
805 height: 300px; | 805 height: 300px; |
806 width: 300px; | 806 width: 300px; |
807 outline: blue solid; | 807 outline: blue solid; |
808 } | 808 } |
809 #empty1 { | 809 #empty1 { |
810 margin: 20px; | 810 margin: 20px; |
811 padding: 0 20px; | 811 padding: 0 20px; |
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2326 run_test(Length(120, kFixed)); | 2326 run_test(Length(120, kFixed)); |
2327 // 30 = #float's height | 2327 // 30 = #float's height |
2328 EXPECT_THAT(new_fc_fragment->Offset(), | 2328 EXPECT_THAT(new_fc_fragment->Offset(), |
2329 NGPhysicalOffset(LayoutUnit(0), LayoutUnit(30))); | 2329 NGPhysicalOffset(LayoutUnit(0), LayoutUnit(30))); |
2330 // 8 = body's margins, no margin collapsing | 2330 // 8 = body's margins, no margin collapsing |
2331 EXPECT_THAT(body_fragment->Offset(), | 2331 EXPECT_THAT(body_fragment->Offset(), |
2332 NGPhysicalOffset(LayoutUnit(8), LayoutUnit(8))); | 2332 NGPhysicalOffset(LayoutUnit(8), LayoutUnit(8))); |
2333 } | 2333 } |
2334 } // namespace | 2334 } // namespace |
2335 } // namespace blink | 2335 } // namespace blink |
OLD | NEW |