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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/TableRowPainter.h" | 6 #include "core/paint/TableRowPainter.h" |
7 | 7 |
8 #include "core/layout/LayoutTableCell.h" | 8 #include "core/layout/LayoutTableCell.h" |
9 #include "core/layout/LayoutTableRow.h" | 9 #include "core/layout/LayoutTableRow.h" |
10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
11 #include "core/paint/ObjectPainter.h" | 11 #include "core/paint/ObjectPainter.h" |
12 #include "core/paint/PaintInfo.h" | 12 #include "core/paint/PaintInfo.h" |
13 #include "core/paint/TableCellPainter.h" | 13 #include "core/paint/TableCellPainter.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 void TableRowPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paint
Offset) | 17 void TableRowPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paint
Offset) |
18 { | 18 { |
19 ASSERT(m_layoutTableRow.hasSelfPaintingLayer()); | 19 ASSERT(m_layoutTableRow.hasSelfPaintingLayer()); |
20 | 20 |
21 paintOutlineForRowIfNeeded(paintInfo, paintOffset); | 21 paintOutlineForRowIfNeeded(paintInfo, paintOffset); |
22 for (LayoutTableCell* cell = m_layoutTableRow.firstCell(); cell; cell = cell
->nextCell()) { | 22 for (LayoutTableCell* cell = m_layoutTableRow.firstCell(); cell; cell = cell
->nextCell()) { |
23 // Paint the row background behind the cell. | 23 // Paint the row background behind the cell. |
24 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == P
aintPhaseChildBlockBackground) { | 24 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == P
aintPhaseChildBlockBackground) { |
25 if (m_layoutTableRow.hasBackground()) { | 25 if (m_layoutTableRow.hasBackground()) { |
26 TableCellPainter tableCellPainter(*cell); | 26 TableCellPainter tableCellPainter(*cell); |
27 LayoutObjectDrawingRecorder recorder(*paintInfo.context, *cell,
DisplayItem::TableCellBackgroundFromSelfPaintingRow, tableCellPainter.paintBound
s(paintOffset, TableCellPainter::AddOffsetFromParent)); | 27 if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*pa
intInfo.context, *cell, DisplayItem::TableCellBackgroundFromSelfPaintingRow)) { |
28 if (!recorder.canUseCachedDrawing()) | 28 LayoutObjectDrawingRecorder recorder(*paintInfo.context, *ce
ll, DisplayItem::TableCellBackgroundFromSelfPaintingRow, tableCellPainter.paintB
ounds(paintOffset, TableCellPainter::AddOffsetFromParent)); |
29 tableCellPainter.paintBackgroundsBehindCell(paintInfo, paint
Offset, &m_layoutTableRow); | 29 tableCellPainter.paintBackgroundsBehindCell(paintInfo, paint
Offset, &m_layoutTableRow); |
| 30 } |
30 } | 31 } |
31 } | 32 } |
32 | 33 |
33 if (!cell->hasSelfPaintingLayer()) | 34 if (!cell->hasSelfPaintingLayer()) |
34 cell->paint(paintInfo, paintOffset); | 35 cell->paint(paintInfo, paintOffset); |
35 } | 36 } |
36 } | 37 } |
37 | 38 |
38 void TableRowPainter::paintOutlineForRowIfNeeded(const PaintInfo& paintInfo, con
st LayoutPoint& paintOffset) | 39 void TableRowPainter::paintOutlineForRowIfNeeded(const PaintInfo& paintInfo, con
st LayoutPoint& paintOffset) |
39 { | 40 { |
40 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableRow.location(); | 41 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableRow.location(); |
41 PaintPhase paintPhase = paintInfo.phase; | 42 PaintPhase paintPhase = paintInfo.phase; |
42 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline)
&& m_layoutTableRow.style()->visibility() == VISIBLE) { | 43 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline)
&& m_layoutTableRow.style()->visibility() == VISIBLE) { |
43 LayoutRect visualOverflowRect(m_layoutTableRow.visualOverflowRect()); | 44 LayoutRect visualOverflowRect(m_layoutTableRow.visualOverflowRect()); |
44 visualOverflowRect.moveBy(adjustedPaintOffset); | 45 visualOverflowRect.moveBy(adjustedPaintOffset); |
45 ObjectPainter(m_layoutTableRow).paintOutline(paintInfo, LayoutRect(adjus
tedPaintOffset, m_layoutTableRow.size()), visualOverflowRect); | 46 ObjectPainter(m_layoutTableRow).paintOutline(paintInfo, LayoutRect(adjus
tedPaintOffset, m_layoutTableRow.size()), visualOverflowRect); |
46 } | 47 } |
47 } | 48 } |
48 | 49 |
49 } // namespace blink | 50 } // namespace blink |
OLD | NEW |