| 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, 2009 Apple Inc. All rights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
| 8 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 updateFromElement(); | 43 updateFromElement(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void LayoutTableCol::styleDidChange(StyleDifference diff, const ComputedStyle* o
ldStyle) | 46 void LayoutTableCol::styleDidChange(StyleDifference diff, const ComputedStyle* o
ldStyle) |
| 47 { | 47 { |
| 48 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); | 48 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); |
| 49 | 49 |
| 50 if (LayoutTable* table = this->table()) { | 50 if (LayoutTable* table = this->table()) { |
| 51 if (!oldStyle) | 51 if (!oldStyle) |
| 52 return; | 52 return; |
| 53 |
| 54 // TODO(dgrogan): Is the "else" necessary for correctness or just a brit
tle optimization? The optimization would be: |
| 55 // if the first branch is taken then the next one can't be, so don't eve
n check its condition. |
| 53 if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && old
Style->border() != style()->border()) { | 56 if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && old
Style->border() != style()->border()) { |
| 54 // If border was changed, notify table. | 57 // If border was changed, notify table. |
| 55 table->invalidateCollapsedBorders(); | 58 table->invalidateCollapsedBorders(); |
| 56 } else if (oldStyle->logicalWidth() != style()->logicalWidth()) { | 59 } else if ((oldStyle->logicalWidth() != style()->logicalWidth()) || (dif
f.needsFullLayout() && needsLayout() && table->collapseBorders() && oldStyle->bo
rder().sizeEquals(style()->border()))) { |
| 57 // FIXME : setPreferredLogicalWidthsDirty is done for all cells as o
f now. | 60 // TODO(dgrogan): Move second clause above to LayoutTableBoxComponen
t for re-use. |
| 58 // Need to find a better way so that only the cells which are change
d by | 61 // TODO(dgrogan): Optimization opportunities: |
| 59 // the col width should have preferred logical widths recomputed. | 62 // (1) Only mark cells which are affected by this col, not every cel
l in the table. |
| 63 // (2) If only the col width changes and its border width doesn't, d
o the cells need to be marked as |
| 64 // needing layout or just given dirty widths? |
| 60 for (LayoutObject* child = table->children()->firstChild(); child; c
hild = child->nextSibling()) { | 65 for (LayoutObject* child = table->children()->firstChild(); child; c
hild = child->nextSibling()) { |
| 61 if (!child->isTableSection()) | 66 if (!child->isTableSection()) |
| 62 continue; | 67 continue; |
| 63 LayoutTableSection* section = toLayoutTableSection(child); | 68 LayoutTableSection* section = toLayoutTableSection(child); |
| 64 for (LayoutTableRow* row = section->firstRow(); row; row = row->
nextRow()) { | 69 section->markAllCellsWidthsDirtyAndOrNeedsLayout(LayoutTableSect
ion::MarkDirtyAndNeedsLayout); |
| 65 for (LayoutTableCell* cell = row->firstCell(); cell; cell =
cell->nextCell()) | |
| 66 cell->setPreferredLogicalWidthsDirty(); | |
| 67 } | |
| 68 } | 70 } |
| 69 } | 71 } |
| 70 } | 72 } |
| 71 } | 73 } |
| 72 | 74 |
| 73 void LayoutTableCol::updateFromElement() | 75 void LayoutTableCol::updateFromElement() |
| 74 { | 76 { |
| 75 unsigned oldSpan = m_span; | 77 unsigned oldSpan = m_span; |
| 76 Node* n = node(); | 78 Node* n = node(); |
| 77 if (isHTMLTableColElement(n)) { | 79 if (isHTMLTableColElement(n)) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 return style()->borderStart(); | 189 return style()->borderStart(); |
| 188 } | 190 } |
| 189 | 191 |
| 190 const BorderValue& LayoutTableCol::borderAdjoiningCellAfter(const LayoutTableCel
l* cell) const | 192 const BorderValue& LayoutTableCol::borderAdjoiningCellAfter(const LayoutTableCel
l* cell) const |
| 191 { | 193 { |
| 192 ASSERT_UNUSED(cell, table()->colElementAtAbsoluteColumn(cell->absoluteColumn
Index() - 1).innermostColOrColGroup() == this); | 194 ASSERT_UNUSED(cell, table()->colElementAtAbsoluteColumn(cell->absoluteColumn
Index() - 1).innermostColOrColGroup() == this); |
| 193 return style()->borderEnd(); | 195 return style()->borderEnd(); |
| 194 } | 196 } |
| 195 | 197 |
| 196 } // namespace blink | 198 } // namespace blink |
| OLD | NEW |