| 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 9d697ddc71bfa28c771d1136192b53d3a974c353..20a4e9c09fc721a8b89ae2d4b901cf90752af63f 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
|
| @@ -15,6 +15,13 @@
|
| namespace blink {
|
| namespace {
|
|
|
| +NGConstraintSpace* ConstructConstraintSpace(NGWritingMode writing_mode,
|
| + NGDirection direction,
|
| + NGPhysicalSize size) {
|
| + return new NGConstraintSpace(writing_mode, direction,
|
| + new NGPhysicalConstraintSpace(size));
|
| +}
|
| +
|
| class NGBlockLayoutAlgorithmTest : public ::testing::Test {
|
| protected:
|
| void SetUp() override { style_ = ComputedStyle::create(); }
|
| @@ -35,9 +42,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, FixedSize) {
|
| style_->setWidth(Length(30, Fixed));
|
| style_->setHeight(Length(40, Fixed));
|
|
|
| - auto* space =
|
| - new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + auto* space = ConstructConstraintSpace(
|
| + HorizontalTopBottom, LeftToRight,
|
| + NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, nullptr);
|
|
|
| EXPECT_EQ(LayoutUnit(30), frag->Width());
|
| @@ -65,9 +72,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildren) {
|
|
|
| first_child->SetNextSibling(second_child);
|
|
|
| - auto* space =
|
| - new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + auto* space = ConstructConstraintSpace(
|
| + HorizontalTopBottom, LeftToRight,
|
| + NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, first_child);
|
|
|
| EXPECT_EQ(LayoutUnit(kWidth), frag->Width());
|
| @@ -111,9 +118,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildrenWithWritingMode) {
|
|
|
| div1->SetFirstChild(div2);
|
|
|
| - auto* space =
|
| - new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(500), LayoutUnit(500)));
|
| + auto* space = ConstructConstraintSpace(
|
| + HorizontalTopBottom, LeftToRight,
|
| + NGPhysicalSize(LayoutUnit(500), LayoutUnit(500)));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| const NGPhysicalFragmentBase* child = frag->Children()[0];
|
| @@ -155,9 +162,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase1) {
|
|
|
| div1->SetFirstChild(div2);
|
|
|
| - auto* space =
|
| - new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + auto* space = ConstructConstraintSpace(
|
| + HorizontalTopBottom, LeftToRight,
|
| + NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| space->SetIsNewFormattingContext(true);
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| @@ -230,9 +237,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase2) {
|
| div5->SetFirstChild(div6);
|
| div6->SetNextSibling(div7);
|
|
|
| - auto* space =
|
| - new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + auto* space = ConstructConstraintSpace(
|
| + HorizontalTopBottom, LeftToRight,
|
| + NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| ASSERT_EQ(frag->Children().size(), 3UL);
|
| @@ -279,9 +286,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase3) {
|
|
|
| div1->SetFirstChild(div2);
|
|
|
| - auto* space =
|
| - new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + auto* space = ConstructConstraintSpace(
|
| + HorizontalTopBottom, LeftToRight,
|
| + NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| // Verify that margins are collapsed.
|
| @@ -328,9 +335,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase4) {
|
|
|
| div1->SetFirstChild(div2);
|
|
|
| - auto* space =
|
| - new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + auto* space = ConstructConstraintSpace(
|
| + HorizontalTopBottom, LeftToRight,
|
| + NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| // Verify that margins do NOT collapse.
|
| @@ -384,9 +391,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase5) {
|
|
|
| vertical_div->SetNextSibling(horizontal_div);
|
|
|
| - auto* space =
|
| - new NGConstraintSpace(VerticalLeftRight, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(500), LayoutUnit(500)));
|
| + auto* space = ConstructConstraintSpace(
|
| + VerticalLeftRight, LeftToRight,
|
| + NGPhysicalSize(LayoutUnit(500), LayoutUnit(500)));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, vertical_div);
|
|
|
| ASSERT_EQ(frag->Children().size(), 2UL);
|
| @@ -442,9 +449,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase6) {
|
| div1->SetFirstChild(div2);
|
| div1->SetNextSibling(div3);
|
|
|
| - auto* space =
|
| - new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(500), LayoutUnit(500)));
|
| + auto* space = ConstructConstraintSpace(
|
| + HorizontalTopBottom, LeftToRight,
|
| + NGPhysicalSize(LayoutUnit(500), LayoutUnit(500)));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| ASSERT_EQ(frag->Children().size(), 2UL);
|
| @@ -505,9 +512,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, BorderAndPadding) {
|
|
|
| div1->SetFirstChild(div2);
|
|
|
| - auto* space =
|
| - new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite));
|
| + auto* space = ConstructConstraintSpace(
|
| + HorizontalTopBottom, LeftToRight,
|
| + NGPhysicalSize(LayoutUnit(1000), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| ASSERT_EQ(frag->Children().size(), 1UL);
|
| @@ -539,9 +546,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, PercentageSize) {
|
| first_style->setWidth(Length(40, Percent));
|
| NGBox* first_child = new NGBox(first_style.get());
|
|
|
| - auto* space =
|
| - new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + auto* space = ConstructConstraintSpace(
|
| + HorizontalTopBottom, LeftToRight,
|
| + NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, first_child);
|
|
|
| EXPECT_EQ(frag->Width(), LayoutUnit(kWidth + kPaddingLeft));
|
| @@ -567,9 +574,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, AutoMargin) {
|
| first_style->setMarginRight(Length(Auto));
|
| NGBox* first_child = new NGBox(first_style.get());
|
|
|
| - auto* space =
|
| - new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + auto* space = ConstructConstraintSpace(
|
| + HorizontalTopBottom, LeftToRight,
|
| + NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, first_child);
|
|
|
| EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->Width());
|
| @@ -636,9 +643,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatFragments) {
|
| div1->SetNextSibling(div2);
|
| div2->SetNextSibling(div3);
|
|
|
| - auto* space = new NGConstraintSpace(
|
| + auto* space = ConstructConstraintSpace(
|
| HorizontalTopBottom, LeftToRight,
|
| - NGLogicalSize(LayoutUnit(kParentSize), LayoutUnit(kParentSize)));
|
| + NGPhysicalSize(LayoutUnit(kParentSize), LayoutUnit(kParentSize)));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
| ASSERT_EQ(frag->Children().size(), 3UL);
|
|
|
|
|