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

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

Issue 2816933003: Use Layout Opportunity Iterator to position new FC blocks. (Closed)
Patch Set: Fix comments Created 3 years, 8 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 d378a40257f78ffb24b363e95d565c747c42b0e7..0eb7e077556c0b26ce952df8eb4e96ffd205adc3 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
@@ -109,14 +109,6 @@ NGFragmentBuilder& NGFragmentBuilder::AddChild(
return *this;
}
-NGFragmentBuilder& NGFragmentBuilder::AddFloatingObject(
- RefPtr<NGFloatingObject> floating_object,
- const NGLogicalOffset& floating_object_offset) {
- positioned_floats_.push_back(floating_object);
- floating_object_offsets_.push_back(floating_object_offset);
- return *this;
-}
-
NGFragmentBuilder& NGFragmentBuilder::SetBfcOffset(
const NGLogicalOffset& offset) {
bfc_offset_ = offset;
@@ -204,11 +196,14 @@ RefPtr<NGLayoutResult> NGFragmentBuilder::ToBoxFragment() {
break_token = NGBlockBreakToken::Create(node_.Get());
}
- for (size_t i = 0; i < positioned_floats_.size(); ++i) {
- RefPtr<NGFloatingObject>& floating_object = positioned_floats_[i];
+ for (auto& floating_object : positioned_floats_) {
+ DCHECK(floating_object->logical_offset)
+ << "logical_offset should be set for a positioned float.";
NGPhysicalFragment* floating_fragment = floating_object->fragment.Get();
- floating_fragment->SetOffset(floating_object_offsets_[i].ConvertToPhysical(
- writing_mode_, direction_, physical_size, floating_fragment->Size()));
+ floating_fragment->SetOffset(
+ floating_object->logical_offset.value().ConvertToPhysical(
+ writing_mode_, direction_, physical_size,
+ floating_fragment->Size()));
}
RefPtr<NGPhysicalBoxFragment> fragment = AdoptRef(new NGPhysicalBoxFragment(

Powered by Google App Engine
This is Rietveld 408576698