OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/paint/CollapsedBorderPainter.h" | 5 #include "core/paint/CollapsedBorderPainter.h" |
6 | 6 |
7 #include "core/paint/BlockPainter.h" | 7 #include "core/paint/BlockPainter.h" |
8 #include "core/paint/ObjectPainter.h" | 8 #include "core/paint/ObjectPainter.h" |
9 #include "core/paint/PaintInfo.h" | 9 #include "core/paint/PaintInfo.h" |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 cell_preceding->RowSpan() >= cell_.RowSpan()) { | 79 cell_preceding->RowSpan() >= cell_.RowSpan()) { |
80 start_.value = nullptr; | 80 start_.value = nullptr; |
81 // Otherwise we'll still paint the shared border twice which may cause | 81 // Otherwise we'll still paint the shared border twice which may cause |
82 // incorrect border conflict resolution for row/col spanning cells. | 82 // incorrect border conflict resolution for row/col spanning cells. |
83 // TODO(crbug.com/2902 etc.): Paint collapsed borders by grid cells. | 83 // TODO(crbug.com/2902 etc.): Paint collapsed borders by grid cells. |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 // Skip painting the before border if it will be painted by the above cell | 87 // Skip painting the before border if it will be painted by the above cell |
88 // as its after border. If we break page before the row with non-zero strut | 88 // as its after border. If we break page before the row with non-zero strut |
89 // (which means a gap between this row and the row above), we need to paint | 89 // (which means a gap between this row and the row above), or if we are |
| 90 // painting the top row of a footer that repeats on each page we need to paint |
90 // the before border separately. | 91 // the before border separately. |
| 92 // TODO(crbug.com/751177) : This will double-paint the top border of the |
| 93 // footer on the last page. |
91 if (before_.value && !cell_.Row()->PaginationStrut()) { | 94 if (before_.value && !cell_.Row()->PaginationStrut()) { |
92 const auto* cell_above = table_.CellAbove(cell_); | 95 const auto* cell_above = table_.CellAbove(cell_); |
93 if (cell_.StartsAtSameColumn(cell_above) && | 96 if (cell_.StartsAtSameColumn(cell_above) && |
94 cell_above->ColSpan() >= cell_.ColSpan() && | 97 cell_above->ColSpan() >= cell_.ColSpan() && |
95 cell_above->Row()->HasSameDirectionAs(&table_)) { | 98 cell_above->Row()->HasSameDirectionAs(&table_)) { |
96 before_.value = nullptr; | 99 bool cell_is_top_of_repeating_footer = |
| 100 cell_.Section()->IsRepeatingFooterGroup() && |
| 101 (!cell_above || cell_above->Section() != cell_.Section()); |
| 102 if (!cell_is_top_of_repeating_footer) |
| 103 before_.value = nullptr; |
97 // Otherwise we'll still paint the shared border twice which may cause | 104 // Otherwise we'll still paint the shared border twice which may cause |
98 // incorrect border conflict resolution for row/col spanning cells. | 105 // incorrect border conflict resolution for row/col spanning cells. |
99 // TODO(crbug.com/2902 etc.): Paint collapsed borders by grid cells. | 106 // TODO(crbug.com/2902 etc.): Paint collapsed borders by grid cells. |
100 } | 107 } |
101 } | 108 } |
102 } | 109 } |
103 | 110 |
104 static const CollapsedBorderValues* GetCollapsedBorderValues( | 111 static const CollapsedBorderValues* GetCollapsedBorderValues( |
105 const LayoutTableCell* cell) { | 112 const LayoutTableCell* cell) { |
106 return cell ? cell->GetCollapsedBorderValues() : nullptr; | 113 return cell ? cell->GetCollapsedBorderValues() : nullptr; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 if (end_.value) { | 378 if (end_.value) { |
372 ObjectPainter::DrawLineForBoxSide( | 379 ObjectPainter::DrawLineForBoxSide( |
373 context, rect.MaxX() - end_.inner_width, rect.Y() - end_.begin_outset, | 380 context, rect.MaxX() - end_.inner_width, rect.Y() - end_.begin_outset, |
374 rect.MaxX() + end_.outer_width, rect.MaxY() + end_.end_outset, kBSRight, | 381 rect.MaxX() + end_.outer_width, rect.MaxY() + end_.end_outset, kBSRight, |
375 end_.value->GetColor(), CollapsedBorderStyle(end_.value->Style()), 0, 0, | 382 end_.value->GetColor(), CollapsedBorderStyle(end_.value->Style()), 0, 0, |
376 true); | 383 true); |
377 } | 384 } |
378 } | 385 } |
379 | 386 |
380 } // namespace blink | 387 } // namespace blink |
OLD | NEW |