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

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

Issue 2816933003: Use Layout Opportunity Iterator to position new FC blocks. (Closed)
Patch Set: fix block-formatting-contexts-{005|007} 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
index de080810494de8392a4903e15392854912c574c2..24e29d30d2680b67c18514367e0e71b0aa9f2ffc 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.cc
@@ -259,6 +259,28 @@ bool CompareNGLayoutOpportunitesByStartPoint(const NGLayoutOpportunity& lhs,
}
} // namespace
+NGLayoutOpportunity FindLayoutOpportunityForFragment(
+ const NGExclusions* exclusions,
+ const NGLogicalSize& available_size,
+ const NGLogicalOffset& origin_point,
+ const NGBoxStrut& margins,
+ const NGFragment& fragment) {
+ NGLayoutOpportunityIterator opportunity_iter(exclusions, available_size,
+ origin_point);
+ NGLayoutOpportunity opportunity;
+ NGLayoutOpportunity opportunity_candidate = opportunity_iter.Next();
+ while (!opportunity_candidate.IsEmpty()) {
+ opportunity = opportunity_candidate;
+ // Checking opportunity's block size is not necessary as a float cannot be
+ // positioned on top of another float inside of the same constraint space.
+ auto fragment_inline_size = fragment.InlineSize() + margins.InlineSum();
+ if (opportunity.size.inline_size >= fragment_inline_size)
+ break;
+ opportunity_candidate = opportunity_iter.Next();
+ }
+ return opportunity;
+}
+
NGLayoutOpportunityIterator::NGLayoutOpportunityIterator(
const NGExclusions* exclusions,
const NGLogicalSize& available_size,
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_layout_opportunity_iterator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698