Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc

Issue 2885053003: [LayoutNG] Replace use of NGPhysicalFragment top/left/width/height (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 35d627bdd1d836a8a62f62d3ffa184ecabbaa952..21369a2240d96e517c3d32c315ca201920962a7d 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
@@ -123,8 +123,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, FixedSize) {
RefPtr<NGPhysicalFragment> frag = RunBlockLayoutAlgorithm(space.Get(), box);
- EXPECT_EQ(LayoutUnit(30), frag->Width());
- EXPECT_EQ(LayoutUnit(40), frag->Height());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(30), LayoutUnit(40)), frag->Size());
}
// Verifies that two children are laid out with the correct size and position.
@@ -150,18 +149,18 @@ TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildren) {
RefPtr<NGPhysicalBoxFragment> frag =
RunBlockLayoutAlgorithm(space.Get(), container);
- EXPECT_EQ(LayoutUnit(kWidth), frag->Width());
- EXPECT_EQ(LayoutUnit(kHeight1 + kHeight2 + kMarginTop), frag->Height());
+ EXPECT_EQ(LayoutUnit(kWidth), frag->Size().width);
+ EXPECT_EQ(LayoutUnit(kHeight1 + kHeight2 + kMarginTop), frag->Size().height);
EXPECT_EQ(NGPhysicalFragment::kFragmentBox, frag->Type());
ASSERT_EQ(frag->Children().size(), 2UL);
const NGPhysicalFragment* first_child_fragment = frag->Children()[0].Get();
- EXPECT_EQ(kHeight1, first_child_fragment->Height());
- EXPECT_EQ(0, first_child_fragment->TopOffset());
+ EXPECT_EQ(kHeight1, first_child_fragment->Size().height);
+ EXPECT_EQ(0, first_child_fragment->Offset().top);
const NGPhysicalFragment* second_child_fragment = frag->Children()[1].Get();
- EXPECT_EQ(kHeight2, second_child_fragment->Height());
- EXPECT_EQ(kHeight1 + kMarginTop, second_child_fragment->TopOffset());
+ EXPECT_EQ(kHeight2, second_child_fragment->Size().height);
+ EXPECT_EQ(kHeight1 + kMarginTop, second_child_fragment->Offset().top);
}
// Verifies that a child is laid out correctly if it's writing mode is different
@@ -197,9 +196,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildrenWithWritingMode) {
// DIV2
child = static_cast<const NGPhysicalBoxFragment*>(child)->Children()[0].Get();
- EXPECT_EQ(kHeight, child->Height());
- EXPECT_EQ(0, child->TopOffset());
- EXPECT_EQ(kMarginLeft, child->LeftOffset());
+ EXPECT_EQ(kHeight, child->Size().height);
+ EXPECT_EQ(0, child->Offset().top);
+ EXPECT_EQ(kMarginLeft, child->Offset().left);
}
// Verifies that floats are positioned at the top of the first child that can
@@ -250,20 +249,20 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase1WithFloats) {
auto* body_fragment = ToNGPhysicalBoxFragment(fragment->Children()[0].Get());
// 20 = max(first child's margin top, containers's margin top)
int body_top_offset = 20;
- EXPECT_THAT(LayoutUnit(body_top_offset), body_fragment->TopOffset());
+ EXPECT_THAT(LayoutUnit(body_top_offset), body_fragment->Offset().top);
// 8 = body's margin
int body_left_offset = 8;
- EXPECT_THAT(LayoutUnit(body_left_offset), body_fragment->LeftOffset());
+ EXPECT_THAT(LayoutUnit(body_left_offset), body_fragment->Offset().left);
ASSERT_EQ(1UL, body_fragment->Children().size());
auto* container_fragment =
ToNGPhysicalBoxFragment(body_fragment->Children()[0].Get());
// 0 = collapsed with body's margin
- EXPECT_THAT(LayoutUnit(0), container_fragment->TopOffset());
+ EXPECT_THAT(LayoutUnit(0), container_fragment->Offset().top);
ASSERT_EQ(1UL, container_fragment->Children().size());
auto* first_child_fragment =
ToNGPhysicalBoxFragment(container_fragment->Children()[0].Get());
// 0 = collapsed with container's margin
- EXPECT_THAT(LayoutUnit(0), first_child_fragment->TopOffset());
+ EXPECT_THAT(LayoutUnit(0), first_child_fragment->Offset().top);
}
// Verifies the collapsing margins case for the next pairs:
@@ -326,20 +325,20 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase2WithFloats) {
auto* body_fragment = ToNGPhysicalBoxFragment(fragment->Children()[0].Get());
// -7 = empty1's margin(-15) + body's margin(8)
int body_top_offset = -7;
- EXPECT_THAT(LayoutUnit(body_top_offset), body_fragment->TopOffset());
- EXPECT_THAT(LayoutUnit(body_top_offset), body_fragment->TopOffset());
+ EXPECT_THAT(LayoutUnit(body_top_offset), body_fragment->Offset().top);
+ EXPECT_THAT(LayoutUnit(body_top_offset), body_fragment->Offset().top);
ASSERT_EQ(3UL, body_fragment->Children().size());
auto* first_child_fragment =
ToNGPhysicalBoxFragment(body_fragment->Children()[0].Get());
- EXPECT_THAT(LayoutUnit(), first_child_fragment->TopOffset());
+ EXPECT_THAT(LayoutUnit(), first_child_fragment->Offset().top);
auto* second_child_fragment =
ToNGPhysicalBoxFragment(body_fragment->Children()[1].Get());
// 40 = first_child's height(50) - margin's collapsing result(10)
int second_child_block_offset = 40;
EXPECT_THAT(LayoutUnit(second_child_block_offset),
- second_child_fragment->TopOffset());
+ second_child_fragment->Offset().top);
auto* empty5_fragment =
ToNGPhysicalBoxFragment(body_fragment->Children()[2].Get());
@@ -347,15 +346,15 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase2WithFloats) {
// second child's height(50)
int empty5_fragment_block_offset = 90;
EXPECT_THAT(LayoutUnit(empty5_fragment_block_offset),
- empty5_fragment->TopOffset());
+ empty5_fragment->Offset().top);
ASSERT_EQ(1UL, body_fragment->PositionedFloats().size());
ASSERT_EQ(1UL, body_fragment->PositionedFloats().size());
auto float_nonempties_fragment =
body_fragment->PositionedFloats().at(0).fragment;
// 70 = first_child's height(50) + first child's margin-bottom(20)
- EXPECT_THAT(float_nonempties_fragment->TopOffset(), LayoutUnit(70));
- EXPECT_THAT(float_nonempties_fragment->LeftOffset(), LayoutUnit(0));
+ EXPECT_THAT(float_nonempties_fragment->Offset().top, LayoutUnit(70));
+ EXPECT_THAT(float_nonempties_fragment->Offset().left, LayoutUnit(0));
// ** Verify layout tree **
Element* first_child = GetDocument().getElementById("first-child");
@@ -460,9 +459,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase4) {
// container's margin 30
EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(500)), fragment->Size());
// 30 = max(body's margin 8, container margin 30)
- EXPECT_EQ(LayoutUnit(30), body_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(30), body_fragment->Offset().top);
// 220 = container's padding top 20 + child's margin
- EXPECT_EQ(LayoutUnit(220), child_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(220), child_fragment->Offset().top);
// without padding
run_test(Length(0, kFixed));
@@ -470,9 +469,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase4) {
// child's height 50
EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(450)), fragment->Size());
// 200 = (body's margin 8, container's margin 30, child's margin 200)
- EXPECT_EQ(LayoutUnit(200), body_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(200), body_fragment->Offset().top);
// 0 = collapsed margins
- EXPECT_EQ(LayoutUnit(0), child_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(0), child_fragment->Offset().top);
}
// Verifies that margins of 2 adjoining blocks with different writing modes
@@ -511,9 +510,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase5) {
auto* body_fragment = ToNGPhysicalBoxFragment(fragment->Children()[0].Get());
// 10 = std::max(body's margin 8, container's margin top)
int body_top_offset = 10;
- EXPECT_THAT(body_fragment->TopOffset(), LayoutUnit(body_top_offset));
+ EXPECT_THAT(body_fragment->Offset().top, LayoutUnit(body_top_offset));
int body_left_offset = 8;
- EXPECT_THAT(body_fragment->LeftOffset(), LayoutUnit(body_left_offset));
+ EXPECT_THAT(body_fragment->Offset().left, LayoutUnit(body_left_offset));
// height = 70. std::max(vertical height's 70, horizontal's height's 60)
// TODO(glebl): Should be 70! Fix this once min/max algorithm handles
// orthogonal children.
@@ -527,23 +526,23 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase5) {
auto* container_fragment =
ToNGPhysicalBoxFragment(body_fragment->Children()[0].Get());
// Container's margins are collapsed with body's fragment.
- EXPECT_THAT(container_fragment->TopOffset(), LayoutUnit());
- EXPECT_THAT(container_fragment->LeftOffset(), LayoutUnit());
+ EXPECT_THAT(container_fragment->Offset().top, LayoutUnit());
+ EXPECT_THAT(container_fragment->Offset().left, LayoutUnit());
ASSERT_EQ(2UL, container_fragment->Children().size());
// vertical
auto* vertical_fragment =
ToNGPhysicalBoxFragment(container_fragment->Children()[0].Get());
- EXPECT_THAT(vertical_fragment->TopOffset(), LayoutUnit());
- EXPECT_THAT(vertical_fragment->LeftOffset(), LayoutUnit());
+ EXPECT_THAT(vertical_fragment->Offset().top, LayoutUnit());
+ EXPECT_THAT(vertical_fragment->Offset().left, LayoutUnit());
// horizontal
auto* horizontal_fragment =
ToNGPhysicalBoxFragment(container_fragment->Children()[1].Get());
- EXPECT_THAT(horizontal_fragment->TopOffset(), LayoutUnit());
+ EXPECT_THAT(horizontal_fragment->Offset().top, LayoutUnit());
// 130 = vertical's width 30 +
// std::max(vertical's margin right 90, horizontal's margin-left 100)
- EXPECT_THAT(horizontal_fragment->LeftOffset(), LayoutUnit(130));
+ EXPECT_THAT(horizontal_fragment->Offset().left, LayoutUnit(130));
}
// Verifies that margins collapsing logic works with Layout Inline.
@@ -615,11 +614,12 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase6) {
ASSERT_EQ(frag->Children().size(), 2UL);
const NGPhysicalFragment* child1 = frag->Children()[0].Get();
- EXPECT_EQ(0, child1->TopOffset());
- EXPECT_EQ(kHeight, child1->Height());
+ EXPECT_EQ(0, child1->Offset().top);
+ EXPECT_EQ(kHeight, child1->Size().height);
const NGPhysicalFragment* child2 = frag->Children()[1].Get();
- EXPECT_EQ(kHeight + std::max(kMarginBottom, kMarginTop), child2->TopOffset());
+ EXPECT_EQ(kHeight + std::max(kMarginBottom, kMarginTop),
+ child2->Offset().top);
}
// Verifies that a child with clearance - which does nothing - still shifts its
@@ -722,9 +722,9 @@ TEST_F(NGBlockLayoutAlgorithmTest, BorderAndPadding) {
// div1
const NGPhysicalFragment* child = frag->Children()[0].Get();
EXPECT_EQ(kBorderLeft + kPaddingLeft + kWidth + kPaddingRight + kBorderRight,
- child->Width());
+ child->Size().width);
EXPECT_EQ(kBorderTop + kPaddingTop + kHeight + kPaddingBottom + kBorderBottom,
- child->Height());
+ child->Size().height);
ASSERT_TRUE(child->IsBox());
ASSERT_EQ(static_cast<const NGPhysicalBoxFragment*>(child)->Children().size(),
@@ -732,8 +732,8 @@ TEST_F(NGBlockLayoutAlgorithmTest, BorderAndPadding) {
// div2
child = static_cast<const NGPhysicalBoxFragment*>(child)->Children()[0].Get();
- EXPECT_EQ(kBorderTop + kPaddingTop, child->TopOffset());
- EXPECT_EQ(kBorderLeft + kPaddingLeft, child->LeftOffset());
+ EXPECT_EQ(kBorderTop + kPaddingTop, child->Offset().top);
+ EXPECT_EQ(kBorderLeft + kPaddingLeft, child->Offset().left);
}
TEST_F(NGBlockLayoutAlgorithmTest, PercentageResolutionSize) {
@@ -753,12 +753,12 @@ TEST_F(NGBlockLayoutAlgorithmTest, PercentageResolutionSize) {
RefPtr<NGPhysicalBoxFragment> frag =
RunBlockLayoutAlgorithm(space.Get(), container);
- EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->Width());
+ EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->Size().width);
EXPECT_EQ(NGPhysicalFragment::kFragmentBox, frag->Type());
ASSERT_EQ(frag->Children().size(), 1UL);
const NGPhysicalFragment* child = frag->Children()[0].Get();
- EXPECT_EQ(LayoutUnit(12), child->Width());
+ EXPECT_EQ(LayoutUnit(12), child->Size().width);
}
// A very simple auto margin case. We rely on the tests in ng_length_utils_test
@@ -785,15 +785,15 @@ TEST_F(NGBlockLayoutAlgorithmTest, AutoMargin) {
RefPtr<NGPhysicalBoxFragment> frag =
RunBlockLayoutAlgorithm(space.Get(), container);
- EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->Width());
+ EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->Size().width);
EXPECT_EQ(NGPhysicalFragment::kFragmentBox, frag->Type());
EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->OverflowSize().width);
ASSERT_EQ(1UL, frag->Children().size());
const NGPhysicalFragment* child = frag->Children()[0].Get();
- EXPECT_EQ(LayoutUnit(kChildWidth), child->Width());
- EXPECT_EQ(LayoutUnit(kPaddingLeft + 10), child->LeftOffset());
- EXPECT_EQ(LayoutUnit(0), child->TopOffset());
+ EXPECT_EQ(LayoutUnit(kChildWidth), child->Size().width);
+ EXPECT_EQ(LayoutUnit(kPaddingLeft + 10), child->Offset().left);
+ EXPECT_EQ(LayoutUnit(0), child->Offset().top);
}
// Verifies that floats can be correctly positioned if they are inside of nested
@@ -849,7 +849,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatInsideEmptyBlocks) {
auto* body_fragment = ToNGPhysicalBoxFragment(fragment->Children()[0].Get());
// 20 = std::max(empty1's margin, empty2's margin, body's margin)
int body_top_offset = 20;
- EXPECT_THAT(body_fragment->TopOffset(), LayoutUnit(body_top_offset));
+ EXPECT_THAT(body_fragment->Offset().top, LayoutUnit(body_top_offset));
ASSERT_EQ(1UL, body_fragment->Children().size());
auto* container_fragment =
ToNGPhysicalBoxFragment(body_fragment->Children()[0].Get());
@@ -858,19 +858,19 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatInsideEmptyBlocks) {
auto* empty1_fragment =
ToNGPhysicalBoxFragment(container_fragment->Children()[0].Get());
// 0, vertical margins got collapsed
- EXPECT_THAT(empty1_fragment->TopOffset(), LayoutUnit());
+ EXPECT_THAT(empty1_fragment->Offset().top, LayoutUnit());
// 20 empty1's margin
int empty1_inline_offset = 20;
- EXPECT_THAT(empty1_fragment->LeftOffset(), LayoutUnit(empty1_inline_offset));
+ EXPECT_THAT(empty1_fragment->Offset().left, LayoutUnit(empty1_inline_offset));
ASSERT_EQ(empty1_fragment->Children().size(), 1UL);
auto* empty2_fragment =
ToNGPhysicalBoxFragment(empty1_fragment->Children()[0].Get());
// 0, vertical margins got collapsed
- EXPECT_THAT(LayoutUnit(), empty2_fragment->TopOffset());
+ EXPECT_THAT(LayoutUnit(), empty2_fragment->Offset().top);
// 35 = empty1's padding(20) + empty2's padding(15)
int empty2_inline_offset = 35;
- EXPECT_THAT(empty2_fragment->LeftOffset(), LayoutUnit(empty2_inline_offset));
+ EXPECT_THAT(empty2_fragment->Offset().left, LayoutUnit(empty2_inline_offset));
ASSERT_EQ(2UL, container_fragment->PositionedFloats().size());
RefPtr<NGPhysicalFragment> left_float_fragment =
@@ -982,7 +982,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatFragments) {
// ** Verify LayoutNG fragments and the list of positioned floats **
ASSERT_EQ(1UL, fragment->Children().size());
auto* body_fragment = ToNGPhysicalBoxFragment(fragment->Children()[0].Get());
- EXPECT_THAT(LayoutUnit(8), body_fragment->TopOffset());
+ EXPECT_THAT(LayoutUnit(8), body_fragment->Offset().top);
auto* container_fragment =
ToNGPhysicalBoxFragment(body_fragment->Children()[0].Get());
ASSERT_EQ(1UL, container_fragment->Children().size());
@@ -998,7 +998,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatFragments) {
EXPECT_EQ(left_float_block_offset, left_float->OffsetTop());
auto left_float_fragment =
regular_fragment->PositionedFloats().at(0).fragment;
- EXPECT_THAT(LayoutUnit(), left_float_fragment->TopOffset());
+ EXPECT_THAT(LayoutUnit(), left_float_fragment->Offset().top);
Element* left_wide_float = GetDocument().getElementById("left-wide-float");
// left-wide-float is positioned right below left-float as it's too wide.
@@ -1009,7 +1009,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatFragments) {
auto left_wide_float_fragment =
regular_fragment->PositionedFloats().at(1).fragment;
// 30 = left-float's height.
- EXPECT_THAT(LayoutUnit(30), left_wide_float_fragment->TopOffset());
+ EXPECT_THAT(LayoutUnit(30), left_wide_float_fragment->Offset().top);
Element* regular = GetDocument().getElementById("regular");
// regular_block_offset = body's margin-top 8
@@ -1017,7 +1017,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatFragments) {
EXPECT_EQ(regular_block_offset, regular->OffsetTop());
auto* regular_block_fragment =
ToNGPhysicalBoxFragment(container_fragment->Children()[0].Get());
- EXPECT_THAT(LayoutUnit(), regular_block_fragment->TopOffset());
+ EXPECT_THAT(LayoutUnit(), regular_block_fragment->Offset().top);
Element* right_float = GetDocument().getElementById("right-float");
// 158 = body's margin-left 8 + container's width 200 - right_float's width 50
@@ -1031,10 +1031,10 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatFragments) {
container_fragment->PositionedFloats().at(0).fragment;
// 60 = right_float_block_offset(68) - body's margin(8)
EXPECT_THAT(LayoutUnit(right_float_block_offset - 8),
- right_float_fragment->TopOffset());
+ right_float_fragment->Offset().top);
// 150 = right_float_inline_offset(158) - body's margin(8)
EXPECT_THAT(LayoutUnit(right_float_inline_offset - 8),
- right_float_fragment->LeftOffset());
+ right_float_fragment->Offset().left);
Element* left_float_with_margin =
GetDocument().getElementById("left-float-with-margin");
@@ -1051,10 +1051,10 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatFragments) {
container_fragment->PositionedFloats().at(1).fragment;
// 70 = left_float_with_margin_block_offset(78) - body's margin(8)
EXPECT_THAT(LayoutUnit(left_float_with_margin_block_offset - 8),
- left_float_with_margin_fragment->TopOffset());
+ left_float_with_margin_fragment->Offset().top);
// 10 = left_float_with_margin_inline_offset(18) - body's margin(8)
EXPECT_THAT(LayoutUnit(left_float_with_margin_inline_offset - 8),
- left_float_with_margin_fragment->LeftOffset());
+ left_float_with_margin_fragment->Offset().left);
}
// Verifies that NG block layout algorithm respects "clear" CSS property.
@@ -1133,55 +1133,55 @@ TEST_F(NGBlockLayoutAlgorithmTest, PositionFragmentsWithClear) {
// clear: none
run_with_clearance(EClear::kNone);
// 20 = std::max(body's margin 8, clearance's margins 20)
- EXPECT_EQ(LayoutUnit(20), body_fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(0), container_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(20), body_fragment->Offset().top);
+ EXPECT_EQ(LayoutUnit(0), container_fragment->Offset().top);
// 0 = collapsed margins
- EXPECT_EQ(LayoutUnit(0), clerance_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(0), clerance_fragment->Offset().top);
// 100 = clearance's height 60 +
// std::max(clearance's margins 20, block's margins 40)
- EXPECT_EQ(LayoutUnit(100), block_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(100), block_fragment->Offset().top);
// 200 = 100 + block's height 60 + max(adjoining_clearance's margins 30,
// block's margins 40)
- EXPECT_EQ(LayoutUnit(200), adjoining_clearance_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(200), adjoining_clearance_fragment->Offset().top);
// clear: right
run_with_clearance(EClear::kRight);
// 8 = body's margin. This doesn't collapse its margins with 'clearance' block
// as it's not an adjoining block to body.
- EXPECT_EQ(LayoutUnit(8), body_fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(0), container_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(8), body_fragment->Offset().top);
+ EXPECT_EQ(LayoutUnit(0), container_fragment->Offset().top);
// 170 = float-right's height
- EXPECT_EQ(LayoutUnit(170), clerance_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(170), clerance_fragment->Offset().top);
// 270 = float-right's height + clearance's height 60 +
// max(clearance's margin 20, block margin 40)
- EXPECT_EQ(LayoutUnit(270), block_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(270), block_fragment->Offset().top);
// 370 = block's offset 270 + block's height 60 +
// std::max(block's margin 40, adjoining_clearance's margin 30)
- EXPECT_EQ(LayoutUnit(370), adjoining_clearance_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(370), adjoining_clearance_fragment->Offset().top);
// clear: left
run_with_clearance(EClear::kLeft);
// 8 = body's margin. This doesn't collapse its margins with 'clearance' block
// as it's not an adjoining block to body.
- EXPECT_EQ(LayoutUnit(8), body_fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(0), container_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(8), body_fragment->Offset().top);
+ EXPECT_EQ(LayoutUnit(0), container_fragment->Offset().top);
// 30 = float_left's height
- EXPECT_EQ(LayoutUnit(30), clerance_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(30), clerance_fragment->Offset().top);
// 130 = float_left's height + clearance's height 60 +
// max(clearance's margin 20, block margin 40)
- EXPECT_EQ(LayoutUnit(130), block_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(130), block_fragment->Offset().top);
// 230 = block's offset 130 + block's height 60 +
// std::max(block's margin 40, adjoining_clearance's margin 30)
- EXPECT_EQ(LayoutUnit(230), adjoining_clearance_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(230), adjoining_clearance_fragment->Offset().top);
// clear: both
// same as clear: right
run_with_clearance(EClear::kBoth);
- EXPECT_EQ(LayoutUnit(8), body_fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(0), container_fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(170), clerance_fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(270), block_fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(370), adjoining_clearance_fragment->TopOffset());
+ EXPECT_EQ(LayoutUnit(8), body_fragment->Offset().top);
+ EXPECT_EQ(LayoutUnit(0), container_fragment->Offset().top);
+ EXPECT_EQ(LayoutUnit(170), clerance_fragment->Offset().top);
+ EXPECT_EQ(LayoutUnit(270), block_fragment->Offset().top);
+ EXPECT_EQ(LayoutUnit(370), adjoining_clearance_fragment->Offset().top);
}
// Verifies that we compute the right min and max-content size.
@@ -1220,7 +1220,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, ShrinkToFit) {
RefPtr<NGPhysicalFragment> frag =
RunBlockLayoutAlgorithm(space.Get(), container);
- EXPECT_EQ(LayoutUnit(kWidthChild2), frag->Width());
+ EXPECT_EQ(LayoutUnit(kWidthChild2), frag->Size().width);
}
// TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
@@ -1251,8 +1251,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_EmptyMulticol) {
FragmentChildIterator iterator(parent_fragment.Get());
const auto* fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(210), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(210), LayoutUnit(100)), fragment->Size());
EXPECT_FALSE(iterator.NextChild());
// There should be nothing inside the multicol container.
@@ -1285,8 +1284,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_EmptyBlock) {
RunBlockLayoutAlgorithm(space.Get(), container);
FragmentChildIterator iterator(parent_fragment.Get());
const auto* fragment = iterator.NextChild();
- EXPECT_EQ(LayoutUnit(210), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(210), LayoutUnit(100)), fragment->Size());
ASSERT_TRUE(fragment);
EXPECT_FALSE(iterator.NextChild());
iterator.SetParent(fragment);
@@ -1294,10 +1292,8 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_EmptyBlock) {
// #child fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(100), fragment->Width());
- EXPECT_EQ(LayoutUnit(), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(100), LayoutUnit()), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
EXPECT_FALSE(iterator.NextChild());
}
@@ -1333,18 +1329,15 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_BlockInOneColumn) {
FragmentChildIterator iterator(parent_fragment.Get());
const auto* fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(310), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(310), LayoutUnit(100)), fragment->Size());
EXPECT_FALSE(iterator.NextChild());
iterator.SetParent(fragment);
// #child fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(90), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(90), LayoutUnit(100)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
EXPECT_FALSE(iterator.NextChild());
}
@@ -1379,27 +1372,23 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_BlockInTwoColumns) {
FragmentChildIterator iterator(parent_fragment.Get());
const auto* fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(210), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(210), LayoutUnit(100)), fragment->Size());
EXPECT_FALSE(iterator.NextChild());
iterator.SetParent(fragment);
// #child fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(75), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(75), LayoutUnit(100)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
// #child fragment in second column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(110), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(75), fragment->Width());
- EXPECT_EQ(LayoutUnit(50), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(110), LayoutUnit()),
+ fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(75), LayoutUnit(50)), fragment->Size());
EXPECT_EQ(0U, fragment->Children().size());
EXPECT_FALSE(iterator.NextChild());
}
@@ -1435,36 +1424,31 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_BlockInThreeColumns) {
FragmentChildIterator iterator(parent_fragment.Get());
const auto* fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(320), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size());
EXPECT_FALSE(iterator.NextChild());
iterator.SetParent(fragment);
// #child fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(75), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(75), LayoutUnit(100)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
// #child fragment in second column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(110), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(75), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(110), LayoutUnit()),
+ fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(75), LayoutUnit(100)), fragment->Size());
EXPECT_EQ(0U, fragment->Children().size());
// #child fragment in third column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(220), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(75), fragment->Width());
- EXPECT_EQ(LayoutUnit(50), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(220), LayoutUnit()),
+ fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(75), LayoutUnit(50)), fragment->Size());
EXPECT_EQ(0U, fragment->Children().size());
EXPECT_FALSE(iterator.NextChild());
}
@@ -1501,36 +1485,31 @@ TEST_F(NGBlockLayoutAlgorithmTest,
FragmentChildIterator iterator(parent_fragment.Get());
const auto* fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(210), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(210), LayoutUnit(100)), fragment->Size());
EXPECT_FALSE(iterator.NextChild());
iterator.SetParent(fragment);
// #child fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(1), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(1), LayoutUnit(100)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
// #child fragment in second column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(110), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(1), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(110), LayoutUnit()),
+ fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(1), LayoutUnit(100)), fragment->Size());
EXPECT_EQ(0U, fragment->Children().size());
// #child fragment in third column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(220), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(1), fragment->Width());
- EXPECT_EQ(LayoutUnit(50), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(220), LayoutUnit()),
+ fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(1), LayoutUnit(50)), fragment->Size());
EXPECT_EQ(0U, fragment->Children().size());
EXPECT_FALSE(iterator.NextChild());
}
@@ -1568,35 +1547,29 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_TwoBlocksInTwoColumns) {
FragmentChildIterator iterator(parent_fragment.Get());
const auto* fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(320), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size());
EXPECT_FALSE(iterator.NextChild());
iterator.SetParent(fragment);
// #child1 fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(75), fragment->Width());
- EXPECT_EQ(LayoutUnit(60), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(75), LayoutUnit(60)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
// #child2 fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(60), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(85), fragment->Width());
- EXPECT_EQ(LayoutUnit(40), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit(60)), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(85), LayoutUnit(40)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
// #child2 fragment in second column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(110), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(85), fragment->Width());
- EXPECT_EQ(LayoutUnit(20), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(110), LayoutUnit()),
+ fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(85), LayoutUnit(20)), fragment->Size());
EXPECT_EQ(0U, fragment->Children().size());
EXPECT_FALSE(iterator.NextChild());
}
@@ -1638,58 +1611,46 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_OverflowedBlock) {
FragmentChildIterator iterator(parent_fragment.Get());
const auto* fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(320), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size());
EXPECT_FALSE(iterator.NextChild());
iterator.SetParent(fragment);
// #child1 fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(75), fragment->Width());
- EXPECT_EQ(LayoutUnit(60), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(75), LayoutUnit(60)), fragment->Size());
FragmentChildIterator grandchild_iterator(fragment);
// #grandchild1 fragment in first column
fragment = grandchild_iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(50), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(50), LayoutUnit(100)), fragment->Size());
EXPECT_FALSE(grandchild_iterator.NextChild());
// #child2 fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(60), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(85), fragment->Width());
- EXPECT_EQ(LayoutUnit(10), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit(60)), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(85), LayoutUnit(10)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
// #child1 fragment in second column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(110), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(75), fragment->Width());
- EXPECT_EQ(LayoutUnit(), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(110), LayoutUnit()),
+ fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(75), LayoutUnit()), fragment->Size());
grandchild_iterator.SetParent(fragment);
// #grandchild1 fragment in second column
fragment = grandchild_iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(50), fragment->Width());
- EXPECT_EQ(LayoutUnit(20), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(50), LayoutUnit(20)), fragment->Size());
// #grandchild2 fragment in second column
fragment = grandchild_iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(20), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(40), fragment->Width());
- EXPECT_EQ(LayoutUnit(20), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit(20)), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(40), LayoutUnit(20)), fragment->Size());
EXPECT_FALSE(grandchild_iterator.NextChild());
EXPECT_FALSE(iterator.NextChild());
}
@@ -1725,18 +1686,15 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_FloatInOneColumn) {
FragmentChildIterator iterator(parent_fragment.Get());
const auto* fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(320), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size());
EXPECT_FALSE(iterator.NextChild());
iterator.SetParent(fragment);
// #child fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(75), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(75), LayoutUnit(100)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
EXPECT_FALSE(iterator.NextChild());
}
@@ -1774,26 +1732,21 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_TwoFloatsInOneColumn) {
FragmentChildIterator iterator(parent_fragment.Get());
const auto* fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(320), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size());
EXPECT_FALSE(iterator.NextChild());
iterator.SetParent(fragment);
// #child1 fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(15), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(15), LayoutUnit(100)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
// #child2 fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(84), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(16), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(84), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(16), LayoutUnit(100)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
EXPECT_FALSE(iterator.NextChild());
}
@@ -1831,43 +1784,36 @@ TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_TwoFloatsInTwoColumns) {
FragmentChildIterator iterator(parent_fragment.Get());
const auto* fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(320), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size());
EXPECT_FALSE(iterator.NextChild());
iterator.SetParent(fragment);
// #child1 fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(15), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(15), LayoutUnit(100)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
// #child2 fragment in first column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(84), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(16), fragment->Width());
- EXPECT_EQ(LayoutUnit(100), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(84), LayoutUnit()), fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(16), LayoutUnit(100)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
// #child1 fragment in second column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(110), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(15), fragment->Width());
- EXPECT_EQ(LayoutUnit(50), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(110), LayoutUnit()),
+ fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(15), LayoutUnit(50)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
// #child2 fragment in second column
fragment = iterator.NextChild();
ASSERT_TRUE(fragment);
- EXPECT_EQ(LayoutUnit(194), fragment->LeftOffset());
- EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
- EXPECT_EQ(LayoutUnit(16), fragment->Width());
- EXPECT_EQ(LayoutUnit(50), fragment->Height());
+ EXPECT_EQ(NGPhysicalOffset(LayoutUnit(194), LayoutUnit()),
+ fragment->Offset());
+ EXPECT_EQ(NGPhysicalSize(LayoutUnit(16), LayoutUnit(50)), fragment->Size());
EXPECT_EQ(0UL, fragment->Children().size());
EXPECT_FALSE(iterator.NextChild());
}

Powered by Google App Engine
This is Rietveld 408576698