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

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

Issue 2587283004: [layoutng] Add a shrink-to-fit flag to the constraint space (Closed)
Patch Set: review comments Created 4 years 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_length_utils.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_length_utils.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc b/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc
index 05b27372202237feb552162bb1cdd34e43db7caa..44a104f7bce4447ea2305d974085543cee4e9f03 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc
@@ -17,21 +17,22 @@ namespace blink {
// - positioned and/or replaced calculations
// - Take scrollbars into account
-bool NeedMinAndMaxContentSizes(const ComputedStyle& style) {
- // TODO(layout-ng): In the future we may pass a shrink-to-fit flag through the
- // constraint space; if so, this function needs to take a constraint space
- // as well to take that into account.
+bool NeedMinAndMaxContentSizes(const NGConstraintSpace& constraint_space,
+ const ComputedStyle& style) {
// This check is technically too broad (fill-available does not need intrinsic
// size computation) but that's a rare case and only affects performance, not
// correctness.
- return style.logicalWidth().isIntrinsic() ||
+ return constraint_space.IsShrinkToFit() ||
+ style.logicalWidth().isIntrinsic() ||
style.logicalMinWidth().isIntrinsic() ||
style.logicalMaxWidth().isIntrinsic();
}
bool NeedMinAndMaxContentSizesForContentContribution(
const ComputedStyle& style) {
- return NeedMinAndMaxContentSizes(style) || style.logicalWidth().isAuto();
+ return style.logicalWidth().isIntrinsicOrAuto() ||
+ style.logicalMinWidth().isIntrinsic() ||
+ style.logicalMaxWidth().isIntrinsic();
}
LayoutUnit ResolveInlineLength(
@@ -234,9 +235,12 @@ LayoutUnit ComputeInlineSizeForFragment(
if (space.IsFixedSizeInline())
return space.AvailableSize().inline_size;
- LayoutUnit extent =
- ResolveInlineLength(space, style, min_and_max, style.logicalWidth(),
- LengthResolveType::kContentSize);
+ Length logicalWidth = style.logicalWidth();
+ if (logicalWidth.isAuto() && space.IsShrinkToFit())
+ logicalWidth = Length(FitContent);
+
+ LayoutUnit extent = ResolveInlineLength(
+ space, style, min_and_max, logicalWidth, LengthResolveType::kContentSize);
Length max_length = style.logicalMaxWidth();
if (!max_length.isMaxSizeNone()) {
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_length_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698