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/TableCellPaintInvalidator.h" | 5 #include "core/paint/TableCellPaintInvalidator.h" |
6 | 6 |
7 #include "core/layout/LayoutTable.h" | 7 #include "core/layout/LayoutTable.h" |
8 #include "core/layout/LayoutTableCell.h" | 8 #include "core/layout/LayoutTableCell.h" |
9 #include "core/layout/LayoutTableCol.h" | 9 #include "core/layout/LayoutTableCol.h" |
10 #include "core/layout/LayoutTableRow.h" | 10 #include "core/layout/LayoutTableRow.h" |
11 #include "core/layout/LayoutTableSection.h" | 11 #include "core/layout/LayoutTableSection.h" |
12 #include "core/paint/BlockPaintInvalidator.h" | 12 #include "core/paint/BlockPaintInvalidator.h" |
13 #include "core/paint/ObjectPaintInvalidator.h" | 13 #include "core/paint/ObjectPaintInvalidator.h" |
14 #include "core/paint/PaintInvalidator.h" | 14 #include "core/paint/PaintInvalidator.h" |
15 #include "core/paint/PaintLayer.h" | 15 #include "core/paint/PaintLayer.h" |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 PaintInvalidationReason TableCellPaintInvalidator::InvalidatePaint() { | 19 PaintInvalidationReason TableCellPaintInvalidator::InvalidatePaint() { |
20 // The cell's containing row and section paint backgrounds behind the cell. | 20 // The cell's containing row and section paint backgrounds behind the cell. |
21 // If the cell's geometry changed, invalidate the background display items. | 21 // If the cell's geometry changed, invalidate the background display items. |
22 if (context_.old_location != context_.new_location || | 22 if (context_.old_location != context_.new_location || |
23 cell_.Size() != cell_.PreviousSize()) { | 23 cell_.Size() != cell_.PreviousSize()) { |
24 const auto& row = *cell_.Row(); | 24 const auto& row = *cell_.Row(); |
25 if (row.GetPaintInvalidationReason() == kPaintInvalidationNone && | 25 if (row.GetPaintInvalidationReason() == PaintInvalidationReason::kNone && |
26 row.StyleRef().HasBackground()) { | 26 row.StyleRef().HasBackground()) { |
27 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) | 27 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
28 context_.parent_context->painting_layer->SetNeedsRepaint(); | 28 context_.parent_context->painting_layer->SetNeedsRepaint(); |
29 else | 29 else |
30 ObjectPaintInvalidator(row).SlowSetPaintingLayerNeedsRepaint(); | 30 ObjectPaintInvalidator(row).SlowSetPaintingLayerNeedsRepaint(); |
31 row.InvalidateDisplayItemClients(kPaintInvalidationForcedByLayout); | 31 row.InvalidateDisplayItemClients(PaintInvalidationReason::kGeometry); |
32 } | 32 } |
33 | 33 |
34 const auto& section = *row.Section(); | 34 const auto& section = *row.Section(); |
35 if (section.GetPaintInvalidationReason() == kPaintInvalidationNone) { | 35 if (section.GetPaintInvalidationReason() == |
| 36 PaintInvalidationReason::kNone) { |
36 bool section_paints_background = section.StyleRef().HasBackground(); | 37 bool section_paints_background = section.StyleRef().HasBackground(); |
37 if (!section_paints_background) { | 38 if (!section_paints_background) { |
38 auto col_and_colgroup = section.Table()->ColElementAtAbsoluteColumn( | 39 auto col_and_colgroup = section.Table()->ColElementAtAbsoluteColumn( |
39 cell_.AbsoluteColumnIndex()); | 40 cell_.AbsoluteColumnIndex()); |
40 if ((col_and_colgroup.col && | 41 if ((col_and_colgroup.col && |
41 col_and_colgroup.col->StyleRef().HasBackground()) || | 42 col_and_colgroup.col->StyleRef().HasBackground()) || |
42 (col_and_colgroup.colgroup && | 43 (col_and_colgroup.colgroup && |
43 col_and_colgroup.colgroup->StyleRef().HasBackground())) | 44 col_and_colgroup.colgroup->StyleRef().HasBackground())) |
44 section_paints_background = true; | 45 section_paints_background = true; |
45 } | 46 } |
46 if (section_paints_background) { | 47 if (section_paints_background) { |
47 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { | 48 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { |
48 context_.parent_context->parent_context->painting_layer | 49 context_.parent_context->parent_context->painting_layer |
49 ->SetNeedsRepaint(); | 50 ->SetNeedsRepaint(); |
50 } else { | 51 } else { |
51 ObjectPaintInvalidator(section).SlowSetPaintingLayerNeedsRepaint(); | 52 ObjectPaintInvalidator(section).SlowSetPaintingLayerNeedsRepaint(); |
52 } | 53 } |
53 section.InvalidateDisplayItemClients(kPaintInvalidationForcedByLayout); | 54 section.InvalidateDisplayItemClients( |
| 55 PaintInvalidationReason::kGeometry); |
54 } | 56 } |
55 } | 57 } |
56 } | 58 } |
57 | 59 |
58 return BlockPaintInvalidator(cell_).InvalidatePaint(context_); | 60 return BlockPaintInvalidator(cell_).InvalidatePaint(context_); |
59 } | 61 } |
60 | 62 |
61 } // namespace blink | 63 } // namespace blink |
OLD | NEW |