Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/WebKit/Source/core/paint/TablePaintInvalidator.cpp

Issue 2392443009: reflow comments in core/paint (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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, sect ion and row. 21 // Table cells paint background from the containing column group, column,
22 // If background of any of them changed, we need to invalidate all affected ce lls. 22 // section and row. If background of any of them changed, we need to
23 // Here use shouldDoFullPaintInvalidation() as a broader condition of backgrou nd change. 23 // invalidate all affected cells. Here use shouldDoFullPaintInvalidation() as
24 // a broader condition of background change.
24 25
25 // If any col changed background, we'll check all cells for background changes . 26 // If any col changed background, we'll check all cells for background
27 // changes.
26 bool hasColChangedBackground = false; 28 bool hasColChangedBackground = false;
27 for (LayoutTableCol* col = m_table.firstColumn(); col; 29 for (LayoutTableCol* col = m_table.firstColumn(); col;
28 col = col->nextColumn()) { 30 col = col->nextColumn()) {
29 if (col->backgroundChangedSinceLastPaintInvalidation()) { 31 if (col->backgroundChangedSinceLastPaintInvalidation()) {
30 hasColChangedBackground = true; 32 hasColChangedBackground = true;
31 break; 33 break;
32 } 34 }
33 } 35 }
34 for (LayoutObject* child = m_table.firstChild(); child; 36 for (LayoutObject* child = m_table.firstChild(); child;
35 child = child->nextSibling()) { 37 child = child->nextSibling()) {
36 if (!child->isTableSection()) 38 if (!child->isTableSection())
37 continue; 39 continue;
38 LayoutTableSection* section = toLayoutTableSection(child); 40 LayoutTableSection* section = toLayoutTableSection(child);
39 ObjectPaintInvalidator sectionInvalidator(*section); 41 ObjectPaintInvalidator sectionInvalidator(*section);
40 if (!hasColChangedBackground && 42 if (!hasColChangedBackground &&
41 !section 43 !section
42 ->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState ()) 44 ->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState ())
43 continue; 45 continue;
44 for (LayoutTableRow* row = section->firstRow(); row; row = row->nextRow()) { 46 for (LayoutTableRow* row = section->firstRow(); row; row = row->nextRow()) {
45 if (!hasColChangedBackground && 47 if (!hasColChangedBackground &&
46 !section->backgroundChangedSinceLastPaintInvalidation() && 48 !section->backgroundChangedSinceLastPaintInvalidation() &&
47 !row->backgroundChangedSinceLastPaintInvalidation()) 49 !row->backgroundChangedSinceLastPaintInvalidation())
48 continue; 50 continue;
49 for (LayoutTableCell* cell = row->firstCell(); cell; 51 for (LayoutTableCell* cell = row->firstCell(); cell;
50 cell = cell->nextCell()) { 52 cell = cell->nextCell()) {
51 bool invalidated = false; 53 bool invalidated = false;
52 // Table cells paint container's background on the container's backing i nstead of its own (if any), 54 // Table cells paint container's background on the container's backing
53 // so we must invalidate it by the containers. 55 // instead of its own (if any), so we must invalidate it by the
56 // containers.
54 if (section->backgroundChangedSinceLastPaintInvalidation()) { 57 if (section->backgroundChangedSinceLastPaintInvalidation()) {
55 sectionInvalidator 58 sectionInvalidator
56 .slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient( 59 .slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient(
57 *cell, PaintInvalidationStyleChange); 60 *cell, PaintInvalidationStyleChange);
58 invalidated = true; 61 invalidated = true;
59 } else if (hasColChangedBackground) { 62 } else if (hasColChangedBackground) {
60 LayoutTable::ColAndColGroup colAndColGroup = 63 LayoutTable::ColAndColGroup colAndColGroup =
61 m_table.colElementAtAbsoluteColumn(cell->absoluteColumnIndex()); 64 m_table.colElementAtAbsoluteColumn(cell->absoluteColumnIndex());
62 LayoutTableCol* column = colAndColGroup.col; 65 LayoutTableCol* column = colAndColGroup.col;
63 LayoutTableCol* columnGroup = colAndColGroup.colgroup; 66 LayoutTableCol* columnGroup = colAndColGroup.colgroup;
(...skipping 13 matching lines...) Expand all
77 .slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient( 80 .slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient(
78 *cell, PaintInvalidationStyleChange); 81 *cell, PaintInvalidationStyleChange);
79 } 82 }
80 } 83 }
81 } 84 }
82 85
83 return reason; 86 return reason;
84 } 87 }
85 88
86 } // namespace blink 89 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/TableCellPainter.cpp ('k') | third_party/WebKit/Source/core/paint/TablePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698