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, 2010 Apple Inc. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // 'border-spacing' property represent spacing between columns and rows | 142 // 'border-spacing' property represent spacing between columns and rows |
143 // respectively, not necessarily the horizontal and vertical spacing | 143 // respectively, not necessarily the horizontal and vertical spacing |
144 // respectively". | 144 // respectively". |
145 int HBorderSpacing() const { return h_spacing_; } | 145 int HBorderSpacing() const { return h_spacing_; } |
146 int VBorderSpacing() const { return v_spacing_; } | 146 int VBorderSpacing() const { return v_spacing_; } |
147 | 147 |
148 bool ShouldCollapseBorders() const { | 148 bool ShouldCollapseBorders() const { |
149 return Style()->BorderCollapse() == EBorderCollapse::kCollapse; | 149 return Style()->BorderCollapse() == EBorderCollapse::kCollapse; |
150 } | 150 } |
151 | 151 |
152 LayoutUnit BorderStart() const override { return LayoutUnit(border_start_); } | 152 LayoutUnit BorderStart() const override; |
153 LayoutUnit BorderEnd() const override { return LayoutUnit(border_end_); } | 153 LayoutUnit BorderEnd() const override; |
154 LayoutUnit BorderBefore() const override; | 154 LayoutUnit BorderBefore() const override; |
155 LayoutUnit BorderAfter() const override; | 155 LayoutUnit BorderAfter() const override; |
156 | 156 |
157 LayoutUnit BorderLeft() const override { | 157 LayoutUnit BorderLeft() const override { |
158 if (Style()->IsHorizontalWritingMode()) | 158 if (Style()->IsHorizontalWritingMode()) |
159 return Style()->IsLeftToRightDirection() ? BorderStart() : BorderEnd(); | 159 return Style()->IsLeftToRightDirection() ? BorderStart() : BorderEnd(); |
160 return Style()->IsFlippedBlocksWritingMode() ? BorderAfter() | 160 return Style()->IsFlippedBlocksWritingMode() ? BorderAfter() |
161 : BorderBefore(); | 161 : BorderBefore(); |
162 } | 162 } |
163 | 163 |
(...skipping 11 matching lines...) Expand all Loading... |
175 return Style()->IsLeftToRightDirection() ? BorderStart() : BorderEnd(); | 175 return Style()->IsLeftToRightDirection() ? BorderStart() : BorderEnd(); |
176 } | 176 } |
177 | 177 |
178 LayoutUnit BorderBottom() const override { | 178 LayoutUnit BorderBottom() const override { |
179 if (Style()->IsHorizontalWritingMode()) | 179 if (Style()->IsHorizontalWritingMode()) |
180 return Style()->IsFlippedBlocksWritingMode() ? BorderBefore() | 180 return Style()->IsFlippedBlocksWritingMode() ? BorderBefore() |
181 : BorderAfter(); | 181 : BorderAfter(); |
182 return Style()->IsLeftToRightDirection() ? BorderEnd() : BorderStart(); | 182 return Style()->IsLeftToRightDirection() ? BorderEnd() : BorderStart(); |
183 } | 183 } |
184 | 184 |
185 int OuterBorderBefore() const; | |
186 int OuterBorderAfter() const; | |
187 int OuterBorderStart() const; | |
188 int OuterBorderEnd() const; | |
189 | |
190 int OuterBorderLeft() const { | |
191 if (Style()->IsHorizontalWritingMode()) | |
192 return Style()->IsLeftToRightDirection() ? OuterBorderStart() | |
193 : OuterBorderEnd(); | |
194 return Style()->IsFlippedBlocksWritingMode() ? OuterBorderAfter() | |
195 : OuterBorderBefore(); | |
196 } | |
197 | |
198 int OuterBorderRight() const { | |
199 if (Style()->IsHorizontalWritingMode()) | |
200 return Style()->IsLeftToRightDirection() ? OuterBorderEnd() | |
201 : OuterBorderStart(); | |
202 return Style()->IsFlippedBlocksWritingMode() ? OuterBorderBefore() | |
203 : OuterBorderAfter(); | |
204 } | |
205 | |
206 int OuterBorderTop() const { | |
207 if (Style()->IsHorizontalWritingMode()) | |
208 return Style()->IsFlippedBlocksWritingMode() ? OuterBorderAfter() | |
209 : OuterBorderBefore(); | |
210 return Style()->IsLeftToRightDirection() ? OuterBorderStart() | |
211 : OuterBorderEnd(); | |
212 } | |
213 | |
214 int OuterBorderBottom() const { | |
215 if (Style()->IsHorizontalWritingMode()) | |
216 return Style()->IsFlippedBlocksWritingMode() ? OuterBorderBefore() | |
217 : OuterBorderAfter(); | |
218 return Style()->IsLeftToRightDirection() ? OuterBorderEnd() | |
219 : OuterBorderStart(); | |
220 } | |
221 | |
222 int CalcBorderStart() const; | |
223 int CalcBorderEnd() const; | |
224 void RecalcBordersInRowDirection(); | |
225 | |
226 void AddChild(LayoutObject* child, | 185 void AddChild(LayoutObject* child, |
227 LayoutObject* before_child = nullptr) override; | 186 LayoutObject* before_child = nullptr) override; |
228 | 187 |
229 struct ColumnStruct { | 188 struct ColumnStruct { |
230 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 189 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
231 explicit ColumnStruct(unsigned initial_span = 1) : span(initial_span) {} | 190 explicit ColumnStruct(unsigned initial_span = 1) : span(initial_span) {} |
232 | 191 |
233 unsigned span; | 192 unsigned span; |
234 }; | 193 }; |
235 | 194 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 return first_body_; | 226 return first_body_; |
268 } | 227 } |
269 | 228 |
270 void SetRowOffsetFromRepeatingHeader(LayoutUnit offset) { | 229 void SetRowOffsetFromRepeatingHeader(LayoutUnit offset) { |
271 row_offset_from_repeating_header_ = offset; | 230 row_offset_from_repeating_header_ = offset; |
272 } | 231 } |
273 LayoutUnit RowOffsetFromRepeatingHeader() const { | 232 LayoutUnit RowOffsetFromRepeatingHeader() const { |
274 return row_offset_from_repeating_header_; | 233 return row_offset_from_repeating_header_; |
275 } | 234 } |
276 | 235 |
277 // This function returns 0 if the table has no section. | 236 // These functions return nullptr if the table has no section. |
278 LayoutTableSection* TopSection() const; | 237 LayoutTableSection* TopSection() const; |
279 LayoutTableSection* BottomSection() const; | 238 LayoutTableSection* BottomSection() const; |
280 | 239 |
281 // This function returns 0 if the table has no non-empty sections. | 240 // These functions returns null if the table has no non-empty sections. |
282 LayoutTableSection* TopNonEmptySection() const; | 241 LayoutTableSection* TopNonEmptySection() const; |
| 242 LayoutTableSection* BottomNonEmptySection() const; |
283 | 243 |
284 unsigned LastEffectiveColumnIndex() const { | 244 unsigned LastEffectiveColumnIndex() const { |
285 return NumEffectiveColumns() - 1; | 245 return NumEffectiveColumns() - 1; |
286 } | 246 } |
287 | 247 |
288 void SplitEffectiveColumn(unsigned index, unsigned first_span); | 248 void SplitEffectiveColumn(unsigned index, unsigned first_span); |
289 void AppendEffectiveColumn(unsigned span); | 249 void AppendEffectiveColumn(unsigned span); |
290 unsigned NumEffectiveColumns() const { return effective_columns_.size(); } | 250 unsigned NumEffectiveColumns() const { return effective_columns_.size(); } |
291 unsigned SpanOfEffectiveColumn(unsigned effective_column_index) const { | 251 unsigned SpanOfEffectiveColumn(unsigned effective_column_index) const { |
292 return effective_columns_[effective_column_index].span; | 252 return effective_columns_[effective_column_index].span; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 const Length& style_logical_height) const; | 474 const Length& style_logical_height) const; |
515 | 475 |
516 LayoutRect OverflowClipRect( | 476 LayoutRect OverflowClipRect( |
517 const LayoutPoint& location, | 477 const LayoutPoint& location, |
518 OverlayScrollbarClipBehavior = | 478 OverlayScrollbarClipBehavior = |
519 kIgnorePlatformOverlayScrollbarSize) const override; | 479 kIgnorePlatformOverlayScrollbarSize) const override; |
520 | 480 |
521 void AddOverflowFromChildren() override; | 481 void AddOverflowFromChildren() override; |
522 | 482 |
523 void RecalcSections() const; | 483 void RecalcSections() const; |
| 484 |
| 485 void UpdateCollapsedOuterBorders() const; |
| 486 unsigned ComputeCollapsedOuterBorderBefore() const; |
| 487 unsigned ComputeCollapsedOuterBorderAfter() const; |
| 488 unsigned ComputeCollapsedOuterBorderStart() const; |
| 489 unsigned ComputeCollapsedOuterBorderEnd() const; |
| 490 |
524 void LayoutCaption(LayoutTableCaption&, SubtreeLayoutScope&); | 491 void LayoutCaption(LayoutTableCaption&, SubtreeLayoutScope&); |
525 void LayoutSection(LayoutTableSection&, | 492 void LayoutSection(LayoutTableSection&, |
526 SubtreeLayoutScope&, | 493 SubtreeLayoutScope&, |
527 LayoutUnit logical_left, | 494 LayoutUnit logical_left, |
528 TableHeightChangingValue); | 495 TableHeightChangingValue); |
529 | 496 |
530 // Return the logical height based on the height, min-height and max-height | 497 // Return the logical height based on the height, min-height and max-height |
531 // properties from CSS. Will return 0 if auto. | 498 // properties from CSS. Will return 0 if auto. |
532 LayoutUnit LogicalHeightFromStyle() const; | 499 LayoutUnit LogicalHeightFromStyle() const; |
533 | 500 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 | 548 |
582 // A sorted list of all unique border values that we want to paint. | 549 // A sorted list of all unique border values that we want to paint. |
583 // | 550 // |
584 // Collapsed borders are SUPER EXPENSIVE to compute. The reason is that we | 551 // Collapsed borders are SUPER EXPENSIVE to compute. The reason is that we |
585 // need to compare a cells border against all the adjoining cells, rows, | 552 // need to compare a cells border against all the adjoining cells, rows, |
586 // row groups, column, column groups and table. Thus we cache them in this | 553 // row groups, column, column groups and table. Thus we cache them in this |
587 // field. | 554 // field. |
588 CollapsedBorderValues collapsed_borders_; | 555 CollapsedBorderValues collapsed_borders_; |
589 bool collapsed_borders_valid_ : 1; | 556 bool collapsed_borders_valid_ : 1; |
590 bool needs_invalidate_collapsed_borders_for_all_cells_ : 1; | 557 bool needs_invalidate_collapsed_borders_for_all_cells_ : 1; |
| 558 mutable bool collapsed_outer_borders_valid_ : 1; |
591 | 559 |
592 mutable bool has_col_elements_ : 1; | 560 mutable bool has_col_elements_ : 1; |
593 mutable bool needs_section_recalc_ : 1; | 561 mutable bool needs_section_recalc_ : 1; |
594 | 562 |
595 bool column_logical_width_changed_ : 1; | 563 bool column_logical_width_changed_ : 1; |
596 mutable bool column_layout_objects_valid_ : 1; | 564 mutable bool column_layout_objects_valid_ : 1; |
597 mutable unsigned no_cell_colspan_at_least_; | 565 mutable unsigned no_cell_colspan_at_least_; |
598 unsigned CalcNoCellColspanAtLeast() const { | 566 unsigned CalcNoCellColspanAtLeast() const { |
599 for (unsigned c = 0; c < NumEffectiveColumns(); c++) { | 567 for (unsigned c = 0; c < NumEffectiveColumns(); c++) { |
600 if (effective_columns_[c].span > 1) | 568 if (effective_columns_[c].span > 1) |
601 return c; | 569 return c; |
602 } | 570 } |
603 return NumEffectiveColumns(); | 571 return NumEffectiveColumns(); |
604 } | 572 } |
605 | 573 |
606 short h_spacing_; | 574 short h_spacing_; |
607 short v_spacing_; | 575 short v_spacing_; |
608 int border_start_; | 576 |
609 int border_end_; | 577 mutable unsigned collapsed_outer_border_start_; |
| 578 mutable unsigned collapsed_outer_border_end_; |
| 579 mutable unsigned collapsed_outer_border_before_; |
| 580 mutable unsigned collapsed_outer_border_after_; |
610 | 581 |
611 LayoutUnit block_offset_to_first_repeatable_header_; | 582 LayoutUnit block_offset_to_first_repeatable_header_; |
612 LayoutUnit row_offset_from_repeating_header_; | 583 LayoutUnit row_offset_from_repeating_header_; |
613 LayoutUnit old_available_logical_height_; | 584 LayoutUnit old_available_logical_height_; |
614 }; | 585 }; |
615 | 586 |
616 inline LayoutTableSection* LayoutTable::TopSection() const { | 587 inline LayoutTableSection* LayoutTable::TopSection() const { |
617 DCHECK(!NeedsSectionRecalc()); | 588 DCHECK(!NeedsSectionRecalc()); |
618 if (head_) | 589 if (head_) |
619 return head_; | 590 return head_; |
620 if (first_body_) | 591 if (first_body_) |
621 return first_body_; | 592 return first_body_; |
622 return foot_; | 593 return foot_; |
623 } | 594 } |
624 | 595 |
625 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, IsTable()); | 596 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, IsTable()); |
626 | 597 |
627 } // namespace blink | 598 } // namespace blink |
628 | 599 |
629 #endif // LayoutTable_h | 600 #endif // LayoutTable_h |
OLD | NEW |