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

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

Issue 1584903002: Improvement handling of background and outline paint phases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PaintPhaseRename
Patch Set: Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/TableRowPainter.h" 5 #include "core/paint/TableRowPainter.h"
6 6
7 #include "core/layout/LayoutTableCell.h" 7 #include "core/layout/LayoutTableCell.h"
8 #include "core/layout/LayoutTableRow.h" 8 #include "core/layout/LayoutTableRow.h"
9 #include "core/paint/LayoutObjectDrawingRecorder.h" 9 #include "core/paint/LayoutObjectDrawingRecorder.h"
10 #include "core/paint/ObjectPainter.h" 10 #include "core/paint/ObjectPainter.h"
11 #include "core/paint/PaintInfo.h" 11 #include "core/paint/PaintInfo.h"
12 #include "core/paint/TableCellPainter.h" 12 #include "core/paint/TableCellPainter.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 void TableRowPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paint Offset) 16 void TableRowPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paint Offset)
17 { 17 {
18 ASSERT(m_layoutTableRow.hasSelfPaintingLayer()); 18 ASSERT(m_layoutTableRow.hasSelfPaintingLayer());
19 19
20 // Table rows don't paint self background. The cells paint table section's b ackground
21 // behind them when needed during PaintPhaseBlockBackground or PaintPhaseDes cendantBlockBackgroundOnly.
22 if (paintInfo.phase == PaintPhaseSelfBlockBackgroundOnly)
23 return;
24
25 // TODO(wangxianzhu): This painting order is inconsistent with other outline s. crbug.com/577282.
20 paintOutlineForRowIfNeeded(paintInfo, paintOffset); 26 paintOutlineForRowIfNeeded(paintInfo, paintOffset);
27 if (paintInfo.phase == PaintPhaseSelfOutlineOnly)
28 return;
29
30 PaintInfo paintInfoForCells = paintInfo.forDescendants();
21 for (LayoutTableCell* cell = m_layoutTableRow.firstCell(); cell; cell = cell ->nextCell()) { 31 for (LayoutTableCell* cell = m_layoutTableRow.firstCell(); cell; cell = cell ->nextCell()) {
22 // Paint the row background behind the cell. 32 // Paint the row background behind the cell.
23 if (paintInfo.phase == PaintPhaseSelfBlockBackground || paintInfo.phase == PaintPhaseBlockBackground) { 33 if (shouldPaintSelfBlockBackground(paintInfoForCells.phase)) {
24 if (m_layoutTableRow.hasBackground()) 34 if (m_layoutTableRow.hasBackground())
25 TableCellPainter(*cell).paintBackgroundsBehindCell(paintInfo, pa intOffset, &m_layoutTableRow, DisplayItem::TableCellBackgroundFromRow); 35 TableCellPainter(*cell).paintBackgroundsBehindCell(paintInfoForC ells, paintOffset, &m_layoutTableRow, DisplayItem::TableCellBackgroundFromRow);
26 } 36 }
27 37
28 if (!cell->hasSelfPaintingLayer()) 38 if (!cell->hasSelfPaintingLayer())
29 cell->paint(paintInfo, paintOffset); 39 cell->paint(paintInfoForCells, paintOffset);
30 } 40 }
31 } 41 }
32 42
33 void TableRowPainter::paintOutlineForRowIfNeeded(const PaintInfo& paintInfo, con st LayoutPoint& paintOffset) 43 void TableRowPainter::paintOutlineForRowIfNeeded(const PaintInfo& paintInfo, con st LayoutPoint& paintOffset)
34 { 44 {
35 PaintPhase paintPhase = paintInfo.phase; 45 PaintPhase paintPhase = paintInfo.phase;
36 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && m_layoutTableRow.style()->visibility() == VISIBLE) { 46 if (shouldPaintSelfOutline(paintPhase)) {
37 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableRow.locatio n(); 47 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableRow.locatio n();
38 ObjectPainter(m_layoutTableRow).paintOutline(paintInfo, adjustedPaintOff set); 48 ObjectPainter(m_layoutTableRow).paintOutline(paintInfo, adjustedPaintOff set);
39 } 49 }
40 } 50 }
41 51
42 } // namespace blink 52 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/TablePainter.cpp ('k') | third_party/WebKit/Source/core/paint/TableSectionPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698