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

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

Issue 2702403003: [layoutng] Split NGLayoutResult out of NGPhysicalFragment (Closed)
Patch Set: rebased 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_fragment_builder.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
index 4b69057e9fb0cf9ec05337956a2b3db88b275d69..eb08d9a65501c8185d3f5c9296699e63b7547681 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_fragment_builder.cc
@@ -52,7 +52,7 @@ NGFragmentBuilder& NGFragmentBuilder::SetBlockOverflow(LayoutUnit size) {
}
NGFragmentBuilder& NGFragmentBuilder::AddChild(
- RefPtr<NGPhysicalFragment> child,
+ RefPtr<NGLayoutResult> child,
const NGLogicalOffset& child_offset) {
DCHECK_EQ(type_, NGPhysicalFragment::kFragmentBox)
<< "Only box fragments can have children";
@@ -67,6 +67,15 @@ NGFragmentBuilder& NGFragmentBuilder::AddChild(
OutOfFlowPlacement{child_offset, oof_position});
}
+ return AddChild(child->PhysicalFragment(), child_offset);
+}
+
+NGFragmentBuilder& NGFragmentBuilder::AddChild(
+ RefPtr<NGPhysicalFragment> child,
+ const NGLogicalOffset& child_offset) {
+ DCHECK_EQ(type_, NGPhysicalFragment::kFragmentBox)
+ << "Only box fragments can have children";
+
children_.push_back(std::move(child));
offsets_.push_back(child_offset);
@@ -143,7 +152,7 @@ NGFragmentBuilder& NGFragmentBuilder::AddOutOfFlowDescendant(
return *this;
}
-RefPtr<NGPhysicalBoxFragment> NGFragmentBuilder::ToBoxFragment() {
+RefPtr<NGLayoutResult> NGFragmentBuilder::ToBoxFragment() {
// TODO(layout-ng): Support text fragments
DCHECK_EQ(type_, NGPhysicalFragment::kFragmentBox);
DCHECK_EQ(offsets_.size(), children_.size());
@@ -170,11 +179,14 @@ RefPtr<NGPhysicalBoxFragment> NGFragmentBuilder::ToBoxFragment() {
positioned_floats.push_back(floating_object);
}
- return adoptRef(new NGPhysicalBoxFragment(
+ RefPtr<NGPhysicalBoxFragment> fragment = adoptRef(new NGPhysicalBoxFragment(
node_->GetLayoutObject(), physical_size,
- overflow_.ConvertToPhysical(writing_mode_), children_,
- out_of_flow_descendants_, out_of_flow_positions_, unpositioned_floats_,
- positioned_floats_, bfc_offset_, end_margin_strut_, break_token));
+ overflow_.ConvertToPhysical(writing_mode_), children_, positioned_floats_,
+ bfc_offset_, end_margin_strut_, break_token));
+
+ return adoptRef(
+ new NGLayoutResult(std::move(fragment), out_of_flow_descendants_,
+ out_of_flow_positions_, unpositioned_floats_));
}
RefPtr<NGPhysicalTextFragment> NGFragmentBuilder::ToTextFragment(
@@ -191,9 +203,7 @@ RefPtr<NGPhysicalTextFragment> NGFragmentBuilder::ToTextFragment(
return adoptRef(new NGPhysicalTextFragment(
node_->GetLayoutObject(), toNGInlineNode(node_), index, start_offset,
end_offset, size_.ConvertToPhysical(writing_mode_),
- overflow_.ConvertToPhysical(writing_mode_), out_of_flow_descendants_,
- out_of_flow_positions_, empty_unpositioned_floats,
- empty_positioned_floats));
+ overflow_.ConvertToPhysical(writing_mode_)));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698