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

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

Issue 2850893003: Add container_block_offset,top_offset to NGFloatingObject. (Closed)
Patch Set: 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_block_layout_algorithm.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
index 9dae0ce353e93100f5433eb0e85a0df1ea1b7238..4220e3360e243111b46c5b24d74c4e8a023b654b 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
@@ -83,19 +83,31 @@ void MaybeUpdateFragmentBfcOffset(const NGConstraintSpace& space,
}
}
-void PositionPendingFloats(LayoutUnit origin_block_offset,
- NGFragmentBuilder* container_builder,
- NGConstraintSpace* space) {
+void PositionPendingFloatsFromOffset(LayoutUnit origin_block_offset,
+ LayoutUnit from_block_offset,
+ NGFragmentBuilder* container_builder,
+ NGConstraintSpace* space) {
DCHECK(container_builder->BfcOffset())
<< "Parent BFC offset should be known here";
const auto& floating_objects = container_builder->UnpositionedFloats();
- PositionFloats(origin_block_offset,
+ PositionFloats(origin_block_offset, from_block_offset,
container_builder->BfcOffset().value().block_offset,
floating_objects, space);
container_builder->MutablePositionedFloats().AppendVector(floating_objects);
container_builder->MutableUnpositionedFloats().clear();
}
+void PositionPendingFloats(LayoutUnit origin_block_offset,
+ NGFragmentBuilder* container_builder,
+ NGConstraintSpace* space) {
+ DCHECK(container_builder->BfcOffset())
+ << "Parent BFC offset should be known here";
+ LayoutUnit from_block_offset =
+ container_builder->BfcOffset().value().block_offset;
+ PositionPendingFloatsFromOffset(origin_block_offset, from_block_offset,
+ container_builder, space);
+}
+
NGBlockLayoutAlgorithm::NGBlockLayoutAlgorithm(NGBlockNode* node,
NGConstraintSpace* space,
NGBlockBreakToken* break_token)
@@ -380,7 +392,7 @@ void NGBlockLayoutAlgorithm::FinishChildLayout(
else if (fragment.BfcOffset())
child_bfc_offset = PositionWithBfcOffset(fragment);
else if (container_builder_.BfcOffset())
- child_bfc_offset = PositionWithParentBfc();
+ child_bfc_offset = PositionWithParentBfc(*child_space);
NGLogicalOffset logical_offset = CalculateLogicalOffset(child_bfc_offset);
@@ -414,6 +426,7 @@ NGLogicalOffset NGBlockLayoutAlgorithm::PositionNewFc(
.SetIsNewFormattingContext(false)
.ToConstraintSpace(child_space.WritingMode());
PositionFloats(curr_bfc_offset_.block_offset, curr_bfc_offset_.block_offset,
+ curr_bfc_offset_.block_offset,
container_builder_.UnpositionedFloats(), tmp_space.Get());
// 2. Find an estimated layout opportunity for our fragment.
@@ -456,10 +469,15 @@ NGLogicalOffset NGBlockLayoutAlgorithm::PositionWithBfcOffset(
return fragment.BfcOffset().value();
}
-NGLogicalOffset NGBlockLayoutAlgorithm::PositionWithParentBfc() {
+NGLogicalOffset NGBlockLayoutAlgorithm::PositionWithParentBfc(
+ const NGConstraintSpace& space) {
curr_bfc_offset_ +=
{border_and_padding_.inline_start + curr_child_margins_.inline_start,
curr_margin_strut_.Sum()};
+ AdjustToClearance(space.ClearanceOffset(), &curr_bfc_offset_);
+ PositionPendingFloatsFromOffset(
+ curr_bfc_offset_.block_offset, curr_bfc_offset_.block_offset,
+ &container_builder_, MutableConstraintSpace());
return curr_bfc_offset_;
}

Powered by Google App Engine
This is Rietveld 408576698