Chromium Code Reviews| 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 87 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::createAndAddAnonymousCell(LayoutObject* child, LayoutObject * beforeChild) | |
| 109 { | |
| 110 LayoutTableCell* cell = LayoutTableCell::createAnonymousWithParent(this); | |
| 111 addChild(cell, beforeChild); | |
| 112 cell->addChild(child); | |
| 113 } | |
| 114 | |
| 108 void LayoutTableRow::addChild(LayoutObject* child, LayoutObject* beforeChild) | 115 void LayoutTableRow::addChild(LayoutObject* child, LayoutObject* beforeChild) |
| 109 { | 116 { |
| 110 if (!child->isTableCell()) { | 117 if (!child->isTableCell()) { |
| 118 if (child->style()->display() == TABLE_CELL) { | |
| 119 createAndAddAnonymousCell(child, beforeChild); | |
|
esprehn
2015/08/17 17:58:54
This doesn't feel like a good idea, does the input
rhogan
2015/08/17 18:16:57
We don't ignore it anymore (see below in LayoutThe
esprehn
2015/08/17 18:27:08
Yeah I don't think that's a good idea, it means th
| |
| 120 return; | |
| 121 } | |
| 122 | |
| 111 LayoutObject* last = beforeChild; | 123 LayoutObject* last = beforeChild; |
| 112 if (!last) | 124 if (!last) |
| 113 last = lastCell(); | 125 last = lastCell(); |
| 114 if (last && last->isAnonymous() && last->isTableCell() && !last->isBefor eOrAfterContent()) { | 126 if (last && last->isAnonymous() && last->isTableCell() && !last->isBefor eOrAfterContent()) { |
| 115 LayoutTableCell* lastCell = toLayoutTableCell(last); | 127 LayoutTableCell* lastCell = toLayoutTableCell(last); |
| 116 if (beforeChild == lastCell) | 128 if (beforeChild == lastCell) |
| 117 beforeChild = lastCell->firstChild(); | 129 beforeChild = lastCell->firstChild(); |
| 118 lastCell->addChild(child, beforeChild); | 130 lastCell->addChild(child, beforeChild); |
| 119 return; | 131 return; |
| 120 } | 132 } |
| 121 | 133 |
| 122 if (beforeChild && !beforeChild->isAnonymous() && beforeChild->parent() == this) { | 134 if (beforeChild && !beforeChild->isAnonymous() && beforeChild->parent() == this) { |
| 123 LayoutObject* cell = beforeChild->previousSibling(); | 135 LayoutObject* cell = beforeChild->previousSibling(); |
| 124 if (cell && cell->isTableCell() && cell->isAnonymous()) { | 136 if (cell && cell->isTableCell() && cell->isAnonymous()) { |
| 125 cell->addChild(child); | 137 cell->addChild(child); |
| 126 return; | 138 return; |
| 127 } | 139 } |
| 128 } | 140 } |
| 129 | 141 |
| 130 // If beforeChild is inside an anonymous cell, insert into the cell. | 142 // 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()) { | 143 if (last && !last->isTableCell() && last->parent() && last->parent()->is Anonymous() && !last->parent()->isBeforeOrAfterContent()) { |
| 132 last->parent()->addChild(child, beforeChild); | 144 last->parent()->addChild(child, beforeChild); |
| 133 return; | 145 return; |
| 134 } | 146 } |
| 135 | 147 |
| 136 LayoutTableCell* cell = LayoutTableCell::createAnonymousWithParent(this) ; | 148 createAndAddAnonymousCell(child, beforeChild); |
| 137 addChild(cell, beforeChild); | |
| 138 cell->addChild(child); | |
| 139 return; | 149 return; |
| 140 } | 150 } |
| 141 | 151 |
| 142 if (beforeChild && beforeChild->parent() != this) | 152 if (beforeChild && beforeChild->parent() != this) |
| 143 beforeChild = splitAnonymousBoxesAroundChild(beforeChild); | 153 beforeChild = splitAnonymousBoxesAroundChild(beforeChild); |
| 144 | 154 |
| 145 LayoutTableCell* cell = toLayoutTableCell(child); | 155 LayoutTableCell* cell = toLayoutTableCell(child); |
| 146 | 156 |
| 147 // Generated content can result in us having a null section so make sure to null check our parent. | 157 // Generated content can result in us having a null section so make sure to null check our parent. |
| 148 if (parent()) | 158 if (parent()) |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 // The cell and the row share the section's coordinate system. However | 260 // The cell and the row share the section's coordinate system. However |
| 251 // the visual overflow should be determined in the coordinate system of | 261 // the visual overflow should be determined in the coordinate system of |
| 252 // the row, that's why we shift it below. | 262 // the row, that's why we shift it below. |
| 253 LayoutUnit cellOffsetLogicalTopDifference = cell->location().y() - location( ).y(); | 263 LayoutUnit cellOffsetLogicalTopDifference = cell->location().y() - location( ).y(); |
| 254 cellVisualOverflowRect.move(0, cellOffsetLogicalTopDifference); | 264 cellVisualOverflowRect.move(0, cellOffsetLogicalTopDifference); |
| 255 | 265 |
| 256 addVisualOverflow(cellVisualOverflowRect); | 266 addVisualOverflow(cellVisualOverflowRect); |
| 257 } | 267 } |
| 258 | 268 |
| 259 } // namespace blink | 269 } // namespace blink |
| OLD | NEW |