| Index: third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
|
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
|
| index 8a3bf3953a47c5db2281213f1ad74aadf33c0260..4b76f9c3f0010375ae8dbdee67b5090bad170656 100644
|
| --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
|
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
|
| @@ -16,8 +16,8 @@
|
| #include "core/layout/ng/ng_physical_box_fragment.h"
|
| #include "core/layout/ng/ng_physical_fragment.h"
|
| #include "core/layout/ng/ng_units.h"
|
| -#include "testing/gmock/include/gmock/gmock.h"
|
| #include "core/style/ComputedStyle.h"
|
| +#include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace blink {
|
| @@ -44,7 +44,12 @@ class NGBlockLayoutAlgorithmTest
|
| : public ::testing::WithParamInterface<TestParamLayoutNG>,
|
| public RenderingTest {
|
| public:
|
| - NGBlockLayoutAlgorithmTest() {}
|
| + NGBlockLayoutAlgorithmTest() {
|
| + RuntimeEnabledFeatures::setLayoutNGEnabled(true);
|
| + }
|
| + ~NGBlockLayoutAlgorithmTest() {
|
| + RuntimeEnabledFeatures::setLayoutNGEnabled(false);
|
| + }
|
|
|
| protected:
|
| void SetUp() override {
|
| @@ -186,12 +191,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildrenWithWritingMode) {
|
| EXPECT_EQ(kMarginLeft, child->LeftOffset());
|
| }
|
|
|
| -// Verifies the collapsing margins case for the next pair:
|
| -// - top margin of a box and top margin of its first in-flow child.
|
| // Verifies that floats are positioned at the top of the first child that can
|
| // determine its position after margins collapsed.
|
| -// TODO(glebl): Enable with new the float/margins collapsing algorithm.
|
| -TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase1WithFloats) {
|
| +TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase1WithFloats) {
|
| setBodyInnerHTML(
|
| "<style>"
|
| " #container {"
|
| @@ -295,13 +297,12 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase1WithFloats) {
|
| Pointee(expected_exclusion2))));
|
| }
|
|
|
| -// Verifies the collapsing margins case for the next pair:
|
| +// Verifies the collapsing margins case for the next pairs:
|
| // - bottom margin of box and top margin of its next in-flow following sibling.
|
| // - top and bottom margins of a box that does not establish a new block
|
| // formatting context and that has zero computed 'min-height', zero or 'auto'
|
| // computed 'height', and no in-flow children
|
| -// TODO(glebl): Enable with new the float/margins collapsing algorithm.
|
| -TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase2WithFloats) {
|
| +TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase2WithFloats) {
|
| setBodyInnerHTML(
|
| "<style>"
|
| "#first-child {"
|
| @@ -378,9 +379,10 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase2WithFloats) {
|
| EXPECT_THAT(LayoutUnit(empty5_fragment_block_offset),
|
| empty5_fragment->TopOffset());
|
|
|
| - ASSERT_EQ(3UL, body_fragment->PositionedFloats().size());
|
| + ASSERT_EQ(1UL, body_fragment->PositionedFloats().size());
|
| + ASSERT_EQ(1UL, body_fragment->PositionedFloats().size());
|
| auto float_nonempties_fragment =
|
| - body_fragment->PositionedFloats().at(1)->fragment;
|
| + body_fragment->PositionedFloats().at(0)->fragment;
|
| // 70 = first_child's height(50) + first child's margin-bottom(20)
|
| EXPECT_THAT(LayoutUnit(70), float_nonempties_fragment->TopOffset());
|
| EXPECT_THAT(LayoutUnit(0), float_nonempties_fragment->LeftOffset());
|
| @@ -430,8 +432,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase2WithFloats) {
|
| // Verifies the collapsing margins case for the next pair:
|
| // - bottom margin of a last in-flow child and bottom margin of its parent if
|
| // the parent has 'auto' computed height
|
| -// TODO(glebl): Enable with new the float/margins collapsing algorithm.
|
| -TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase3) {
|
| +TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase3) {
|
| setBodyInnerHTML(
|
| "<style>"
|
| " #container {"
|
| @@ -467,22 +468,20 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase3) {
|
| // Margins are collapsed with the result 200 = std::max(20, 200)
|
| // The fragment size 258 == body's margin 8 + child's height 50 + 200
|
| EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(258)), fragment->Size());
|
| - // EXPECT_EQ(NGMarginStrut({LayoutUnit(200)}),
|
| - // container_fragment->EndMarginStrut());
|
| + EXPECT_EQ(NGMarginStrut({LayoutUnit(200)}),
|
| + container_fragment->EndMarginStrut());
|
|
|
| // height == fixed
|
| run_test(Length(50, Fixed));
|
| // Margins are not collapsed, so fragment still has margins == 20.
|
| // The fragment size 78 == body's margin 8 + child's height 50 + 20
|
| - // EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(78)),
|
| - // fragment->Size());
|
| - // EXPECT_EQ(NGMarginStrut(), container_fragment->EndMarginStrut());
|
| + EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(78)), fragment->Size());
|
| + EXPECT_EQ(NGMarginStrut(), container_fragment->EndMarginStrut());
|
| }
|
|
|
| // Verifies that 2 adjoining margins are not collapsed if there is padding or
|
| // border that separates them.
|
| -// TODO(glebl): Enable with new the float/margins collapsing algorithm.
|
| -TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase4) {
|
| +TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase4) {
|
| setBodyInnerHTML(
|
| "<style>"
|
| " #container {"
|
| @@ -546,7 +545,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase4) {
|
| // horizontal
|
| // </div>
|
| // </div>
|
| -TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase5) {
|
| +// TODO(glebl): fix writing modes support after new margin collapsing/floats
|
| +// algorithm is checked in.
|
| +TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase5) {
|
| const int kVerticalDivMarginRight = 60;
|
| const int kVerticalDivWidth = 50;
|
| const int kHorizontalDivMarginLeft = 100;
|
| @@ -870,8 +871,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_PositionFloatInsideEmptyBlocks) {
|
|
|
| // Verifies that left/right floating and regular blocks can be positioned
|
| // correctly by the algorithm.
|
| -// TODO(glebl): Enable with new the float/margins collapsing algorithm.
|
| -TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_PositionFloatFragments) {
|
| +TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatFragments) {
|
| setBodyInnerHTML(
|
| "<style>"
|
| " #container {"
|
| @@ -924,7 +924,6 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_PositionFloatFragments) {
|
| document().getElementsByTagName("html")->item(0));
|
|
|
| // ** Verify LayoutNG fragments and the list of positioned floats **
|
| - EXPECT_THAT(LayoutUnit(), fragment->TopOffset());
|
| ASSERT_EQ(1UL, fragment->Children().size());
|
| auto* body_fragment = toNGPhysicalBoxFragment(fragment->Children()[0]);
|
| EXPECT_THAT(LayoutUnit(8), body_fragment->TopOffset());
|
| @@ -1044,8 +1043,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_PositionFloatFragments) {
|
| }
|
|
|
| // Verifies that NG block layout algorithm respects "clear" CSS property.
|
| -// TODO(glebl): Enable with new the float/margins collapsing algorithm.
|
| -TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_PositionFragmentsWithClear) {
|
| +TEST_F(NGBlockLayoutAlgorithmTest, PositionFragmentsWithClear) {
|
| setBodyInnerHTML(
|
| "<style>"
|
| " #container {"
|
| @@ -1252,7 +1250,9 @@ class FragmentChildIterator
|
| // <div id="parent" style="columns:2; column-fill:auto; column-gap:10px;
|
| // width:210px; height:100px;">
|
| // </div>
|
| -TEST_F(NGBlockLayoutAlgorithmTest, EmptyMulticol) {
|
| +// TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
|
| +// is checked in.
|
| +TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_EmptyMulticol) {
|
| // parent
|
| RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
|
| parent_style->setColumnCount(2);
|
| @@ -1282,7 +1282,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, EmptyMulticol) {
|
| // width:210px; height:100px;">
|
| // <div id="child"></div>
|
| // </div>
|
| -TEST_F(NGBlockLayoutAlgorithmTest, EmptyBlock) {
|
| +// TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
|
| +// is checked in.
|
| +TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_EmptyBlock) {
|
| // parent
|
| RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
|
| parent_style->setColumnCount(2);
|
| @@ -1326,7 +1328,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, EmptyBlock) {
|
| // width:310px; height:100px;">
|
| // <div id="child" style="width:60%; height:100px;"></div>
|
| // </div>
|
| -TEST_F(NGBlockLayoutAlgorithmTest, BlockInOneColumn) {
|
| +// TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
|
| +// is checked in.
|
| +TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_BlockInOneColumn) {
|
| // parent
|
| RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
|
| parent_style->setColumnCount(2);
|
| @@ -1373,7 +1377,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, BlockInOneColumn) {
|
| // width:210px; height:100px;">
|
| // <div id="child" style="width:75%; height:150px;"></div>
|
| // </div>
|
| -TEST_F(NGBlockLayoutAlgorithmTest, BlockInTwoColumns) {
|
| +// TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
|
| +// is checked in.
|
| +TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_BlockInTwoColumns) {
|
| // parent
|
| RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
|
| parent_style->setColumnCount(2);
|
| @@ -1429,7 +1435,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, BlockInTwoColumns) {
|
| // width:320px; height:100px;">
|
| // <div id="child" style="width:75%; height:250px;"></div>
|
| // </div>
|
| -TEST_F(NGBlockLayoutAlgorithmTest, BlockInThreeColumns) {
|
| +// TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
|
| +// is checked in.
|
| +TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_BlockInThreeColumns) {
|
| // parent
|
| RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
|
| parent_style->setColumnCount(3);
|
| @@ -1494,7 +1502,10 @@ TEST_F(NGBlockLayoutAlgorithmTest, BlockInThreeColumns) {
|
| // width:210px; height:100px;">
|
| // <div id="child" style="width:1px; height:250px;"></div>
|
| // </div>
|
| -TEST_F(NGBlockLayoutAlgorithmTest, ActualColumnCountGreaterThanSpecified) {
|
| +// TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
|
| +// is checked in.
|
| +TEST_F(NGBlockLayoutAlgorithmTest,
|
| + DISABLED_ActualColumnCountGreaterThanSpecified) {
|
| // parent
|
| RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
|
| parent_style->setColumnCount(2);
|
| @@ -1560,7 +1571,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, ActualColumnCountGreaterThanSpecified) {
|
| // <div id="child1" style="width:75%; height:60px;"></div>
|
| // <div id="child2" style="width:85%; height:60px;"></div>
|
| // </div>
|
| -TEST_F(NGBlockLayoutAlgorithmTest, TwoBlocksInTwoColumns) {
|
| +// TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
|
| +// is checked in.
|
| +TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_TwoBlocksInTwoColumns) {
|
| // parent
|
| RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
|
| parent_style->setColumnCount(3);
|
| @@ -1635,7 +1648,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, TwoBlocksInTwoColumns) {
|
| // </div>
|
| // <div id="child2" style="width:85%; height:10px;"></div>
|
| // </div>
|
| -TEST_F(NGBlockLayoutAlgorithmTest, OverflowedBlock) {
|
| +// TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
|
| +// is checked in.
|
| +TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_OverflowedBlock) {
|
| // parent
|
| RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
|
| parent_style->setColumnCount(3);
|
| @@ -1743,7 +1758,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, OverflowedBlock) {
|
| // width:320px; height:100px;">
|
| // <div id="child" style="float:left; width:75%; height:100px;"></div>
|
| // </div>
|
| -TEST_F(NGBlockLayoutAlgorithmTest, FloatInOneColumn) {
|
| +// TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
|
| +// is checked in.
|
| +TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_FloatInOneColumn) {
|
| // parent
|
| RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
|
| parent_style->setColumnCount(3);
|
| @@ -1792,7 +1809,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, FloatInOneColumn) {
|
| // <div id="child1" style="float:left; width:15%; height:100px;"></div>
|
| // <div id="child2" style="float:right; width:16%; height:100px;"></div>
|
| // </div>
|
| -TEST_F(NGBlockLayoutAlgorithmTest, TwoFloatsInOneColumn) {
|
| +// TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
|
| +// is checked in.
|
| +TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_TwoFloatsInOneColumn) {
|
| // parent
|
| RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
|
| parent_style->setColumnCount(3);
|
| @@ -1857,7 +1876,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, TwoFloatsInOneColumn) {
|
| // <div id="child1" style="float:left; width:15%; height:150px;"></div>
|
| // <div id="child2" style="float:right; width:16%; height:150px;"></div>
|
| // </div>
|
| -TEST_F(NGBlockLayoutAlgorithmTest, TwoFloatsInTwoColumns) {
|
| +// TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
|
| +// is checked in.
|
| +TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_TwoFloatsInTwoColumns) {
|
| // parent
|
| RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
|
| parent_style->setColumnCount(3);
|
|
|