| 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 30fc3021075eb433ab76089d080fee17b29e64d7..23c0b1b6cd097368b8d2d9f32f3672d322a1d899 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
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "core/layout/ng/ng_box.h"
|
| #include "core/layout/ng/ng_constraint_space.h"
|
| +#include "core/layout/ng/ng_constraint_space_builder.h"
|
| #include "core/layout/ng/ng_physical_fragment.h"
|
| #include "core/layout/ng/ng_length_utils.h"
|
| #include "core/layout/ng/ng_units.h"
|
| @@ -17,9 +18,11 @@ namespace {
|
|
|
| NGConstraintSpace* ConstructConstraintSpace(NGWritingMode writing_mode,
|
| NGDirection direction,
|
| - NGPhysicalSize size) {
|
| - return new NGConstraintSpace(writing_mode, direction,
|
| - new NGPhysicalConstraintSpace(size));
|
| + NGLogicalSize size) {
|
| + NGConstraintSpaceBuilder builder(writing_mode);
|
| + return new NGConstraintSpace(
|
| + writing_mode, direction,
|
| + builder.SetContainerSize(size).ToConstraintSpace());
|
| }
|
|
|
| class NGBlockLayoutAlgorithmTest : public ::testing::Test {
|
| @@ -44,7 +47,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, FixedSize) {
|
|
|
| auto* space = ConstructConstraintSpace(
|
| HorizontalTopBottom, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, nullptr);
|
|
|
| EXPECT_EQ(LayoutUnit(30), frag->Width());
|
| @@ -74,7 +77,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildren) {
|
|
|
| auto* space = ConstructConstraintSpace(
|
| HorizontalTopBottom, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, first_child);
|
|
|
| EXPECT_EQ(LayoutUnit(kWidth), frag->Width());
|
| @@ -118,9 +121,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildrenWithWritingMode) {
|
|
|
| div1->SetFirstChild(div2);
|
|
|
| - auto* space = ConstructConstraintSpace(
|
| - HorizontalTopBottom, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(500), LayoutUnit(500)));
|
| + auto* space =
|
| + ConstructConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| + NGLogicalSize(LayoutUnit(500), LayoutUnit(500)));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| const NGPhysicalFragmentBase* child = frag->Children()[0];
|
| @@ -164,7 +167,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase1) {
|
|
|
| auto* space = ConstructConstraintSpace(
|
| HorizontalTopBottom, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| space->SetIsNewFormattingContext(true);
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| @@ -239,7 +242,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase2) {
|
|
|
| auto* space = ConstructConstraintSpace(
|
| HorizontalTopBottom, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| ASSERT_EQ(frag->Children().size(), 3UL);
|
| @@ -288,7 +291,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase3) {
|
|
|
| auto* space = ConstructConstraintSpace(
|
| HorizontalTopBottom, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| // Verify that margins are collapsed.
|
| @@ -337,7 +340,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase4) {
|
|
|
| auto* space = ConstructConstraintSpace(
|
| HorizontalTopBottom, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| // Verify that margins do NOT collapse.
|
| @@ -391,9 +394,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase5) {
|
|
|
| vertical_div->SetNextSibling(horizontal_div);
|
|
|
| - auto* space = ConstructConstraintSpace(
|
| - VerticalLeftRight, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(500), LayoutUnit(500)));
|
| + auto* space =
|
| + ConstructConstraintSpace(VerticalLeftRight, LeftToRight,
|
| + NGLogicalSize(LayoutUnit(500), LayoutUnit(500)));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, vertical_div);
|
|
|
| ASSERT_EQ(frag->Children().size(), 2UL);
|
| @@ -449,9 +452,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase6) {
|
| div1->SetFirstChild(div2);
|
| div1->SetNextSibling(div3);
|
|
|
| - auto* space = ConstructConstraintSpace(
|
| - HorizontalTopBottom, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(500), LayoutUnit(500)));
|
| + auto* space =
|
| + ConstructConstraintSpace(HorizontalTopBottom, LeftToRight,
|
| + NGLogicalSize(LayoutUnit(500), LayoutUnit(500)));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| ASSERT_EQ(frag->Children().size(), 2UL);
|
| @@ -514,7 +517,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, BorderAndPadding) {
|
|
|
| auto* space = ConstructConstraintSpace(
|
| HorizontalTopBottom, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(1000), NGSizeIndefinite));
|
| + NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
|
|
| ASSERT_EQ(frag->Children().size(), 1UL);
|
| @@ -548,7 +551,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, PercentageSize) {
|
|
|
| auto* space = ConstructConstraintSpace(
|
| HorizontalTopBottom, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, first_child);
|
|
|
| EXPECT_EQ(frag->Width(), LayoutUnit(kWidth + kPaddingLeft));
|
| @@ -576,7 +579,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, AutoMargin) {
|
|
|
| auto* space = ConstructConstraintSpace(
|
| HorizontalTopBottom, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| + NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, first_child);
|
|
|
| EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->Width());
|
| @@ -645,7 +648,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatFragments) {
|
|
|
| auto* space = ConstructConstraintSpace(
|
| HorizontalTopBottom, LeftToRight,
|
| - NGPhysicalSize(LayoutUnit(kParentSize), LayoutUnit(kParentSize)));
|
| + NGLogicalSize(LayoutUnit(kParentSize), LayoutUnit(kParentSize)));
|
| NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
|
| ASSERT_EQ(frag->Children().size(), 3UL);
|
|
|
|
|