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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2802413002: Don't let current width affect preferred width on shrink-to-fit containers (Closed)
Patch Set: bug 598711 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/LayoutTests/fast/inline/percentage-margins-shrink-to-fit-expected.html ('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/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 9460837de934d171b87138dd10dc175b49815f74..504df4f713d29aa844eb519047b6c5cdb7ad0ead 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -2724,9 +2724,13 @@ LayoutUnit LayoutBox::computeLogicalWidthUsing(SizeType widthType,
marginStart, marginEnd, toLayoutBlockFlow(cb)));
if (widthType == MainOrPreferredSize &&
- sizesLogicalWidthToFitContent(logicalWidth))
+ sizesLogicalWidthToFitContent(logicalWidth)) {
+ // Reset width so that any percent margins on inline children do not
+ // use it when calculating min/max preferred width.
eae 2017/04/10 05:17:57 Would you mind filing a bug about this const_cast
+ const_cast<LayoutBox*>(this)->setLogicalWidth(LayoutUnit());
return std::max(minPreferredLogicalWidth(),
std::min(maxPreferredLogicalWidth(), logicalWidthResult));
+ }
return logicalWidthResult;
}
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/inline/percentage-margins-shrink-to-fit-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698