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

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

Issue 2840883002: Check if fragment's block size fits into a layout opportunity. (Closed)
Patch Set: git rebase-update 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..90b65553e5296b14e7d307b114912f9a4bebf9a4 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
@@ -416,10 +416,13 @@ NGLogicalOffset NGBlockLayoutAlgorithm::PositionNewFc(
PositionFloats(curr_bfc_offset_.block_offset, curr_bfc_offset_.block_offset,
container_builder_.UnpositionedFloats(), tmp_space.Get());
+ NGLogicalOffset origin_offset = curr_bfc_offset_;
+ origin_offset.inline_offset += border_and_padding_.inline_start;
+
// 2. Find an estimated layout opportunity for our fragment.
NGLayoutOpportunity opportunity = FindLayoutOpportunityForFragment(
- tmp_space->Exclusions().get(), child_space.AvailableSize(),
- curr_bfc_offset_, curr_child_margins_, fragment);
+ tmp_space->Exclusions().get(), child_space.AvailableSize(), origin_offset,
+ curr_child_margins_, fragment);
// 3. If the found opportunity lies on the same line with our estimated
// child's BFC offset then merge fragment's margins with the current
@@ -435,11 +438,14 @@ NGLogicalOffset NGBlockLayoutAlgorithm::PositionNewFc(
PositionPendingFloats(curr_bfc_offset_.block_offset, &container_builder_,
MutableConstraintSpace());
+ origin_offset = curr_bfc_offset_;
+ origin_offset.inline_offset += border_and_padding_.inline_start;
+
// 5. Find the final layout opportunity for the fragment after all pending
// floats are positioned at the correct BFC block's offset.
opportunity = FindLayoutOpportunityForFragment(
MutableConstraintSpace()->Exclusions().get(), child_space.AvailableSize(),
- curr_bfc_offset_, curr_child_margins_, fragment);
+ origin_offset, curr_child_margins_, fragment);
curr_bfc_offset_ = opportunity.offset;
return curr_bfc_offset_;

Powered by Google App Engine
This is Rietveld 408576698