| 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 27 matching lines...) Expand all Loading... |
| 38 : LayoutTableBoxComponent(element) | 38 : LayoutTableBoxComponent(element) |
| 39 , m_span(1) | 39 , m_span(1) |
| 40 { | 40 { |
| 41 // init LayoutObject attributes | 41 // init LayoutObject attributes |
| 42 setInline(true); // our object is not Inline | 42 setInline(true); // our object is not Inline |
| 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 DCHECK(style()->display() == TABLE_COLUMN || style()->display() == TABLE_COL
UMN_GROUP); |
| 49 |
| 48 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); | 50 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); |
| 49 | 51 |
| 50 if (LayoutTable* table = this->table()) { | 52 if (!oldStyle) |
| 51 if (!oldStyle) | 53 return; |
| 52 return; | |
| 53 | 54 |
| 54 // TODO(dgrogan): Is the "else" necessary for correctness or just a brit
tle optimization? The optimization would be: | 55 LayoutTable* table = this->table(); |
| 55 // if the first branch is taken then the next one can't be, so don't eve
n check its condition. | 56 if (!table) |
| 56 if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && old
Style->border() != style()->border()) { | 57 return; |
| 57 // If border was changed, notify table. | 58 |
| 58 table->invalidateCollapsedBorders(); | 59 // TODO(dgrogan): Is the "else" necessary for correctness or just a brittle
optimization? The optimization would be: |
| 59 } else if ((oldStyle->logicalWidth() != style()->logicalWidth()) || (dif
f.needsFullLayout() && needsLayout() && table->collapseBorders() && oldStyle->bo
rder().sizeEquals(style()->border()))) { | 60 // if the first branch is taken then the next one can't be, so don't even ch
eck its condition. |
| 60 // TODO(dgrogan): Move second clause above to LayoutTableBoxComponen
t for re-use. | 61 if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyl
e->border() != style()->border()) { |
| 61 // TODO(dgrogan): Optimization opportunities: | 62 table->invalidateCollapsedBorders(); |
| 62 // (1) Only mark cells which are affected by this col, not every cel
l in the table. | 63 } else if ((oldStyle->logicalWidth() != style()->logicalWidth()) || LayoutTa
bleBoxComponent::doCellsHaveDirtyWidth(*this, *table, diff, *oldStyle)) { |
| 63 // (2) If only the col width changes and its border width doesn't, d
o the cells need to be marked as | 64 // TODO(dgrogan): Optimization opportunities: |
| 64 // needing layout or just given dirty widths? | 65 // (1) Only mark cells which are affected by this col, not every cell in
the table. |
| 65 for (LayoutObject* child = table->children()->firstChild(); child; c
hild = child->nextSibling()) { | 66 // (2) If only the col width changes and its border width doesn't, do th
e cells need to be marked as |
| 66 if (!child->isTableSection()) | 67 // needing layout or just given dirty widths? |
| 67 continue; | 68 for (LayoutObject* child = table->children()->firstChild(); child; child
= child->nextSibling()) { |
| 68 LayoutTableSection* section = toLayoutTableSection(child); | 69 if (!child->isTableSection()) |
| 69 section->markAllCellsWidthsDirtyAndOrNeedsLayout(LayoutTableSect
ion::MarkDirtyAndNeedsLayout); | 70 continue; |
| 70 } | 71 LayoutTableSection* section = toLayoutTableSection(child); |
| 72 section->markAllCellsWidthsDirtyAndOrNeedsLayout(LayoutTableSection:
:MarkDirtyAndNeedsLayout); |
| 71 } | 73 } |
| 72 } | 74 } |
| 73 } | 75 } |
| 74 | 76 |
| 75 void LayoutTableCol::updateFromElement() | 77 void LayoutTableCol::updateFromElement() |
| 76 { | 78 { |
| 77 unsigned oldSpan = m_span; | 79 unsigned oldSpan = m_span; |
| 78 Node* n = node(); | 80 Node* n = node(); |
| 79 if (isHTMLTableColElement(n)) { | 81 if (isHTMLTableColElement(n)) { |
| 80 HTMLTableColElement& tc = toHTMLTableColElement(*n); | 82 HTMLTableColElement& tc = toHTMLTableColElement(*n); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 return style()->borderStart(); | 191 return style()->borderStart(); |
| 190 } | 192 } |
| 191 | 193 |
| 192 const BorderValue& LayoutTableCol::borderAdjoiningCellAfter(const LayoutTableCel
l* cell) const | 194 const BorderValue& LayoutTableCol::borderAdjoiningCellAfter(const LayoutTableCel
l* cell) const |
| 193 { | 195 { |
| 194 ASSERT_UNUSED(cell, table()->colElementAtAbsoluteColumn(cell->absoluteColumn
Index() - 1).innermostColOrColGroup() == this); | 196 ASSERT_UNUSED(cell, table()->colElementAtAbsoluteColumn(cell->absoluteColumn
Index() - 1).innermostColOrColGroup() == this); |
| 195 return style()->borderEnd(); | 197 return style()->borderEnd(); |
| 196 } | 198 } |
| 197 | 199 |
| 198 } // namespace blink | 200 } // namespace blink |
| OLD | NEW |