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; |
} |