| Index: third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc
|
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc
|
| index 568b7ffe75ec97a91303ae84cd93d4737a33d2de..506d0fcd4dbc6d8b7ce5d89e9c15e07a7777b5b8 100644
|
| --- a/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc
|
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_length_utils_test.cc
|
| @@ -35,34 +35,34 @@ class NGLengthUtilsTest : public ::testing::Test {
|
| return derived_constraint_space;
|
| }
|
|
|
| - LayoutUnit resolveInlineLength(
|
| + LayoutUnit ResolveInlineLength(
|
| const Length& length,
|
| LengthResolveType type = LengthResolveType::ContentSize) {
|
| NGConstraintSpace* constraintSpace = ConstructConstraintSpace(200, 300);
|
| - return ::blink::resolveInlineLength(*constraintSpace, *style_, length,
|
| + return ::blink::ResolveInlineLength(*constraintSpace, *style_, length,
|
| type);
|
| }
|
|
|
| - LayoutUnit resolveBlockLength(
|
| + LayoutUnit ResolveBlockLength(
|
| const Length& length,
|
| LengthResolveType type = LengthResolveType::ContentSize,
|
| LayoutUnit contentSize = LayoutUnit()) {
|
| NGConstraintSpace* constraintSpace = ConstructConstraintSpace(200, 300);
|
| - return ::blink::resolveBlockLength(*constraintSpace, *style_, length,
|
| + return ::blink::ResolveBlockLength(*constraintSpace, *style_, length,
|
| contentSize, type);
|
| }
|
|
|
| - LayoutUnit computeInlineSizeForFragment(
|
| + LayoutUnit ComputeInlineSizeForFragment(
|
| const NGConstraintSpace* constraintSpace =
|
| ConstructConstraintSpace(200, 300)) {
|
| - return ::blink::computeInlineSizeForFragment(*constraintSpace, *style_);
|
| + return ::blink::ComputeInlineSizeForFragment(*constraintSpace, *style_);
|
| }
|
|
|
| - LayoutUnit computeBlockSizeForFragment(
|
| + LayoutUnit ComputeBlockSizeForFragment(
|
| const NGConstraintSpace* constraintSpace = ConstructConstraintSpace(200,
|
| 300),
|
| LayoutUnit contentSize = LayoutUnit()) {
|
| - return ::blink::computeBlockSizeForFragment(*constraintSpace, *style_,
|
| + return ::blink::ComputeBlockSizeForFragment(*constraintSpace, *style_,
|
| contentSize);
|
| }
|
|
|
| @@ -70,140 +70,140 @@ class NGLengthUtilsTest : public ::testing::Test {
|
| };
|
|
|
| TEST_F(NGLengthUtilsTest, testResolveInlineLength) {
|
| - EXPECT_EQ(LayoutUnit(60), resolveInlineLength(Length(30, Percent)));
|
| - EXPECT_EQ(LayoutUnit(150), resolveInlineLength(Length(150, Fixed)));
|
| + EXPECT_EQ(LayoutUnit(60), ResolveInlineLength(Length(30, Percent)));
|
| + EXPECT_EQ(LayoutUnit(150), ResolveInlineLength(Length(150, Fixed)));
|
| EXPECT_EQ(LayoutUnit(0),
|
| - resolveInlineLength(Length(Auto), LengthResolveType::MinSize));
|
| - EXPECT_EQ(LayoutUnit(200), resolveInlineLength(Length(Auto)));
|
| - EXPECT_EQ(LayoutUnit(200), resolveInlineLength(Length(FillAvailable)));
|
| + ResolveInlineLength(Length(Auto), LengthResolveType::MinSize));
|
| + EXPECT_EQ(LayoutUnit(200), ResolveInlineLength(Length(Auto)));
|
| + EXPECT_EQ(LayoutUnit(200), ResolveInlineLength(Length(FillAvailable)));
|
|
|
| EXPECT_EQ(LayoutUnit(200),
|
| - resolveInlineLength(Length(Auto), LengthResolveType::MaxSize));
|
| - EXPECT_EQ(LayoutUnit(200), resolveInlineLength(Length(FillAvailable),
|
| + ResolveInlineLength(Length(Auto), LengthResolveType::MaxSize));
|
| + EXPECT_EQ(LayoutUnit(200), ResolveInlineLength(Length(FillAvailable),
|
| LengthResolveType::MaxSize));
|
| }
|
|
|
| TEST_F(NGLengthUtilsTest, testResolveBlockLength) {
|
| - EXPECT_EQ(LayoutUnit(90), resolveBlockLength(Length(30, Percent)));
|
| - EXPECT_EQ(LayoutUnit(150), resolveBlockLength(Length(150, Fixed)));
|
| - EXPECT_EQ(LayoutUnit(0), resolveBlockLength(Length(Auto)));
|
| - EXPECT_EQ(LayoutUnit(300), resolveBlockLength(Length(FillAvailable)));
|
| + EXPECT_EQ(LayoutUnit(90), ResolveBlockLength(Length(30, Percent)));
|
| + EXPECT_EQ(LayoutUnit(150), ResolveBlockLength(Length(150, Fixed)));
|
| + EXPECT_EQ(LayoutUnit(0), ResolveBlockLength(Length(Auto)));
|
| + EXPECT_EQ(LayoutUnit(300), ResolveBlockLength(Length(FillAvailable)));
|
|
|
| EXPECT_EQ(LayoutUnit(0),
|
| - resolveBlockLength(Length(Auto), LengthResolveType::ContentSize));
|
| + ResolveBlockLength(Length(Auto), LengthResolveType::ContentSize));
|
| EXPECT_EQ(LayoutUnit(300),
|
| - resolveBlockLength(Length(FillAvailable),
|
| + ResolveBlockLength(Length(FillAvailable),
|
| LengthResolveType::ContentSize));
|
| }
|
|
|
| TEST_F(NGLengthUtilsTest, testComputeInlineSizeForFragment) {
|
| style_->setLogicalWidth(Length(30, Percent));
|
| - EXPECT_EQ(LayoutUnit(60), computeInlineSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(60), ComputeInlineSizeForFragment());
|
|
|
| style_->setLogicalWidth(Length(150, Fixed));
|
| - EXPECT_EQ(LayoutUnit(150), computeInlineSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(150), ComputeInlineSizeForFragment());
|
|
|
| style_->setLogicalWidth(Length(Auto));
|
| - EXPECT_EQ(LayoutUnit(200), computeInlineSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(200), ComputeInlineSizeForFragment());
|
|
|
| style_->setLogicalWidth(Length(FillAvailable));
|
| - EXPECT_EQ(LayoutUnit(200), computeInlineSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(200), ComputeInlineSizeForFragment());
|
|
|
| style_->setLogicalWidth(Length(CalculationValue::create(
|
| PixelsAndPercent(100, -10), ValueRangeNonNegative)));
|
| - EXPECT_EQ(LayoutUnit(80), computeInlineSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(80), ComputeInlineSizeForFragment());
|
|
|
| NGConstraintSpace* constraintSpace =
|
| ConstructConstraintSpace(120, 120, true, true);
|
| style_->setLogicalWidth(Length(150, Fixed));
|
| - EXPECT_EQ(LayoutUnit(120), computeInlineSizeForFragment(constraintSpace));
|
| + EXPECT_EQ(LayoutUnit(120), ComputeInlineSizeForFragment(constraintSpace));
|
|
|
| style_->setLogicalWidth(Length(200, Fixed));
|
| style_->setMaxWidth(Length(80, Percent));
|
| - EXPECT_EQ(LayoutUnit(160), computeInlineSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(160), ComputeInlineSizeForFragment());
|
|
|
| style_->setLogicalWidth(Length(100, Fixed));
|
| style_->setMinWidth(Length(80, Percent));
|
| - EXPECT_EQ(LayoutUnit(160), computeInlineSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(160), ComputeInlineSizeForFragment());
|
|
|
| style_ = ComputedStyle::create();
|
| style_->setMarginRight(Length(20, Fixed));
|
| - EXPECT_EQ(LayoutUnit(180), computeInlineSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(180), ComputeInlineSizeForFragment());
|
|
|
| style_->setLogicalWidth(Length(100, Fixed));
|
| style_->setPaddingLeft(Length(50, Fixed));
|
| - EXPECT_EQ(LayoutUnit(150), computeInlineSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(150), ComputeInlineSizeForFragment());
|
|
|
| style_->setBoxSizing(BoxSizingBorderBox);
|
| - EXPECT_EQ(LayoutUnit(100), computeInlineSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(100), ComputeInlineSizeForFragment());
|
|
|
| // Content size should never be below zero, even with box-sizing: border-box
|
| // and a large padding...
|
| style_->setPaddingLeft(Length(400, Fixed));
|
| - EXPECT_EQ(LayoutUnit(400), computeInlineSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(400), ComputeInlineSizeForFragment());
|
|
|
| // ...and the same goes for fill-available with a large padding.
|
| style_->setLogicalWidth(Length(FillAvailable));
|
| - EXPECT_EQ(LayoutUnit(400), computeInlineSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(400), ComputeInlineSizeForFragment());
|
|
|
| // TODO(layout-ng): test {min,max}-content on max-width.
|
| }
|
|
|
| TEST_F(NGLengthUtilsTest, testComputeBlockSizeForFragment) {
|
| style_->setLogicalHeight(Length(30, Percent));
|
| - EXPECT_EQ(LayoutUnit(90), computeBlockSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(90), ComputeBlockSizeForFragment());
|
|
|
| style_->setLogicalHeight(Length(150, Fixed));
|
| - EXPECT_EQ(LayoutUnit(150), computeBlockSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(150), ComputeBlockSizeForFragment());
|
|
|
| style_->setLogicalHeight(Length(Auto));
|
| - EXPECT_EQ(LayoutUnit(0), computeBlockSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(0), ComputeBlockSizeForFragment());
|
|
|
| style_->setLogicalHeight(Length(Auto));
|
| EXPECT_EQ(LayoutUnit(120),
|
| - computeBlockSizeForFragment(ConstructConstraintSpace(200, 300),
|
| + ComputeBlockSizeForFragment(ConstructConstraintSpace(200, 300),
|
| LayoutUnit(120)));
|
|
|
| style_->setLogicalHeight(Length(FillAvailable));
|
| - EXPECT_EQ(LayoutUnit(300), computeBlockSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(300), ComputeBlockSizeForFragment());
|
|
|
| style_->setLogicalHeight(Length(CalculationValue::create(
|
| PixelsAndPercent(100, -10), ValueRangeNonNegative)));
|
| - EXPECT_EQ(LayoutUnit(70), computeBlockSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(70), ComputeBlockSizeForFragment());
|
|
|
| NGConstraintSpace* constraintSpace =
|
| ConstructConstraintSpace(200, 200, true, true);
|
| style_->setLogicalHeight(Length(150, Fixed));
|
| - EXPECT_EQ(LayoutUnit(200), computeBlockSizeForFragment(constraintSpace));
|
| + EXPECT_EQ(LayoutUnit(200), ComputeBlockSizeForFragment(constraintSpace));
|
|
|
| style_->setLogicalHeight(Length(300, Fixed));
|
| style_->setMaxHeight(Length(80, Percent));
|
| - EXPECT_EQ(LayoutUnit(240), computeBlockSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(240), ComputeBlockSizeForFragment());
|
|
|
| style_->setLogicalHeight(Length(100, Fixed));
|
| style_->setMinHeight(Length(80, Percent));
|
| - EXPECT_EQ(LayoutUnit(240), computeBlockSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(240), ComputeBlockSizeForFragment());
|
|
|
| style_ = ComputedStyle::create();
|
| style_->setMarginTop(Length(20, Fixed));
|
| style_->setLogicalHeight(Length(FillAvailable));
|
| - EXPECT_EQ(LayoutUnit(280), computeBlockSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(280), ComputeBlockSizeForFragment());
|
|
|
| style_->setLogicalHeight(Length(100, Fixed));
|
| style_->setPaddingBottom(Length(50, Fixed));
|
| - EXPECT_EQ(LayoutUnit(150), computeBlockSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(150), ComputeBlockSizeForFragment());
|
|
|
| style_->setBoxSizing(BoxSizingBorderBox);
|
| - EXPECT_EQ(LayoutUnit(100), computeBlockSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(100), ComputeBlockSizeForFragment());
|
|
|
| // Content size should never be below zero, even with box-sizing: border-box
|
| // and a large padding...
|
| style_->setPaddingBottom(Length(400, Fixed));
|
| - EXPECT_EQ(LayoutUnit(400), computeBlockSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(400), ComputeBlockSizeForFragment());
|
|
|
| // ...and the same goes for fill-available with a large padding.
|
| style_->setLogicalHeight(Length(FillAvailable));
|
| - EXPECT_EQ(LayoutUnit(400), computeBlockSizeForFragment());
|
| + EXPECT_EQ(LayoutUnit(400), ComputeBlockSizeForFragment());
|
|
|
| // TODO(layout-ng): test {min,max}-content on max-height.
|
| }
|
| @@ -213,13 +213,13 @@ TEST_F(NGLengthUtilsTest, testIndefinitePercentages) {
|
| style_->setHeight(Length(20, Percent));
|
|
|
| EXPECT_EQ(NGSizeIndefinite,
|
| - computeBlockSizeForFragment(ConstructConstraintSpace(200, -1),
|
| + ComputeBlockSizeForFragment(ConstructConstraintSpace(200, -1),
|
| LayoutUnit(-1)));
|
| EXPECT_EQ(LayoutUnit(20),
|
| - computeBlockSizeForFragment(ConstructConstraintSpace(200, -1),
|
| + ComputeBlockSizeForFragment(ConstructConstraintSpace(200, -1),
|
| LayoutUnit(10)));
|
| EXPECT_EQ(LayoutUnit(120),
|
| - computeBlockSizeForFragment(ConstructConstraintSpace(200, -1),
|
| + ComputeBlockSizeForFragment(ConstructConstraintSpace(200, -1),
|
| LayoutUnit(120)));
|
| }
|
|
|
| @@ -231,7 +231,7 @@ TEST_F(NGLengthUtilsTest, testMargins) {
|
|
|
| NGConstraintSpace* constraintSpace(ConstructConstraintSpace(200, 300));
|
|
|
| - NGBoxStrut margins = computeMargins(*constraintSpace, *style_,
|
| + NGBoxStrut margins = ComputeMargins(*constraintSpace, *style_,
|
| HorizontalTopBottom, LeftToRight);
|
|
|
| EXPECT_EQ(LayoutUnit(20), margins.block_start);
|
| @@ -251,7 +251,7 @@ TEST_F(NGLengthUtilsTest, testBorders) {
|
| style_->setBorderLeftStyle(BorderStyleSolid);
|
| style_->setWritingMode(LeftToRightWritingMode);
|
|
|
| - NGBoxStrut borders = computeBorders(*style_);
|
| + NGBoxStrut borders = ComputeBorders(*style_);
|
|
|
| EXPECT_EQ(LayoutUnit(4), borders.block_start);
|
| EXPECT_EQ(LayoutUnit(3), borders.inline_end);
|
| @@ -268,7 +268,7 @@ TEST_F(NGLengthUtilsTest, testPadding) {
|
|
|
| NGConstraintSpace* constraintSpace(ConstructConstraintSpace(200, 300));
|
|
|
| - NGBoxStrut padding = computePadding(*constraintSpace, *style_);
|
| + NGBoxStrut padding = ComputePadding(*constraintSpace, *style_);
|
|
|
| EXPECT_EQ(LayoutUnit(52), padding.block_start);
|
| EXPECT_EQ(LayoutUnit(), padding.inline_end);
|
|
|