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

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 b3ce79001e2e92b024d7d6e9b4bfe4cf2ec640df..baa0124156744affbf73bdc56f8175ce80436a25 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -2750,9 +2750,14 @@ LayoutUnit LayoutBox::ComputeLogicalWidthUsing(
ToLayoutBlockFlow(cb)));
if (width_type == kMainOrPreferredSize &&
- SizesLogicalWidthToFitContent(logical_width))
+ SizesLogicalWidthToFitContent(logical_width)) {
+ // Reset width so that any percent margins on inline children do not
+ // use it when calculating min/max preferred width.
+ // TODO(crbug.com/710026): Remove const_cast
+ const_cast<LayoutBox*>(this)->SetLogicalWidth(LayoutUnit());
return std::max(MinPreferredLogicalWidth(),
std::min(MaxPreferredLogicalWidth(), logical_width_result));
+ }
return logical_width_result;
}
« 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