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