| 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/TableSectionPainter.h" | 6 #include "core/paint/TableSectionPainter.h" |
| 7 | 7 |
| 8 #include "core/layout/LayoutTable.h" | 8 #include "core/layout/LayoutTable.h" |
| 9 #include "core/layout/LayoutTableCell.h" | 9 #include "core/layout/LayoutTableCell.h" |
| 10 #include "core/layout/LayoutTableCol.h" | 10 #include "core/layout/LayoutTableCol.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 LayoutTableCol* column = m_layoutTableSection.table()->colElement(cell->
col()); | 169 LayoutTableCol* column = m_layoutTableSection.table()->colElement(cell->
col()); |
| 170 LayoutTableCol* columnGroup = column ? column->enclosingColumnGroup() :
0; | 170 LayoutTableCol* columnGroup = column ? column->enclosingColumnGroup() :
0; |
| 171 | 171 |
| 172 bool columnHasBackground = column && column->hasBackground(); | 172 bool columnHasBackground = column && column->hasBackground(); |
| 173 bool columnGroupHasBackground = columnGroup && columnGroup->hasBackgroun
d(); | 173 bool columnGroupHasBackground = columnGroup && columnGroup->hasBackgroun
d(); |
| 174 bool sectionHasBackground = m_layoutTableSection.hasBackground(); | 174 bool sectionHasBackground = m_layoutTableSection.hasBackground(); |
| 175 bool rowHasBackground = row->hasBackground(); | 175 bool rowHasBackground = row->hasBackground(); |
| 176 | 176 |
| 177 if (columnHasBackground || columnGroupHasBackground || sectionHasBackgro
und || rowHasBackground) { | 177 if (columnHasBackground || columnGroupHasBackground || sectionHasBackgro
und || rowHasBackground) { |
| 178 TableCellPainter tableCellPainter(*cell); | 178 TableCellPainter tableCellPainter(*cell); |
| 179 LayoutObjectDrawingRecorder recorder(*paintInfo.context, *cell, pain
tPhase, tableCellPainter.paintBounds(cellPoint, TableCellPainter::AddOffsetFromP
arent)); | 179 if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintI
nfo.context, *cell, paintPhase)) { |
| 180 if (!recorder.canUseCachedDrawing()) { | 180 LayoutObjectDrawingRecorder recorder(*paintInfo.context, *cell,
paintPhase, tableCellPainter.paintBounds(cellPoint, TableCellPainter::AddOffsetF
romParent)); |
| 181 // Column groups and columns first. | 181 // Column groups and columns first. |
| 182 // FIXME: Columns and column groups do not currently support opa
city, and they are being painted "too late" in | 182 // FIXME: Columns and column groups do not currently support opa
city, and they are being painted "too late" in |
| 183 // the stack, since we have already opened a transparency layer
(potentially) for the table row group. | 183 // the stack, since we have already opened a transparency layer
(potentially) for the table row group. |
| 184 // Note that we deliberately ignore whether or not the cell has
a layer, since these backgrounds paint "behind" the | 184 // Note that we deliberately ignore whether or not the cell has
a layer, since these backgrounds paint "behind" the |
| 185 // cell. | 185 // cell. |
| 186 if (columnGroupHasBackground) | 186 if (columnGroupHasBackground) |
| 187 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, columnGroup); | 187 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, columnGroup); |
| 188 if (columnHasBackground) | 188 if (columnHasBackground) |
| 189 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, column); | 189 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, column); |
| 190 | 190 |
| 191 // Paint the row group next. | 191 // Paint the row group next. |
| 192 if (sectionHasBackground) | 192 if (sectionHasBackground) |
| 193 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, &m_layoutTableSection); | 193 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, &m_layoutTableSection); |
| 194 | 194 |
| 195 // Paint the row next, but only if it doesn't have a layer. If a
row has a layer, it will be responsible for | 195 // Paint the row next, but only if it doesn't have a layer. If a
row has a layer, it will be responsible for |
| 196 // painting the row background for the cell. | 196 // painting the row background for the cell. |
| 197 if (rowHasBackground && !row->hasSelfPaintingLayer()) | 197 if (rowHasBackground && !row->hasSelfPaintingLayer()) |
| 198 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, row); | 198 tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellP
oint, row); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer())) | 202 if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer())) |
| 203 cell->paint(paintInfo, cellPoint); | 203 cell->paint(paintInfo, cellPoint); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace blink | 206 } // namespace blink |
| OLD | NEW |