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

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

Issue 2851513004: Ensure cell's replaced content doesn't get the wrong width (Closed)
Patch Set: bug 666730 Created 3 years, 7 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/table/percent-height-replaced-content-in-cell.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/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();
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/table/percent-height-replaced-content-in-cell.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698