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

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, 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
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 87e7a70e8e2c30e940f9b394443a990bee8c3da3..2c5e484fd2ccf292f69f8f8c7a0996b99408f50a 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
@@ -206,7 +206,22 @@ 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
mstensho (USE GERRIT) 2017/05/12 11:44:07 Agreed. No preferred width calculation code should
rhogan 2017/05/12 19:12:23 Here you go: diff --git a/third_party/WebKit/Sour
mstensho (USE GERRIT) 2017/05/15 06:50:09 Here's the problem. Calculating preferred/intrinsi
+ // 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);
+ SetOverrideLogicalContentHeight(LayoutUnit());
mstensho (USE GERRIT) 2017/05/16 07:57:54 You wrote:
+
rhogan 2017/05/01 16:12:38 OK I know this is ugly, but I think what makes cel
mstensho (USE GERRIT) 2017/05/12 11:44:07 Yeah, if we really need a special height override
LayoutBlockFlow::ComputePreferredLogicalWidths();
+
+ if (content_height > -1)
+ SetOverrideLogicalContentHeight(content_height);
+ else
+ ClearOverrideLogicalContentHeight();
mstensho (USE GERRIT) 2017/05/16 07:57:54 And if it's possible to clear it above, you won't
+
if (GetNode() && Style()->AutoWrap()) {
// See if nowrap was set.
Length w = StyleOrColLogicalWidth();

Powered by Google App Engine
This is Rietveld 408576698