OLD | NEW |
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 // TODO(wangxianzhu): This painting order is inconsistent with other outline
s. crbug.com/577282. | 20 // TODO(wangxianzhu): This painting order is inconsistent with other outline
s. crbug.com/577282. |
21 paintOutlineForRowIfNeeded(paintInfo, paintOffset); | 21 paintOutlineForRowIfNeeded(paintInfo, paintOffset); |
22 if (paintInfo.phase == PaintPhaseSelfOutlineOnly) | 22 if (paintInfo.phase == PaintPhaseSelfOutlineOnly) |
23 return; | 23 return; |
24 | 24 |
25 PaintInfo paintInfoForCells = paintInfo.forDescendants(); | 25 PaintInfo paintInfoForCells = paintInfo.forDescendants(); |
26 bool shouldPaintRowBackground = shouldPaintSelfBlockBackground(paintInfo.pha
se) && m_layoutTableRow.hasBackground(); | 26 bool shouldPaintRowBackground = shouldPaintSelfBlockBackground(paintInfo.pha
se) && (m_layoutTableRow.hasBackground() || m_layoutTableRow.styleRef().hasBackd
ropFilter()); |
27 bool shouldPaintCells = paintInfo.phase != PaintPhaseSelfBlockBackgroundOnly
; | 27 bool shouldPaintCells = paintInfo.phase != PaintPhaseSelfBlockBackgroundOnly
; |
28 for (LayoutTableCell* cell = m_layoutTableRow.firstCell(); cell; cell = cell
->nextCell()) { | 28 for (LayoutTableCell* cell = m_layoutTableRow.firstCell(); cell; cell = cell
->nextCell()) { |
29 if (shouldPaintRowBackground) | 29 if (shouldPaintRowBackground) |
30 TableCellPainter(*cell).paintBackgroundsBehindCell(paintInfoForCells
, paintOffset, &m_layoutTableRow, DisplayItem::TableCellBackgroundFromRow); | 30 TableCellPainter(*cell).paintBackgroundsBehindCell(paintInfoForCells
, paintOffset, &m_layoutTableRow, DisplayItem::TableCellBackgroundFromRow); |
31 if (shouldPaintCells && !cell->hasSelfPaintingLayer()) | 31 if (shouldPaintCells && !cell->hasSelfPaintingLayer()) |
32 cell->paint(paintInfoForCells, paintOffset); | 32 cell->paint(paintInfoForCells, paintOffset); |
33 } | 33 } |
34 } | 34 } |
35 | 35 |
36 void TableRowPainter::paintOutlineForRowIfNeeded(const PaintInfo& paintInfo, con
st LayoutPoint& paintOffset) | 36 void TableRowPainter::paintOutlineForRowIfNeeded(const PaintInfo& paintInfo, con
st LayoutPoint& paintOffset) |
37 { | 37 { |
38 PaintPhase paintPhase = paintInfo.phase; | 38 PaintPhase paintPhase = paintInfo.phase; |
39 if (shouldPaintSelfOutline(paintPhase)) { | 39 if (shouldPaintSelfOutline(paintPhase)) { |
40 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableRow.locatio
n(); | 40 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableRow.locatio
n(); |
41 ObjectPainter(m_layoutTableRow).paintOutline(paintInfo, adjustedPaintOff
set); | 41 ObjectPainter(m_layoutTableRow).paintOutline(paintInfo, adjustedPaintOff
set); |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 } // namespace blink | 45 } // namespace blink |
OLD | NEW |