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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); | 49 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); |
50 | 50 |
51 if (!oldStyle) | 51 if (!oldStyle) |
52 return; | 52 return; |
53 | 53 |
54 LayoutTable* table = this->table(); | 54 LayoutTable* table = this->table(); |
55 if (!table) | 55 if (!table) |
56 return; | 56 return; |
57 | 57 |
58 // TODO(dgrogan): Is the "else" necessary for correctness or just a brittle op
timization? The optimization would be: | 58 // TODO(dgrogan): Is the "else" necessary for correctness or just a brittle |
59 // if the first branch is taken then the next one can't be, so don't even chec
k its condition. | 59 // optimization? The optimization would be: if the first branch is taken then |
| 60 // the next one can't be, so don't even check its condition. |
60 if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && | 61 if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && |
61 oldStyle->border() != style()->border()) { | 62 oldStyle->border() != style()->border()) { |
62 table->invalidateCollapsedBorders(); | 63 table->invalidateCollapsedBorders(); |
63 } else if ((oldStyle->logicalWidth() != style()->logicalWidth()) || | 64 } else if ((oldStyle->logicalWidth() != style()->logicalWidth()) || |
64 LayoutTableBoxComponent::doCellsHaveDirtyWidth(*this, *table, diff, | 65 LayoutTableBoxComponent::doCellsHaveDirtyWidth(*this, *table, diff, |
65 *oldStyle)) { | 66 *oldStyle)) { |
66 // TODO(dgrogan): Optimization opportunities: | 67 // TODO(dgrogan): Optimization opportunities: |
67 // (1) Only mark cells which are affected by this col, not every cell in the
table. | 68 // (1) Only mark cells which are affected by this col, not every cell in the |
68 // (2) If only the col width changes and its border width doesn't, do the ce
lls need to be marked as | 69 // table. |
69 // needing layout or just given dirty widths? | 70 // (2) If only the col width changes and its border width doesn't, do the |
| 71 // cells need to be marked as needing layout or just given dirty |
| 72 // widths? |
70 table->markAllCellsWidthsDirtyAndOrNeedsLayout( | 73 table->markAllCellsWidthsDirtyAndOrNeedsLayout( |
71 LayoutTable::MarkDirtyAndNeedsLayout); | 74 LayoutTable::MarkDirtyAndNeedsLayout); |
72 } | 75 } |
73 } | 76 } |
74 | 77 |
75 void LayoutTableCol::updateFromElement() { | 78 void LayoutTableCol::updateFromElement() { |
76 unsigned oldSpan = m_span; | 79 unsigned oldSpan = m_span; |
77 Node* n = node(); | 80 Node* n = node(); |
78 if (isHTMLTableColElement(n)) { | 81 if (isHTMLTableColElement(n)) { |
79 HTMLTableColElement& tc = toHTMLTableColElement(*n); | 82 HTMLTableColElement& tc = toHTMLTableColElement(*n); |
(...skipping 23 matching lines...) Expand all Loading... |
103 } | 106 } |
104 | 107 |
105 bool LayoutTableCol::canHaveChildren() const { | 108 bool LayoutTableCol::canHaveChildren() const { |
106 // Cols cannot have children. This is actually necessary to fix a bug | 109 // Cols cannot have children. This is actually necessary to fix a bug |
107 // with libraries.uc.edu, which makes a <p> be a table-column. | 110 // with libraries.uc.edu, which makes a <p> be a table-column. |
108 return isTableColumnGroup(); | 111 return isTableColumnGroup(); |
109 } | 112 } |
110 | 113 |
111 LayoutRect LayoutTableCol::localOverflowRectForPaintInvalidation() const { | 114 LayoutRect LayoutTableCol::localOverflowRectForPaintInvalidation() const { |
112 // Entire table gets invalidated, instead of invalidating | 115 // Entire table gets invalidated, instead of invalidating |
113 // every cell in the column. | 116 // every cell in the column. This is simpler, but suboptimal. |
114 // This is simpler, but suboptimal. | |
115 | 117 |
116 LayoutTable* table = this->table(); | 118 LayoutTable* table = this->table(); |
117 if (!table) | 119 if (!table) |
118 return LayoutRect(); | 120 return LayoutRect(); |
119 | 121 |
120 // The correctness of this method depends on the fact that LayoutTableCol's | 122 // The correctness of this method depends on the fact that LayoutTableCol's |
121 // location is always zero. | 123 // location is always zero. |
122 ASSERT(this->location() == LayoutPoint()); | 124 ASSERT(this->location() == LayoutPoint()); |
123 | 125 |
124 return table->localOverflowRectForPaintInvalidation(); | 126 return table->localOverflowRectForPaintInvalidation(); |
(...skipping 17 matching lines...) Expand all Loading... |
142 if (!parent()->isLayoutTableCol()) | 144 if (!parent()->isLayoutTableCol()) |
143 return nullptr; | 145 return nullptr; |
144 | 146 |
145 LayoutTableCol* parentColumnGroup = toLayoutTableCol(parent()); | 147 LayoutTableCol* parentColumnGroup = toLayoutTableCol(parent()); |
146 ASSERT(parentColumnGroup->isTableColumnGroup()); | 148 ASSERT(parentColumnGroup->isTableColumnGroup()); |
147 ASSERT(isTableColumn()); | 149 ASSERT(isTableColumn()); |
148 return parentColumnGroup; | 150 return parentColumnGroup; |
149 } | 151 } |
150 | 152 |
151 LayoutTableCol* LayoutTableCol::nextColumn() const { | 153 LayoutTableCol* LayoutTableCol::nextColumn() const { |
152 // If |this| is a column-group, the next column is the colgroup's first child
column. | 154 // If |this| is a column-group, the next column is the colgroup's first child |
| 155 // column. |
153 if (LayoutObject* firstChild = this->firstChild()) | 156 if (LayoutObject* firstChild = this->firstChild()) |
154 return toLayoutTableCol(firstChild); | 157 return toLayoutTableCol(firstChild); |
155 | 158 |
156 // Otherwise it's the next column along. | 159 // Otherwise it's the next column along. |
157 LayoutObject* next = nextSibling(); | 160 LayoutObject* next = nextSibling(); |
158 | 161 |
159 // Failing that, the child is the last column in a column-group, so the next c
olumn is the next column/column-group after its column-group. | 162 // Failing that, the child is the last column in a column-group, so the next |
| 163 // column is the next column/column-group after its column-group. |
160 if (!next && parent()->isLayoutTableCol()) | 164 if (!next && parent()->isLayoutTableCol()) |
161 next = parent()->nextSibling(); | 165 next = parent()->nextSibling(); |
162 | 166 |
163 for (; next && !next->isLayoutTableCol(); next = next->nextSibling()) { | 167 for (; next && !next->isLayoutTableCol(); next = next->nextSibling()) { |
164 } | 168 } |
165 | 169 |
166 return toLayoutTableCol(next); | 170 return toLayoutTableCol(next); |
167 } | 171 } |
168 | 172 |
169 const BorderValue& LayoutTableCol::borderAdjoiningCellStartBorder( | 173 const BorderValue& LayoutTableCol::borderAdjoiningCellStartBorder( |
(...skipping 19 matching lines...) Expand all Loading... |
189 const BorderValue& LayoutTableCol::borderAdjoiningCellAfter( | 193 const BorderValue& LayoutTableCol::borderAdjoiningCellAfter( |
190 const LayoutTableCell* cell) const { | 194 const LayoutTableCell* cell) const { |
191 DCHECK_EQ(table() | 195 DCHECK_EQ(table() |
192 ->colElementAtAbsoluteColumn(cell->absoluteColumnIndex() - 1) | 196 ->colElementAtAbsoluteColumn(cell->absoluteColumnIndex() - 1) |
193 .innermostColOrColGroup(), | 197 .innermostColOrColGroup(), |
194 this); | 198 this); |
195 return style()->borderEnd(); | 199 return style()->borderEnd(); |
196 } | 200 } |
197 | 201 |
198 } // namespace blink | 202 } // namespace blink |
OLD | NEW |