OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |