| 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, 2009, 2013 Apple Inc. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2013 Apple Inc. |
| 8 * All rights reserved. | 8 * All rights 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // Called from HTMLTableCellElement. | 102 // Called from HTMLTableCellElement. |
| 103 void ColSpanOrRowSpanChanged(); | 103 void ColSpanOrRowSpanChanged(); |
| 104 | 104 |
| 105 void SetAbsoluteColumnIndex(unsigned column) { | 105 void SetAbsoluteColumnIndex(unsigned column) { |
| 106 if (UNLIKELY(column > kMaxColumnIndex)) | 106 if (UNLIKELY(column > kMaxColumnIndex)) |
| 107 CRASH(); | 107 CRASH(); |
| 108 | 108 |
| 109 absolute_column_index_ = column; | 109 absolute_column_index_ = column; |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool HasSetAbsoluteColumnIndex() const { | 112 // See LayoutTable.h for definition of absolute and effective columns. |
| 113 return absolute_column_index_ != kUnsetColumnIndex; | 113 // In most cases we should use EffectiveColumnIndex() instead of |
| 114 // AbsolutColumnIndex(). |
| 115 unsigned AbsoluteColumnIndex() const { return absolute_column_index_; } |
| 116 unsigned EffectiveColumnIndex() const { |
| 117 DCHECK_NE(absolute_column_index_, kUnsetColumnIndex); |
| 118 return Table()->AbsoluteColumnToEffectiveColumn(absolute_column_index_); |
| 114 } | 119 } |
| 115 | 120 // Returns effective column index, of the cell after this cell, or of the |
| 116 unsigned AbsoluteColumnIndex() const { | 121 // imaginary cell after this cell if there is no cell after this cell. |
| 117 DCHECK(HasSetAbsoluteColumnIndex()); | 122 unsigned EffectiveColumnIndexOfCellAfter() const { |
| 118 return absolute_column_index_; | 123 return Table()->AbsoluteColumnToEffectiveColumn(absolute_column_index_ + |
| 124 ColSpan()); |
| 119 } | 125 } |
| 120 | 126 |
| 121 LayoutTableRow* Row() const { return ToLayoutTableRow(Parent()); } | 127 LayoutTableRow* Row() const { return ToLayoutTableRow(Parent()); } |
| 122 LayoutTableSection* Section() const { | 128 LayoutTableSection* Section() const { |
| 123 return ToLayoutTableSection(Parent()->Parent()); | 129 return ToLayoutTableSection(Parent()->Parent()); |
| 124 } | 130 } |
| 125 LayoutTable* Table() const { | 131 LayoutTable* Table() const { |
| 126 return ToLayoutTable(Parent()->Parent()->Parent()); | 132 return ToLayoutTable(Parent()->Parent()->Parent()); |
| 127 } | 133 } |
| 134 LayoutTable::ColAndColGroup GetColAndColGroup() const { |
| 135 return Table()->ColAndColGroupAtEffectiveColumn(EffectiveColumnIndex()); |
| 136 } |
| 128 | 137 |
| 129 LayoutTableCell* PreviousCell() const; | 138 LayoutTableCell* PreviousCell() const; |
| 130 LayoutTableCell* NextCell() const; | 139 LayoutTableCell* NextCell() const; |
| 131 | 140 |
| 132 unsigned RowIndex() const { | 141 unsigned RowIndex() const { |
| 133 // This function shouldn't be called on a detached cell. | 142 // This function shouldn't be called on a detached cell. |
| 134 DCHECK(Row()); | 143 DCHECK(Row()); |
| 135 return Row()->RowIndex(); | 144 return Row()->RowIndex(); |
| 136 } | 145 } |
| 137 | 146 |
| 138 Length StyleOrColLogicalWidth() const { | 147 Length StyleOrColLogicalWidth() const { |
| 139 Length style_width = Style()->LogicalWidth(); | 148 Length style_width = Style()->LogicalWidth(); |
| 140 if (!style_width.IsAuto()) | 149 if (!style_width.IsAuto()) |
| 141 return style_width; | 150 return style_width; |
| 142 if (LayoutTableCol* first_column = | 151 if (LayoutTableCol* first_column = |
| 143 Table() | 152 GetColAndColGroup().InnermostColOrColGroup()) |
| 144 ->ColElementAtAbsoluteColumn(AbsoluteColumnIndex()) | |
| 145 .InnermostColOrColGroup()) | |
| 146 return LogicalWidthFromColumns(first_column, style_width); | 153 return LogicalWidthFromColumns(first_column, style_width); |
| 147 return style_width; | 154 return style_width; |
| 148 } | 155 } |
| 149 | 156 |
| 150 int LogicalHeightFromStyle() const { | 157 int LogicalHeightFromStyle() const { |
| 151 Length height = Style()->LogicalHeight(); | 158 Length height = Style()->LogicalHeight(); |
| 152 int style_logical_height = | 159 int style_logical_height = |
| 153 height.IsIntrinsicOrAuto() | 160 height.IsIntrinsicOrAuto() |
| 154 ? 0 | 161 ? 0 |
| 155 : ValueForLength(height, LayoutUnit()).ToInt(); | 162 : ValueForLength(height, LayoutUnit()).ToInt(); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 368 |
| 362 void AddLayerHitTestRects(LayerHitTestRects&, | 369 void AddLayerHitTestRects(LayerHitTestRects&, |
| 363 const PaintLayer* current_composited_layer, | 370 const PaintLayer* current_composited_layer, |
| 364 const LayoutPoint& layer_offset, | 371 const LayoutPoint& layer_offset, |
| 365 const LayoutRect& container_rect) const override; | 372 const LayoutRect& container_rect) const override; |
| 366 | 373 |
| 367 PaintInvalidationReason InvalidatePaint( | 374 PaintInvalidationReason InvalidatePaint( |
| 368 const PaintInvalidatorContext&) const override; | 375 const PaintInvalidatorContext&) const override; |
| 369 | 376 |
| 370 private: | 377 private: |
| 378 friend class LayoutTableCellDeathTest; |
| 371 friend class LayoutTableCellTest; | 379 friend class LayoutTableCellTest; |
| 372 | 380 |
| 373 bool IsOfType(LayoutObjectType type) const override { | 381 bool IsOfType(LayoutObjectType type) const override { |
| 374 return type == kLayoutObjectTableCell || LayoutBlockFlow::IsOfType(type); | 382 return type == kLayoutObjectTableCell || LayoutBlockFlow::IsOfType(type); |
| 375 } | 383 } |
| 376 | 384 |
| 377 void WillBeRemovedFromTree() override; | 385 void WillBeRemovedFromTree() override; |
| 378 | 386 |
| 379 void UpdateLogicalWidth() override; | 387 void UpdateLogicalWidth() override; |
| 380 | 388 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 return ToLayoutTableCell(FirstChild()); | 494 return ToLayoutTableCell(FirstChild()); |
| 487 } | 495 } |
| 488 | 496 |
| 489 inline LayoutTableCell* LayoutTableRow::LastCell() const { | 497 inline LayoutTableCell* LayoutTableRow::LastCell() const { |
| 490 return ToLayoutTableCell(LastChild()); | 498 return ToLayoutTableCell(LastChild()); |
| 491 } | 499 } |
| 492 | 500 |
| 493 } // namespace blink | 501 } // namespace blink |
| 494 | 502 |
| 495 #endif // LayoutTableCell_h | 503 #endif // LayoutTableCell_h |
| OLD | NEW |