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

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

Issue 2365083002: Make NGFragment to own NGPhysicalFragment (Closed)
Patch Set: Created 4 years, 3 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 d1c93cbd268b649d2071ee1488b7772c7ce6325f..4e688f523d234065f6c27978e38e06818895c65f 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
@@ -23,7 +23,7 @@ class NGBlockLayoutAlgorithmTest : public ::testing::Test {
NGBox* first_child) {
NGBlockLayoutAlgorithm algorithm(style_, first_child);
NGPhysicalFragment* frag;
- while (!algorithm.Layout(space, &frag))
+ while (!algorithm.Layout(*space, &frag))
continue;
return frag;
}
@@ -38,7 +38,8 @@ TEST_F(NGBlockLayoutAlgorithmTest, FixedSize) {
auto* space =
new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
- NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, nullptr);
+ std::unique_ptr<NGPhysicalFragment> frag(
+ RunBlockLayoutAlgorithm(space, nullptr));
EXPECT_EQ(LayoutUnit(30), frag->Width());
EXPECT_EQ(LayoutUnit(40), frag->Height());
@@ -68,7 +69,8 @@ TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildren) {
auto* space =
new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
- NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, first_child);
+ std::unique_ptr<NGPhysicalFragment> frag(
+ RunBlockLayoutAlgorithm(space, first_child));
EXPECT_EQ(LayoutUnit(kWidth), frag->Width());
EXPECT_EQ(LayoutUnit(kHeight1 + kHeight2 + kMarginTop), frag->Height());
@@ -114,7 +116,8 @@ TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildrenWithWritingMode) {
auto* space =
new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
NGLogicalSize(LayoutUnit(500), LayoutUnit(500)));
- NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
+ std::unique_ptr<NGPhysicalFragment> frag(
+ RunBlockLayoutAlgorithm(space, div1));
const NGPhysicalFragmentBase* child = frag->Children()[0];
// DIV2
@@ -157,7 +160,8 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase1) {
auto* space =
new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
- NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
+ std::unique_ptr<NGPhysicalFragment> frag(
+ RunBlockLayoutAlgorithm(space, div1));
EXPECT_EQ(NGMarginStrut({LayoutUnit(kDiv1MarginTop)}), frag->MarginStrut());
ASSERT_EQ(frag->Children().size(), 1UL);
@@ -230,7 +234,8 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase2) {
auto* space =
new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
- NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
+ std::unique_ptr<NGPhysicalFragment> frag(
+ RunBlockLayoutAlgorithm(space, div1));
ASSERT_EQ(frag->Children().size(), 3UL);
@@ -279,7 +284,8 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase3) {
auto* space =
new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
- NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
+ std::unique_ptr<NGPhysicalFragment> frag(
+ RunBlockLayoutAlgorithm(space, div1));
// Verify that margins are collapsed.
EXPECT_EQ(NGMarginStrut({LayoutUnit(0), LayoutUnit(kDiv2MarginBottom)}),
@@ -287,7 +293,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase3) {
// Verify that margins are NOT collapsed.
div1_style->setHeight(Length(kHeight, Fixed));
- frag = RunBlockLayoutAlgorithm(space, div1);
+ frag.reset(RunBlockLayoutAlgorithm(space, div1));
EXPECT_EQ(NGMarginStrut({LayoutUnit(0), LayoutUnit(kDiv1MarginBottom)}),
frag->MarginStrut());
}
@@ -328,10 +334,10 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase4) {
auto* space =
new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
- NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
+ std::unique_ptr<NGPhysicalFragment> frag(
+ RunBlockLayoutAlgorithm(space, div1));
// Verify that margins do NOT collapse.
- frag = RunBlockLayoutAlgorithm(space, div1);
EXPECT_EQ(NGMarginStrut({LayoutUnit(kDiv1Margin), LayoutUnit(kDiv1Margin)}),
frag->MarginStrut());
ASSERT_EQ(frag->Children().size(), 1UL);
@@ -342,7 +348,7 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase4) {
// Reset padding and verify that margins DO collapse.
div1_style->setPaddingTop(Length(0, Fixed));
div1_style->setPaddingBottom(Length(0, Fixed));
- frag = RunBlockLayoutAlgorithm(space, div1);
+ frag.reset(RunBlockLayoutAlgorithm(space, div1));
EXPECT_EQ(NGMarginStrut({LayoutUnit(kDiv2Margin), LayoutUnit(kDiv2Margin)}),
frag->MarginStrut());
}
@@ -383,7 +389,8 @@ TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase5) {
auto* space =
new NGConstraintSpace(VerticalLeftRight, LeftToRight,
NGLogicalSize(LayoutUnit(500), LayoutUnit(500)));
- NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, vertical_div);
+ std::unique_ptr<NGPhysicalFragment> frag(
+ RunBlockLayoutAlgorithm(space, vertical_div));
ASSERT_EQ(frag->Children().size(), 2UL);
const NGPhysicalFragmentBase* child = frag->Children()[1];
@@ -443,7 +450,8 @@ TEST_F(NGBlockLayoutAlgorithmTest, BorderAndPadding) {
auto* space =
new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite));
- NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, div1);
+ std::unique_ptr<NGPhysicalFragment> frag(
+ RunBlockLayoutAlgorithm(space, div1));
ASSERT_EQ(frag->Children().size(), 1UL);
@@ -477,7 +485,8 @@ TEST_F(NGBlockLayoutAlgorithmTest, PercentageSize) {
auto* space =
new NGConstraintSpace(HorizontalTopBottom, LeftToRight,
NGLogicalSize(LayoutUnit(100), NGSizeIndefinite));
- NGPhysicalFragment* frag = RunBlockLayoutAlgorithm(space, first_child);
+ std::unique_ptr<NGPhysicalFragment> frag(
+ RunBlockLayoutAlgorithm(space, first_child));
EXPECT_EQ(frag->Width(), LayoutUnit(kWidth + kPaddingLeft));
EXPECT_EQ(frag->Type(), NGPhysicalFragmentBase::FragmentBox);

Powered by Google App Engine
This is Rietveld 408576698