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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 202 }
203 203
204 void LayoutTableCell::ComputePreferredLogicalWidths() { 204 void LayoutTableCell::ComputePreferredLogicalWidths() {
205 // The child cells rely on the grids up in the sections to do their 205 // The child cells rely on the grids up in the sections to do their
206 // computePreferredLogicalWidths work. Normally the sections are set up 206 // computePreferredLogicalWidths work. Normally the sections are set up
207 // early, as table cells are added, but relayout can cause the cells to be 207 // early, as table cells are added, but relayout can cause the cells to be
208 // freed, leaving stale pointers in the sections' grids. We must refresh those 208 // freed, leaving stale pointers in the sections' grids. We must refresh those
209 // grids before the child cells try to use them. 209 // grids before the child cells try to use them.
210 Table()->RecalcSectionsIfNeeded(); 210 Table()->RecalcSectionsIfNeeded();
211 211
212 // We don't want the preferred width from children to be affected by any
213 // notional height on the cell, such as can happen when a percent sized image
214 // scales up its width to match the available height. Setting a zero override
215 // height prevents this from happening.
216 LayoutUnit content_height = HasOverrideLogicalContentHeight()
217 ? OverrideLogicalContentHeight()
218 : LayoutUnit(-1);
219 if (content_height > -1)
220 SetOverrideLogicalContentHeight(LayoutUnit());
212 LayoutBlockFlow::ComputePreferredLogicalWidths(); 221 LayoutBlockFlow::ComputePreferredLogicalWidths();
222 if (content_height > -1)
223 SetOverrideLogicalContentHeight(content_height);
224
213 if (GetNode() && Style()->AutoWrap()) { 225 if (GetNode() && Style()->AutoWrap()) {
214 // See if nowrap was set. 226 // See if nowrap was set.
215 Length w = StyleOrColLogicalWidth(); 227 Length w = StyleOrColLogicalWidth();
216 const AtomicString& nowrap = ToElement(GetNode())->getAttribute(nowrapAttr); 228 const AtomicString& nowrap = ToElement(GetNode())->getAttribute(nowrapAttr);
217 if (!nowrap.IsNull() && w.IsFixed()) { 229 if (!nowrap.IsNull() && w.IsFixed()) {
218 // Nowrap is set, but we didn't actually use it because of the fixed width 230 // Nowrap is set, but we didn't actually use it because of the fixed width
219 // set on the cell. Even so, it is a WinIE/Moz trait to make the minwidth 231 // set on the cell. Even so, it is a WinIE/Moz trait to make the minwidth
220 // of the cell into the fixed width. They do this even in strict mode, so 232 // of the cell into the fixed width. They do this even in strict mode, so
221 // do not make this a quirk. Affected the top of hiptop.com. 233 // do not make this a quirk. Affected the top of hiptop.com.
222 min_preferred_logical_width_ = 234 min_preferred_logical_width_ =
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 1495
1484 return LayoutBlock::HasLineIfEmpty(); 1496 return LayoutBlock::HasLineIfEmpty();
1485 } 1497 }
1486 1498
1487 PaintInvalidationReason LayoutTableCell::InvalidatePaint( 1499 PaintInvalidationReason LayoutTableCell::InvalidatePaint(
1488 const PaintInvalidatorContext& context) const { 1500 const PaintInvalidatorContext& context) const {
1489 return TableCellPaintInvalidator(*this, context).InvalidatePaint(); 1501 return TableCellPaintInvalidator(*this, context).InvalidatePaint();
1490 } 1502 }
1491 1503
1492 } // namespace blink 1504 } // namespace blink
OLDNEW
« 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