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

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

Issue 2475383002: [layoutng] For min/max-content, take CanUseNewLayout() into account (Closed)
Patch Set: min -> max Created 4 years, 1 month 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 | « no previous file | 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_box.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_box.cc b/third_party/WebKit/Source/core/layout/ng/ng_box.cc
index c6b57e2dc284e3fcd4789f68f4f0483c9203cafe..49d4d32f47a3d684e2602dcfea1ab1ba56782100 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_box.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_box.cc
@@ -67,6 +67,22 @@ bool NGBox::Layout(const NGConstraintSpace* constraint_space,
}
bool NGBox::ComputeMinAndMaxContentSizes(MinAndMaxContentSizes* sizes) {
+ if (!CanUseNewLayout()) {
+ DCHECK(layout_box_);
+ // TODO(layout-ng): This could be somewhat optimized by directly calling
+ // computeIntrinsicLogicalWidths, but that function is currently private.
+ // Consider doing that if this becomes a performance issue.
+ LayoutUnit borderAndPadding = layout_box_->borderAndPaddingLogicalWidth();
+ sizes->min_content = layout_box_->computeLogicalWidthUsing(
+ MainOrPreferredSize, Length(MinContent),
+ LayoutUnit(), layout_box_->containingBlock()) -
+ borderAndPadding;
+ sizes->max_content = layout_box_->computeLogicalWidthUsing(
+ MainOrPreferredSize, Length(MaxContent),
+ LayoutUnit(), layout_box_->containingBlock()) -
+ borderAndPadding;
+ return true;
+ }
DCHECK(!layout_algorithm_)
<< "Can't interleave Layout and ComputeMinAndMaxContentSizes";
if (!minmax_algorithm_) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698