Index: third_party/WebKit/Source/core/layout/LayoutTableCell.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp |
index db9585482d1b726949726e56f2afbc3b7ec43e20..471f03dfbfb6d0b20ffd0af5a6c33e8fea53c477 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp |
@@ -209,7 +209,19 @@ void LayoutTableCell::ComputePreferredLogicalWidths() { |
// grids before the child cells try to use them. |
Table()->RecalcSectionsIfNeeded(); |
+ // We don't want the preferred width from children to be affected by any |
+ // notional height on the cell, such as can happen when a percent sized image |
+ // scales up its width to match the available height. Setting a zero override |
+ // height prevents this from happening. |
+ LayoutUnit content_height = HasOverrideLogicalContentHeight() |
+ ? OverrideLogicalContentHeight() |
+ : LayoutUnit(-1); |
+ if (content_height > -1) |
+ SetOverrideLogicalContentHeight(LayoutUnit()); |
LayoutBlockFlow::ComputePreferredLogicalWidths(); |
+ if (content_height > -1) |
+ SetOverrideLogicalContentHeight(content_height); |
+ |
if (GetNode() && Style()->AutoWrap()) { |
// See if nowrap was set. |
Length w = StyleOrColLogicalWidth(); |