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, 2010, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc.
All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "core/layout/SubtreeLayoutScope.h" | 33 #include "core/layout/SubtreeLayoutScope.h" |
34 #include "core/layout/style/StyleInheritedData.h" | 34 #include "core/layout/style/StyleInheritedData.h" |
35 #include "core/paint/TableRowPainter.h" | 35 #include "core/paint/TableRowPainter.h" |
36 #include "core/rendering/RenderView.h" | 36 #include "core/rendering/RenderView.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 using namespace HTMLNames; | 40 using namespace HTMLNames; |
41 | 41 |
42 LayoutTableRow::LayoutTableRow(Element* element) | 42 LayoutTableRow::LayoutTableRow(Element* element) |
43 : RenderBox(element) | 43 : LayoutBox(element) |
44 , m_rowIndex(unsetRowIndex) | 44 , m_rowIndex(unsetRowIndex) |
45 { | 45 { |
46 // init LayoutObject attributes | 46 // init LayoutObject attributes |
47 setInline(false); // our object is not Inline | 47 setInline(false); // our object is not Inline |
48 } | 48 } |
49 | 49 |
50 void LayoutTableRow::willBeRemovedFromTree() | 50 void LayoutTableRow::willBeRemovedFromTree() |
51 { | 51 { |
52 RenderBox::willBeRemovedFromTree(); | 52 LayoutBox::willBeRemovedFromTree(); |
53 | 53 |
54 section()->setNeedsCellRecalc(); | 54 section()->setNeedsCellRecalc(); |
55 } | 55 } |
56 | 56 |
57 static bool borderWidthChanged(const LayoutStyle* oldStyle, const LayoutStyle* n
ewStyle) | 57 static bool borderWidthChanged(const LayoutStyle* oldStyle, const LayoutStyle* n
ewStyle) |
58 { | 58 { |
59 return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth() | 59 return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth() |
60 || oldStyle->borderTopWidth() != newStyle->borderTopWidth() | 60 || oldStyle->borderTopWidth() != newStyle->borderTopWidth() |
61 || oldStyle->borderRightWidth() != newStyle->borderRightWidth() | 61 || oldStyle->borderRightWidth() != newStyle->borderRightWidth() |
62 || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth(); | 62 || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth(); |
63 } | 63 } |
64 | 64 |
65 void LayoutTableRow::styleDidChange(StyleDifference diff, const LayoutStyle* old
Style) | 65 void LayoutTableRow::styleDidChange(StyleDifference diff, const LayoutStyle* old
Style) |
66 { | 66 { |
67 ASSERT(style()->display() == TABLE_ROW); | 67 ASSERT(style()->display() == TABLE_ROW); |
68 | 68 |
69 RenderBox::styleDidChange(diff, oldStyle); | 69 LayoutBox::styleDidChange(diff, oldStyle); |
70 propagateStyleToAnonymousChildren(); | 70 propagateStyleToAnonymousChildren(); |
71 | 71 |
72 if (section() && oldStyle && style()->logicalHeight() != oldStyle->logicalHe
ight()) | 72 if (section() && oldStyle && style()->logicalHeight() != oldStyle->logicalHe
ight()) |
73 section()->rowLogicalHeightChanged(this); | 73 section()->rowLogicalHeightChanged(this); |
74 | 74 |
75 // If border was changed, notify table. | 75 // If border was changed, notify table. |
76 if (parent()) { | 76 if (parent()) { |
77 LayoutTable* table = this->table(); | 77 LayoutTable* table = this->table(); |
78 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout
() && oldStyle && oldStyle->border() != style()->border()) | 78 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout
() && oldStyle && oldStyle->border() != style()->border()) |
79 table->invalidateCollapsedBorders(); | 79 table->invalidateCollapsedBorders(); |
80 | 80 |
81 if (table && oldStyle && diff.needsFullLayout() && needsLayout() && tabl
e->collapseBorders() && borderWidthChanged(oldStyle, style())) { | 81 if (table && oldStyle && diff.needsFullLayout() && needsLayout() && tabl
e->collapseBorders() && borderWidthChanged(oldStyle, style())) { |
82 // If the border width changes on a row, we need to make sure the ce
lls in the row know to lay out again. | 82 // If the border width changes on a row, we need to make sure the ce
lls in the row know to lay out again. |
83 // This only happens when borders are collapsed, since they end up a
ffecting the border sides of the cell | 83 // This only happens when borders are collapsed, since they end up a
ffecting the border sides of the cell |
84 // itself. | 84 // itself. |
85 for (RenderBox* childBox = firstChildBox(); childBox; childBox = chi
ldBox->nextSiblingBox()) { | 85 for (LayoutBox* childBox = firstChildBox(); childBox; childBox = chi
ldBox->nextSiblingBox()) { |
86 if (!childBox->isTableCell()) | 86 if (!childBox->isTableCell()) |
87 continue; | 87 continue; |
88 childBox->setChildNeedsLayout(); | 88 childBox->setChildNeedsLayout(); |
89 } | 89 } |
90 } | 90 } |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 const BorderValue& LayoutTableRow::borderAdjoiningStartCell(const LayoutTableCel
l* cell) const | 94 const BorderValue& LayoutTableRow::borderAdjoiningStartCell(const LayoutTableCel
l* cell) const |
95 { | 95 { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 if (beforeChild && beforeChild->parent() != this) | 142 if (beforeChild && beforeChild->parent() != this) |
143 beforeChild = splitAnonymousBoxesAroundChild(beforeChild); | 143 beforeChild = splitAnonymousBoxesAroundChild(beforeChild); |
144 | 144 |
145 LayoutTableCell* cell = toLayoutTableCell(child); | 145 LayoutTableCell* cell = toLayoutTableCell(child); |
146 | 146 |
147 // Generated content can result in us having a null section so make sure to
null check our parent. | 147 // Generated content can result in us having a null section so make sure to
null check our parent. |
148 if (parent()) | 148 if (parent()) |
149 section()->addCell(cell, this); | 149 section()->addCell(cell, this); |
150 | 150 |
151 ASSERT(!beforeChild || beforeChild->isTableCell()); | 151 ASSERT(!beforeChild || beforeChild->isTableCell()); |
152 RenderBox::addChild(cell, beforeChild); | 152 LayoutBox::addChild(cell, beforeChild); |
153 | 153 |
154 if (beforeChild || nextRow()) | 154 if (beforeChild || nextRow()) |
155 section()->setNeedsCellRecalc(); | 155 section()->setNeedsCellRecalc(); |
156 } | 156 } |
157 | 157 |
158 void LayoutTableRow::layout() | 158 void LayoutTableRow::layout() |
159 { | 159 { |
160 ASSERT(needsLayout()); | 160 ASSERT(needsLayout()); |
161 | 161 |
162 // Table rows do not add translation. | 162 // Table rows do not add translation. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 // The cell and the row share the section's coordinate system. However | 251 // The cell and the row share the section's coordinate system. However |
252 // the visual overflow should be determined in the coordinate system of | 252 // the visual overflow should be determined in the coordinate system of |
253 // the row, that's why we shift it below. | 253 // the row, that's why we shift it below. |
254 LayoutUnit cellOffsetLogicalTopDifference = cell->location().y() - location(
).y(); | 254 LayoutUnit cellOffsetLogicalTopDifference = cell->location().y() - location(
).y(); |
255 cellVisualOverflowRect.move(0, cellOffsetLogicalTopDifference); | 255 cellVisualOverflowRect.move(0, cellOffsetLogicalTopDifference); |
256 | 256 |
257 addVisualOverflow(cellVisualOverflowRect); | 257 addVisualOverflow(cellVisualOverflowRect); |
258 } | 258 } |
259 | 259 |
260 } // namespace blink | 260 } // namespace blink |
OLD | NEW |