| 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" |
| 11 #include "core/layout/LayoutTableSection.h" | 11 #include "core/layout/LayoutTableSection.h" |
| 12 #include "core/paint/BoxPaintInvalidator.h" | 12 #include "core/paint/BoxPaintInvalidator.h" |
| 13 #include "core/paint/PaintInvalidator.h" | 13 #include "core/paint/PaintInvalidator.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 PaintInvalidationReason TablePaintInvalidator::invalidatePaintIfNeeded() { | 17 PaintInvalidationReason TablePaintInvalidator::invalidatePaintIfNeeded() { |
| 18 PaintInvalidationReason reason = | 18 PaintInvalidationReason reason = |
| 19 BoxPaintInvalidator(m_table, m_context).invalidatePaintIfNeeded(); | 19 BoxPaintInvalidator(m_table, m_context).invalidatePaintIfNeeded(); |
| 20 | 20 |
| 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 bool visualRectChanged = m_context.oldVisualRect != m_context.newVisualRect; | 29 bool visualRectChanged = m_context.oldVisualRect != m_table.visualRect(); |
| 30 for (LayoutTableCol* col = m_table.firstColumn(); col; | 30 for (LayoutTableCol* col = m_table.firstColumn(); col; |
| 31 col = col->nextColumn()) { | 31 col = col->nextColumn()) { |
| 32 // LayoutTableCol uses the table's localVisualRect(). Should check column | 32 // LayoutTableCol uses the table's localVisualRect(). Should check column |
| 33 // for paint invalidation when table's visual rect changed. | 33 // for paint invalidation when table's visual rect changed. |
| 34 if (visualRectChanged) | 34 if (visualRectChanged) |
| 35 col->setMayNeedPaintInvalidation(); | 35 col->setMayNeedPaintInvalidation(); |
| 36 // This ensures that the backgroundChangedSinceLastPaintInvalidation flag | 36 // This ensures that the backgroundChangedSinceLastPaintInvalidation flag |
| 37 // is up-to-date. | 37 // is up-to-date. |
| 38 col->ensureIsReadyForPaintInvalidation(); | 38 col->ensureIsReadyForPaintInvalidation(); |
| 39 if (col->backgroundChangedSinceLastPaintInvalidation()) { | 39 if (col->backgroundChangedSinceLastPaintInvalidation()) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 PaintInvalidationStyleChange); | 95 PaintInvalidationStyleChange); |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 return reason; | 101 return reason; |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |