| 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, 2013 Apple Inc. All rights | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2013 Apple Inc. All rights |
| 8 * reserved. | 8 * reserved. |
| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // This Vector is sorted in DOM order. | 134 // This Vector is sorted in DOM order. |
| 135 Vector<LayoutTableCell*, 1> cells; | 135 Vector<LayoutTableCell*, 1> cells; |
| 136 bool inColSpan; // true for columns after the first in a colspan | 136 bool inColSpan; // true for columns after the first in a colspan |
| 137 | 137 |
| 138 CellStruct(); | 138 CellStruct(); |
| 139 ~CellStruct(); | 139 ~CellStruct(); |
| 140 | 140 |
| 141 // This is the cell in the grid "slot" that is on top of the others | 141 // This is the cell in the grid "slot" that is on top of the others |
| 142 // (aka the last cell in DOM order for this slot). | 142 // (aka the last cell in DOM order for this slot). |
| 143 // | 143 // |
| 144 // This is the cell originating from this slot if it exists. | 144 // Multiple grid slots can have the same primary cell if the cell spans |
| 145 // into the grid slots. The slot having the smallest row index and |
| 146 // smallest effective column index is the originating slot of the cell. |
| 145 // | 147 // |
| 146 // The concept of a primary cell is dubious at most as it doesn't | 148 // The concept of a primary cell is dubious at most as it doesn't |
| 147 // correspond to a DOM or rendering concept. Also callers should be | 149 // correspond to a DOM or rendering concept. Also callers should be |
| 148 // careful about assumptions about it. For example, even though the | 150 // careful about assumptions about it. For example, even though the |
| 149 // primary cell is visibly the top most, it is not guaranteed to be | 151 // primary cell is visibly the top most, it is not guaranteed to be |
| 150 // the only one visible for this slot due to different visual | 152 // the only one visible for this slot due to different visual |
| 151 // overflow rectangles. | 153 // overflow rectangles. |
| 152 LayoutTableCell* primaryCell() { | 154 LayoutTableCell* primaryCell() { |
| 153 return hasCells() ? cells[cells.size() - 1] : 0; | 155 return hasCells() ? cells[cells.size() - 1] : 0; |
| 154 } | 156 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 if (effectiveColumn >= rowVector.size()) | 224 if (effectiveColumn >= rowVector.size()) |
| 223 return nullptr; | 225 return nullptr; |
| 224 return rowVector[effectiveColumn].primaryCell(); | 226 return rowVector[effectiveColumn].primaryCell(); |
| 225 } | 227 } |
| 226 const LayoutTableCell* primaryCellAt(unsigned row, | 228 const LayoutTableCell* primaryCellAt(unsigned row, |
| 227 unsigned effectiveColumn) const { | 229 unsigned effectiveColumn) const { |
| 228 return const_cast<LayoutTableSection*>(this)->primaryCellAt( | 230 return const_cast<LayoutTableSection*>(this)->primaryCellAt( |
| 229 row, effectiveColumn); | 231 row, effectiveColumn); |
| 230 } | 232 } |
| 231 | 233 |
| 234 // Returns the primary cell at (row, effectiveColumn) if the cell exists and |
| 235 // originates from (instead of spanning into) the grid slot, or nullptr. |
| 236 const LayoutTableCell* originatingCellAt(unsigned row, |
| 237 unsigned effectiveColumn) const; |
| 238 |
| 232 unsigned numCols(unsigned row) const { return m_grid[row].row.size(); } | 239 unsigned numCols(unsigned row) const { return m_grid[row].row.size(); } |
| 233 | 240 |
| 234 // Returns null for cells with a rowspan that exceed the last row. Possibly | 241 // Returns null for cells with a rowspan that exceed the last row. Possibly |
| 235 // others. | 242 // others. |
| 236 LayoutTableRow* rowLayoutObjectAt(unsigned row) { | 243 LayoutTableRow* rowLayoutObjectAt(unsigned row) { |
| 237 return m_grid[row].rowLayoutObject; | 244 return m_grid[row].rowLayoutObject; |
| 238 } | 245 } |
| 239 const LayoutTableRow* rowLayoutObjectAt(unsigned row) const { | 246 const LayoutTableRow* rowLayoutObjectAt(unsigned row) const { |
| 240 return m_grid[row].rowLayoutObject; | 247 return m_grid[row].rowLayoutObject; |
| 241 } | 248 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 const LayoutObject* parent) const override { | 300 const LayoutObject* parent) const override { |
| 294 return createAnonymousWithParent(parent); | 301 return createAnonymousWithParent(parent); |
| 295 } | 302 } |
| 296 | 303 |
| 297 void paint(const PaintInfo&, const LayoutPoint&) const override; | 304 void paint(const PaintInfo&, const LayoutPoint&) const override; |
| 298 | 305 |
| 299 // Flip the rect so it aligns with the coordinates used by the rowPos and | 306 // Flip the rect so it aligns with the coordinates used by the rowPos and |
| 300 // columnPos vectors. | 307 // columnPos vectors. |
| 301 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const; | 308 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const; |
| 302 | 309 |
| 310 // Returns a row or column span covering all grid slots from each of which |
| 311 // a primary cell intersecting |visualRect| originates. |
| 303 CellSpan dirtiedRows(const LayoutRect& visualRect) const; | 312 CellSpan dirtiedRows(const LayoutRect& visualRect) const; |
| 304 CellSpan dirtiedEffectiveColumns(const LayoutRect& visualRect) const; | 313 CellSpan dirtiedEffectiveColumns(const LayoutRect& visualRect) const; |
| 314 |
| 305 const HashSet<LayoutTableCell*>& overflowingCells() const { | 315 const HashSet<LayoutTableCell*>& overflowingCells() const { |
| 306 return m_overflowingCells; | 316 return m_overflowingCells; |
| 307 } | 317 } |
| 308 bool hasMultipleCellLevels() const { return m_hasMultipleCellLevels; } | 318 bool hasMultipleCellLevels() const { return m_hasMultipleCellLevels; } |
| 309 | 319 |
| 310 const char* name() const override { return "LayoutTableSection"; } | 320 const char* name() const override { return "LayoutTableSection"; } |
| 311 | 321 |
| 312 // Whether a section has opaque background depends on many factors, e.g. | 322 // Whether a section has opaque background depends on many factors, e.g. |
| 313 // border spacing, border collapsing, missing cells, etc. For simplicity, | 323 // border spacing, border collapsing, missing cells, etc. For simplicity, |
| 314 // just conservatively assume all table sections are not opaque. | 324 // just conservatively assume all table sections are not opaque. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 // memory. | 478 // memory. |
| 469 HashSet<LayoutTableCell*> m_overflowingCells; | 479 HashSet<LayoutTableCell*> m_overflowingCells; |
| 470 bool m_forceSlowPaintPathWithOverflowingCell; | 480 bool m_forceSlowPaintPathWithOverflowingCell; |
| 471 | 481 |
| 472 // This boolean tracks if we have cells overlapping due to rowspan / colspan | 482 // This boolean tracks if we have cells overlapping due to rowspan / colspan |
| 473 // (see class comment above about when it could appear). | 483 // (see class comment above about when it could appear). |
| 474 // | 484 // |
| 475 // The use is to disable a painting optimization where we just paint the | 485 // The use is to disable a painting optimization where we just paint the |
| 476 // invalidated cells. | 486 // invalidated cells. |
| 477 bool m_hasMultipleCellLevels; | 487 bool m_hasMultipleCellLevels; |
| 488 |
| 489 // Whether any cell spans multiple rows or cols. |
| 490 bool m_hasSpanningCells; |
| 478 }; | 491 }; |
| 479 | 492 |
| 480 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection()); | 493 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection()); |
| 481 | 494 |
| 482 } // namespace blink | 495 } // namespace blink |
| 483 | 496 |
| 484 #endif // LayoutTableSection_h | 497 #endif // LayoutTableSection_h |
| OLD | NEW |