| 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 21 matching lines...) Expand all Loading... |
| 32 #include "core/layout/LayoutTableCell.h" | 32 #include "core/layout/LayoutTableCell.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 using namespace HTMLNames; | 36 using namespace HTMLNames; |
| 37 | 37 |
| 38 LayoutTableCol::LayoutTableCol(Element* element) | 38 LayoutTableCol::LayoutTableCol(Element* element) |
| 39 : RenderBox(element) | 39 : RenderBox(element) |
| 40 , m_span(1) | 40 , m_span(1) |
| 41 { | 41 { |
| 42 // init RenderObject attributes | 42 // init LayoutObject attributes |
| 43 setInline(true); // our object is not Inline | 43 setInline(true); // our object is not Inline |
| 44 updateFromElement(); | 44 updateFromElement(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void LayoutTableCol::styleDidChange(StyleDifference diff, const RenderStyle* old
Style) | 47 void LayoutTableCol::styleDidChange(StyleDifference diff, const RenderStyle* old
Style) |
| 48 { | 48 { |
| 49 RenderBox::styleDidChange(diff, oldStyle); | 49 RenderBox::styleDidChange(diff, oldStyle); |
| 50 | 50 |
| 51 // If border was changed, notify table. | 51 // If border was changed, notify table. |
| 52 if (parent()) { | 52 if (parent()) { |
| 53 LayoutTable* table = this->table(); | 53 LayoutTable* table = this->table(); |
| 54 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout
() && oldStyle && oldStyle->border() != style()->border()) { | 54 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout
() && oldStyle && oldStyle->border() != style()->border()) { |
| 55 table->invalidateCollapsedBorders(); | 55 table->invalidateCollapsedBorders(); |
| 56 } else if (oldStyle && oldStyle->logicalWidth() != style()->logicalWidth
()) { | 56 } else if (oldStyle && oldStyle->logicalWidth() != style()->logicalWidth
()) { |
| 57 // FIXME : setPreferredLogicalWidthsDirty is done for all cells as o
f now. | 57 // FIXME : setPreferredLogicalWidthsDirty is done for all cells as o
f now. |
| 58 // Need to find a better way so that only the cells which are change
d by | 58 // Need to find a better way so that only the cells which are change
d by |
| 59 // the col width should have preferred logical widths recomputed. | 59 // the col width should have preferred logical widths recomputed. |
| 60 for (RenderObject* child = table->children()->firstChild(); child; c
hild = child->nextSibling()) { | 60 for (LayoutObject* child = table->children()->firstChild(); child; c
hild = child->nextSibling()) { |
| 61 if (!child->isTableSection()) | 61 if (!child->isTableSection()) |
| 62 continue; | 62 continue; |
| 63 LayoutTableSection* section = toLayoutTableSection(child); | 63 LayoutTableSection* section = toLayoutTableSection(child); |
| 64 for (LayoutTableRow* row = section->firstRow(); row; row = row->
nextRow()) { | 64 for (LayoutTableRow* row = section->firstRow(); row; row = row->
nextRow()) { |
| 65 for (LayoutTableCell* cell = row->firstCell(); cell; cell =
cell->nextCell()) | 65 for (LayoutTableCell* cell = row->firstCell(); cell; cell =
cell->nextCell()) |
| 66 cell->setPreferredLogicalWidthsDirty(); | 66 cell->setPreferredLogicalWidthsDirty(); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 } | 70 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 89 RenderBox::insertedIntoTree(); | 89 RenderBox::insertedIntoTree(); |
| 90 table()->addColumn(this); | 90 table()->addColumn(this); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void LayoutTableCol::willBeRemovedFromTree() | 93 void LayoutTableCol::willBeRemovedFromTree() |
| 94 { | 94 { |
| 95 RenderBox::willBeRemovedFromTree(); | 95 RenderBox::willBeRemovedFromTree(); |
| 96 table()->removeColumn(this); | 96 table()->removeColumn(this); |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool LayoutTableCol::isChildAllowed(RenderObject* child, const RenderStyle& styl
e) const | 99 bool LayoutTableCol::isChildAllowed(LayoutObject* child, const RenderStyle& styl
e) const |
| 100 { | 100 { |
| 101 // We cannot use isTableColumn here as style() may return 0. | 101 // We cannot use isTableColumn here as style() may return 0. |
| 102 return child->isLayoutTableCol() && style.display() == TABLE_COLUMN; | 102 return child->isLayoutTableCol() && style.display() == TABLE_COLUMN; |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool LayoutTableCol::canHaveChildren() const | 105 bool LayoutTableCol::canHaveChildren() const |
| 106 { | 106 { |
| 107 // Cols cannot have children. This is actually necessary to fix a bug | 107 // Cols cannot have children. This is actually necessary to fix a bug |
| 108 // with libraries.uc.edu, which makes a <p> be a table-column. | 108 // with libraries.uc.edu, which makes a <p> be a table-column. |
| 109 return isTableColumnGroup(); | 109 return isTableColumnGroup(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 125 void LayoutTableCol::imageChanged(WrappedImagePtr, const IntRect*) | 125 void LayoutTableCol::imageChanged(WrappedImagePtr, const IntRect*) |
| 126 { | 126 { |
| 127 // FIXME: Issue paint invalidation of only the rect the image paints in. | 127 // FIXME: Issue paint invalidation of only the rect the image paints in. |
| 128 setShouldDoFullPaintInvalidation(); | 128 setShouldDoFullPaintInvalidation(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void LayoutTableCol::clearPreferredLogicalWidthsDirtyBits() | 131 void LayoutTableCol::clearPreferredLogicalWidthsDirtyBits() |
| 132 { | 132 { |
| 133 clearPreferredLogicalWidthsDirty(); | 133 clearPreferredLogicalWidthsDirty(); |
| 134 | 134 |
| 135 for (RenderObject* child = firstChild(); child; child = child->nextSibling()
) | 135 for (LayoutObject* child = firstChild(); child; child = child->nextSibling()
) |
| 136 child->clearPreferredLogicalWidthsDirty(); | 136 child->clearPreferredLogicalWidthsDirty(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 LayoutTable* LayoutTableCol::table() const | 139 LayoutTable* LayoutTableCol::table() const |
| 140 { | 140 { |
| 141 RenderObject* table = parent(); | 141 LayoutObject* table = parent(); |
| 142 if (table && !table->isTable()) | 142 if (table && !table->isTable()) |
| 143 table = table->parent(); | 143 table = table->parent(); |
| 144 return table && table->isTable() ? toLayoutTable(table) : 0; | 144 return table && table->isTable() ? toLayoutTable(table) : 0; |
| 145 } | 145 } |
| 146 | 146 |
| 147 LayoutTableCol* LayoutTableCol::enclosingColumnGroup() const | 147 LayoutTableCol* LayoutTableCol::enclosingColumnGroup() const |
| 148 { | 148 { |
| 149 if (!parent()->isLayoutTableCol()) | 149 if (!parent()->isLayoutTableCol()) |
| 150 return 0; | 150 return 0; |
| 151 | 151 |
| 152 LayoutTableCol* parentColumnGroup = toLayoutTableCol(parent()); | 152 LayoutTableCol* parentColumnGroup = toLayoutTableCol(parent()); |
| 153 ASSERT(parentColumnGroup->isTableColumnGroup()); | 153 ASSERT(parentColumnGroup->isTableColumnGroup()); |
| 154 ASSERT(isTableColumn()); | 154 ASSERT(isTableColumn()); |
| 155 return parentColumnGroup; | 155 return parentColumnGroup; |
| 156 } | 156 } |
| 157 | 157 |
| 158 LayoutTableCol* LayoutTableCol::nextColumn() const | 158 LayoutTableCol* LayoutTableCol::nextColumn() const |
| 159 { | 159 { |
| 160 // If |this| is a column-group, the next column is the colgroup's first chil
d column. | 160 // If |this| is a column-group, the next column is the colgroup's first chil
d column. |
| 161 if (RenderObject* firstChild = this->firstChild()) | 161 if (LayoutObject* firstChild = this->firstChild()) |
| 162 return toLayoutTableCol(firstChild); | 162 return toLayoutTableCol(firstChild); |
| 163 | 163 |
| 164 // Otherwise it's the next column along. | 164 // Otherwise it's the next column along. |
| 165 RenderObject* next = nextSibling(); | 165 LayoutObject* next = nextSibling(); |
| 166 | 166 |
| 167 // Failing that, the child is the last column in a column-group, so the next
column is the next column/column-group after its column-group. | 167 // Failing that, the child is the last column in a column-group, so the next
column is the next column/column-group after its column-group. |
| 168 if (!next && parent()->isLayoutTableCol()) | 168 if (!next && parent()->isLayoutTableCol()) |
| 169 next = parent()->nextSibling(); | 169 next = parent()->nextSibling(); |
| 170 | 170 |
| 171 for (; next && !next->isLayoutTableCol(); next = next->nextSibling()) { } | 171 for (; next && !next->isLayoutTableCol(); next = next->nextSibling()) { } |
| 172 | 172 |
| 173 return toLayoutTableCol(next); | 173 return toLayoutTableCol(next); |
| 174 } | 174 } |
| 175 | 175 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 189 return style()->borderStart(); | 189 return style()->borderStart(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 const BorderValue& LayoutTableCol::borderAdjoiningCellAfter(const LayoutTableCel
l* cell) const | 192 const BorderValue& LayoutTableCol::borderAdjoiningCellAfter(const LayoutTableCel
l* cell) const |
| 193 { | 193 { |
| 194 ASSERT_UNUSED(cell, table()->colElement(cell->col() - 1) == this); | 194 ASSERT_UNUSED(cell, table()->colElement(cell->col() - 1) == this); |
| 195 return style()->borderEnd(); | 195 return style()->borderEnd(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } | 198 } |
| OLD | NEW |