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

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

Issue 2692403003: [LayoutNG] Make NGBlockLayoutAlgorithm accept a NGBlockNode. (Closed)
Patch Set: comments! Created 3 years, 10 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 b86114014de3c17defa5eb747de92de119325add..cb2775af001fa59aa33ad29c84dc161bf3a6efa2 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
@@ -60,13 +60,11 @@ class NGBlockLayoutAlgorithmTest
RefPtr<NGPhysicalBoxFragment> RunBlockLayoutAlgorithm(
NGConstraintSpace* space,
NGBlockNode* first_child) {
- NGBlockNode parent(style_.get());
- parent.SetFirstChild(first_child);
+ NGBlockNode* node = new NGBlockNode(style_.get());
+ node->SetFirstChild(first_child);
RefPtr<NGPhysicalFragment> fragment =
- NGBlockLayoutAlgorithm(/* layout_object */ nullptr, style_.get(),
- first_child, space)
- .Layout();
+ NGBlockLayoutAlgorithm(node, space).Layout();
return toNGPhysicalBoxFragment(fragment.get());
}
@@ -75,11 +73,13 @@ class NGBlockLayoutAlgorithmTest
RunBlockLayoutAlgorithmForElement(Element* element) {
LayoutNGBlockFlow* block_flow =
toLayoutNGBlockFlow(element->layoutObject());
+ NGBlockNode* node = new NGBlockNode(block_flow);
NGConstraintSpace* space =
NGConstraintSpace::CreateFromLayoutObject(*block_flow);
- RefPtr<NGPhysicalBoxFragment> fragment = RunBlockLayoutAlgorithm(
- space, new NGBlockNode(element->layoutObject()->slowFirstChild()));
- return std::make_pair(std::move(fragment), space);
+
+ RefPtr<NGPhysicalFragment> fragment =
+ NGBlockLayoutAlgorithm(node, space).Layout();
+ return std::make_pair(toNGPhysicalBoxFragment(fragment.get()), space);
}
MinAndMaxContentSizes RunComputeMinAndMax(NGBlockNode* first_child) {
@@ -88,8 +88,10 @@ class NGBlockLayoutAlgorithmTest
NGConstraintSpace* space =
ConstructConstraintSpace(kHorizontalTopBottom, TextDirection::kLtr,
NGLogicalSize(LayoutUnit(), LayoutUnit()));
- NGBlockLayoutAlgorithm algorithm(/* layout_object */ nullptr, style_.get(),
- first_child, space);
+ NGBlockNode* node = new NGBlockNode(style_.get());
+ node->SetFirstChild(first_child);
+
+ NGBlockLayoutAlgorithm algorithm(node, space);
EXPECT_TRUE(algorithm.ComputeMinAndMaxContentSizes().has_value());
return *algorithm.ComputeMinAndMaxContentSizes();
}

Powered by Google App Engine
This is Rietveld 408576698