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

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

Issue 2702403003: [layoutng] Split NGLayoutResult out of NGPhysicalFragment (Closed)
Patch Set: 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 dfbad215933f77e5736b1095a01879700ee78459..8ae5abf6c17c313e979550f7c24632c6f5f60310 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,7 +67,16 @@ NGFragmentBuilder& NGFragmentBuilder::AddChild(
OutOfFlowPlacement{child_offset, oof_position});
}
- children_.push_back(std::move(child));
+ 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(child);
ikilpatrick 2017/02/21 22:26:02 std::move()?
cbiesinger 2017/02/22 18:09:00 Also fixed already
offsets_.push_back(child_offset);
return *this;
@@ -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(
layout_object_, physical_size, overflow_.ConvertToPhysical(writing_mode_),
- children_, out_of_flow_descendants_, out_of_flow_positions_,
- unpositioned_floats_, positioned_floats_, bfc_offset_, end_margin_strut_,
+ 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(
@@ -192,9 +204,7 @@ RefPtr<NGPhysicalTextFragment> NGFragmentBuilder::ToTextFragment(
return adoptRef(new NGPhysicalTextFragment(
layout_object_, 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