| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/TablePaintInvalidator.h" | 5 #include "core/paint/TablePaintInvalidator.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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // Table cells paint background from the containing column group, column, | 21 // Table cells paint background from the containing column group, column, |
| 22 // section and row. If background of any of them changed, we need to | 22 // section and row. If background of any of them changed, we need to |
| 23 // invalidate all affected cells. Here use shouldDoFullPaintInvalidation() as | 23 // invalidate all affected cells. Here use shouldDoFullPaintInvalidation() as |
| 24 // a broader condition of background change. | 24 // a broader condition of background change. |
| 25 | 25 |
| 26 // If any col changed background, we'll check all cells for background | 26 // If any col changed background, we'll check all cells for background |
| 27 // changes. | 27 // changes. |
| 28 bool hasColChangedBackground = false; | 28 bool hasColChangedBackground = false; |
| 29 for (LayoutTableCol* col = m_table.firstColumn(); col; | 29 for (LayoutTableCol* col = m_table.firstColumn(); col; |
| 30 col = col->nextColumn()) { | 30 col = col->nextColumn()) { |
| 31 // This ensures that the backgroundChangedSinceLastPaintInvalidation flag |
| 32 // is up-to-date. |
| 33 col->ensureIsReadyForPaintInvalidation(); |
| 31 if (col->backgroundChangedSinceLastPaintInvalidation()) { | 34 if (col->backgroundChangedSinceLastPaintInvalidation()) { |
| 32 hasColChangedBackground = true; | 35 hasColChangedBackground = true; |
| 33 break; | 36 break; |
| 34 } | 37 } |
| 35 } | 38 } |
| 36 for (LayoutObject* child = m_table.firstChild(); child; | 39 for (LayoutObject* child = m_table.firstChild(); child; |
| 37 child = child->nextSibling()) { | 40 child = child->nextSibling()) { |
| 38 if (!child->isTableSection()) | 41 if (!child->isTableSection()) |
| 39 continue; | 42 continue; |
| 40 LayoutTableSection* section = toLayoutTableSection(child); | 43 LayoutTableSection* section = toLayoutTableSection(child); |
| 44 section->ensureIsReadyForPaintInvalidation(); |
| 41 ObjectPaintInvalidator sectionInvalidator(*section); | 45 ObjectPaintInvalidator sectionInvalidator(*section); |
| 42 if (!hasColChangedBackground && | 46 if (!hasColChangedBackground && |
| 43 !section | 47 !section |
| 44 ->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState
()) | 48 ->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState
()) |
| 45 continue; | 49 continue; |
| 46 for (LayoutTableRow* row = section->firstRow(); row; row = row->nextRow()) { | 50 for (LayoutTableRow* row = section->firstRow(); row; row = row->nextRow()) { |
| 51 row->ensureIsReadyForPaintInvalidation(); |
| 47 if (!hasColChangedBackground && | 52 if (!hasColChangedBackground && |
| 48 !section->backgroundChangedSinceLastPaintInvalidation() && | 53 !section->backgroundChangedSinceLastPaintInvalidation() && |
| 49 !row->backgroundChangedSinceLastPaintInvalidation()) | 54 !row->backgroundChangedSinceLastPaintInvalidation()) |
| 50 continue; | 55 continue; |
| 51 for (LayoutTableCell* cell = row->firstCell(); cell; | 56 for (LayoutTableCell* cell = row->firstCell(); cell; |
| 52 cell = cell->nextCell()) { | 57 cell = cell->nextCell()) { |
| 53 bool invalidated = false; | 58 bool invalidated = false; |
| 54 // Table cells paint container's background on the container's backing | 59 // Table cells paint container's background on the container's backing |
| 55 // instead of its own (if any), so we must invalidate it by the | 60 // instead of its own (if any), so we must invalidate it by the |
| 56 // containers. | 61 // containers. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 80 .slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient( | 85 .slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient( |
| 81 *cell, PaintInvalidationStyleChange); | 86 *cell, PaintInvalidationStyleChange); |
| 82 } | 87 } |
| 83 } | 88 } |
| 84 } | 89 } |
| 85 | 90 |
| 86 return reason; | 91 return reason; |
| 87 } | 92 } |
| 88 | 93 |
| 89 } // namespace blink | 94 } // namespace blink |
| OLD | NEW |