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

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

Issue 2945213004: [LayoutNG] Float behavior simplification before larger patch. (Closed)
Patch Set: update test expectations. Created 3 years, 6 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 45e959ef1f60657a42347f4f22e36371dc2652d5..24d41129938c60d8d57edd39bcdaa93fc16c0488 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
@@ -91,34 +91,23 @@ void MaybeUpdateFragmentBfcOffset(const NGConstraintSpace& space,
}
}
-void PositionPendingFloatsFromOffset(LayoutUnit origin_block_offset,
- LayoutUnit from_block_offset,
- NGFragmentBuilder* container_builder,
- NGConstraintSpace* space) {
+void PositionPendingFloats(LayoutUnit origin_block_offset,
+ NGFragmentBuilder* container_builder,
+ NGConstraintSpace* space) {
DCHECK(container_builder->BfcOffset())
<< "Parent BFC offset should be known here";
+
const auto& unpositioned_floats = container_builder->UnpositionedFloats();
- const auto positioned_floats =
- PositionFloats(origin_block_offset, from_block_offset,
- container_builder->BfcOffset().value().block_offset,
- unpositioned_floats, space);
+ const auto positioned_floats = PositionFloats(
+ origin_block_offset, container_builder->BfcOffset().value().block_offset,
+ unpositioned_floats, space);
+
for (const auto& positioned_float : positioned_floats)
container_builder->AddPositionedFloat(positioned_float);
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)
@@ -374,11 +363,13 @@ void NGBlockLayoutAlgorithm::HandleFloating(
// Calculate margins in the BFC's writing mode.
NGBoxStrut margins = CalculateMargins(child);
- NGLogicalOffset origin_offset = constraint_space_->BfcOffset();
- origin_offset.inline_offset += border_scrollbar_padding_.inline_start;
+ LayoutUnit origin_inline_offset =
+ constraint_space_->BfcOffset().inline_offset +
+ border_scrollbar_padding_.inline_start;
+
RefPtr<NGUnpositionedFloat> unpositioned_float = NGUnpositionedFloat::Create(
- child_available_size_, child_percentage_size_, origin_offset,
- constraint_space_->BfcOffset(), margins, child, token);
+ child_available_size_, child_percentage_size_, origin_inline_offset,
+ constraint_space_->BfcOffset().inline_offset, margins, child, token);
container_builder_.AddUnpositionedFloat(unpositioned_float);
// If there is a break token for a float we must be resuming layout, we must
@@ -536,7 +527,6 @@ NGLogicalOffset NGBlockLayoutAlgorithm::PositionNewFc(
.SetIsNewFormattingContext(false)
.ToConstraintSpace(child_space.WritingMode());
PositionFloats(child_bfc_offset_estimate, child_bfc_offset_estimate,
- child_bfc_offset_estimate,
container_builder_.UnpositionedFloats(), tmp_space.Get());
NGLogicalOffset origin_offset = {ConstraintSpace().BfcOffset().inline_offset +
@@ -610,9 +600,8 @@ NGLogicalOffset NGBlockLayoutAlgorithm::PositionWithParentBfc(
layout_result.EndMarginStrut().Sum()};
AdjustToClearance(space.ClearanceOffset(), &child_bfc_offset);
- PositionPendingFloatsFromOffset(
- child_bfc_offset.block_offset, child_bfc_offset.block_offset,
- &container_builder_, MutableConstraintSpace());
+ PositionPendingFloats(child_bfc_offset.block_offset, &container_builder_,
+ MutableConstraintSpace());
return child_bfc_offset;
}

Powered by Google App Engine
This is Rietveld 408576698