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 25 matching lines...) Expand all Loading... |
36 #include "core/rendering/style/StyleInheritedData.h" | 36 #include "core/rendering/style/StyleInheritedData.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 : RenderBox(element) |
44 , m_rowIndex(unsetRowIndex) | 44 , m_rowIndex(unsetRowIndex) |
45 { | 45 { |
46 // init RenderObject 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 RenderBox::willBeRemovedFromTree(); |
53 | 53 |
54 section()->setNeedsCellRecalc(); | 54 section()->setNeedsCellRecalc(); |
55 } | 55 } |
56 | 56 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 return style()->borderStart(); | 98 return style()->borderStart(); |
99 } | 99 } |
100 | 100 |
101 const BorderValue& LayoutTableRow::borderAdjoiningEndCell(const LayoutTableCell*
cell) const | 101 const BorderValue& LayoutTableRow::borderAdjoiningEndCell(const LayoutTableCell*
cell) const |
102 { | 102 { |
103 ASSERT_UNUSED(cell, cell->isFirstOrLastCellInRow()); | 103 ASSERT_UNUSED(cell, cell->isFirstOrLastCellInRow()); |
104 // FIXME: https://webkit.org/b/79272 - Add support for mixed directionality
at the cell level. | 104 // FIXME: https://webkit.org/b/79272 - Add support for mixed directionality
at the cell level. |
105 return style()->borderEnd(); | 105 return style()->borderEnd(); |
106 } | 106 } |
107 | 107 |
108 void LayoutTableRow::addChild(RenderObject* child, RenderObject* beforeChild) | 108 void LayoutTableRow::addChild(LayoutObject* child, LayoutObject* beforeChild) |
109 { | 109 { |
110 if (!child->isTableCell()) { | 110 if (!child->isTableCell()) { |
111 RenderObject* last = beforeChild; | 111 LayoutObject* last = beforeChild; |
112 if (!last) | 112 if (!last) |
113 last = lastCell(); | 113 last = lastCell(); |
114 if (last && last->isAnonymous() && last->isTableCell() && !last->isBefor
eOrAfterContent()) { | 114 if (last && last->isAnonymous() && last->isTableCell() && !last->isBefor
eOrAfterContent()) { |
115 LayoutTableCell* lastCell = toLayoutTableCell(last); | 115 LayoutTableCell* lastCell = toLayoutTableCell(last); |
116 if (beforeChild == lastCell) | 116 if (beforeChild == lastCell) |
117 beforeChild = lastCell->firstChild(); | 117 beforeChild = lastCell->firstChild(); |
118 lastCell->addChild(child, beforeChild); | 118 lastCell->addChild(child, beforeChild); |
119 return; | 119 return; |
120 } | 120 } |
121 | 121 |
122 if (beforeChild && !beforeChild->isAnonymous() && beforeChild->parent()
== this) { | 122 if (beforeChild && !beforeChild->isAnonymous() && beforeChild->parent()
== this) { |
123 RenderObject* cell = beforeChild->previousSibling(); | 123 LayoutObject* cell = beforeChild->previousSibling(); |
124 if (cell && cell->isTableCell() && cell->isAnonymous()) { | 124 if (cell && cell->isTableCell() && cell->isAnonymous()) { |
125 cell->addChild(child); | 125 cell->addChild(child); |
126 return; | 126 return; |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 // If beforeChild is inside an anonymous cell, insert into the cell. | 130 // If beforeChild is inside an anonymous cell, insert into the cell. |
131 if (last && !last->isTableCell() && last->parent() && last->parent()->is
Anonymous() && !last->parent()->isBeforeOrAfterContent()) { | 131 if (last && !last->isTableCell() && last->parent() && last->parent()->is
Anonymous() && !last->parent()->isBeforeOrAfterContent()) { |
132 last->parent()->addChild(child, beforeChild); | 132 last->parent()->addChild(child, beforeChild); |
133 return; | 133 return; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 setShouldDoFullPaintInvalidation(); | 224 setShouldDoFullPaintInvalidation(); |
225 } | 225 } |
226 | 226 |
227 LayoutTableRow* LayoutTableRow::createAnonymous(Document* document) | 227 LayoutTableRow* LayoutTableRow::createAnonymous(Document* document) |
228 { | 228 { |
229 LayoutTableRow* renderer = new LayoutTableRow(0); | 229 LayoutTableRow* renderer = new LayoutTableRow(0); |
230 renderer->setDocumentForAnonymous(document); | 230 renderer->setDocumentForAnonymous(document); |
231 return renderer; | 231 return renderer; |
232 } | 232 } |
233 | 233 |
234 LayoutTableRow* LayoutTableRow::createAnonymousWithParentRenderer(const RenderOb
ject* parent) | 234 LayoutTableRow* LayoutTableRow::createAnonymousWithParentRenderer(const LayoutOb
ject* parent) |
235 { | 235 { |
236 LayoutTableRow* newRow = LayoutTableRow::createAnonymous(&parent->document()
); | 236 LayoutTableRow* newRow = LayoutTableRow::createAnonymous(&parent->document()
); |
237 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), TABLE_ROW); | 237 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parent->style(), TABLE_ROW); |
238 newRow->setStyle(newStyle.release()); | 238 newRow->setStyle(newStyle.release()); |
239 return newRow; | 239 return newRow; |
240 } | 240 } |
241 | 241 |
242 void LayoutTableRow::addOverflowFromCell(const LayoutTableCell* cell) | 242 void LayoutTableRow::addOverflowFromCell(const LayoutTableCell* cell) |
243 { | 243 { |
244 // Non-row-spanning-cells don't create overflow (they are fully contained wi
thin this row). | 244 // Non-row-spanning-cells don't create overflow (they are fully contained wi
thin this row). |
245 if (cell->rowSpan() == 1) | 245 if (cell->rowSpan() == 1) |
246 return; | 246 return; |
247 | 247 |
248 // Cells only generates visual overflow. | 248 // Cells only generates visual overflow. |
249 LayoutRect cellVisualOverflowRect = cell->visualOverflowRectForPropagation(s
tyle()); | 249 LayoutRect cellVisualOverflowRect = cell->visualOverflowRectForPropagation(s
tyle()); |
250 | 250 |
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 |