| 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/TableSectionPainter.h" | 5 #include "core/paint/TableSectionPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutTableCell.h" | 7 #include "core/layout/LayoutTableCell.h" |
| 8 #include "core/layout/LayoutTableCol.h" | 8 #include "core/layout/LayoutTableCol.h" |
| 9 #include "core/layout/LayoutTableRow.h" | 9 #include "core/layout/LayoutTableRow.h" |
| 10 #include "core/paint/BoxClipper.h" | 10 #include "core/paint/BoxClipper.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 if (shouldPaintDescendantBlockBackgrounds(paintInfo.phase)) { | 183 if (shouldPaintDescendantBlockBackgrounds(paintInfo.phase)) { |
| 184 for (unsigned r = dirtiedRows.start(); r < dirtiedRows.end(); r++) { | 184 for (unsigned r = dirtiedRows.start(); r < dirtiedRows.end(); r++) { |
| 185 const LayoutTableRow* row = m_layoutTableSection.rowLayoutObjectAt(r
); | 185 const LayoutTableRow* row = m_layoutTableSection.rowLayoutObjectAt(r
); |
| 186 // If a row has a layer, we'll paint row background in TableRowPaint
er. | 186 // If a row has a layer, we'll paint row background in TableRowPaint
er. |
| 187 if (!row || row->hasSelfPaintingLayer()) | 187 if (!row || row->hasSelfPaintingLayer()) |
| 188 continue; | 188 continue; |
| 189 | 189 |
| 190 TableRowPainter rowPainter(*row); | 190 TableRowPainter rowPainter(*row); |
| 191 rowPainter.paintBoxShadow(paintInfoForDescendants, paintOffset, Norm
al); | 191 rowPainter.paintBoxShadow(paintInfoForDescendants, paintOffset, Norm
al); |
| 192 if (row->hasBackground()) { | 192 if (row->styleRef().hasBackground()) { |
| 193 for (unsigned c = dirtiedColumns.start(); c < dirtiedColumns.end
(); c++) { | 193 for (unsigned c = dirtiedColumns.start(); c < dirtiedColumns.end
(); c++) { |
| 194 if (const LayoutTableCell* cell = primaryCellToPaint(r, c, d
irtiedRows, dirtiedColumns)) | 194 if (const LayoutTableCell* cell = primaryCellToPaint(r, c, d
irtiedRows, dirtiedColumns)) |
| 195 rowPainter.paintBackgroundBehindCell(*cell, paintInfoFor
Descendants, paintOffset); | 195 rowPainter.paintBackgroundBehindCell(*cell, paintInfoFor
Descendants, paintOffset); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 rowPainter.paintBoxShadow(paintInfoForDescendants, paintOffset, Inse
t); | 198 rowPainter.paintBoxShadow(paintInfoForDescendants, paintOffset, Inse
t); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 const HashSet<LayoutTableCell*>& overflowingCells = m_layoutTableSection.ove
rflowingCells(); | 202 const HashSet<LayoutTableCell*>& overflowingCells = m_layoutTableSection.ove
rflowingCells(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 LayoutTable::ColAndColGroup colAndColGroup = m_layoutTableSection.table()->c
olElementAtAbsoluteColumn(cell.absoluteColumnIndex()); | 260 LayoutTable::ColAndColGroup colAndColGroup = m_layoutTableSection.table()->c
olElementAtAbsoluteColumn(cell.absoluteColumnIndex()); |
| 261 LayoutTableCol* column = colAndColGroup.col; | 261 LayoutTableCol* column = colAndColGroup.col; |
| 262 LayoutTableCol* columnGroup = colAndColGroup.colgroup; | 262 LayoutTableCol* columnGroup = colAndColGroup.colgroup; |
| 263 TableCellPainter tableCellPainter(cell); | 263 TableCellPainter tableCellPainter(cell); |
| 264 | 264 |
| 265 // Column groups and columns first. | 265 // Column groups and columns first. |
| 266 // FIXME: Columns and column groups do not currently support opacity, and th
ey are being painted "too late" in | 266 // FIXME: Columns and column groups do not currently support opacity, and th
ey are being painted "too late" in |
| 267 // the stack, since we have already opened a transparency layer (potentially
) for the table row group. | 267 // the stack, since we have already opened a transparency layer (potentially
) for the table row group. |
| 268 // Note that we deliberately ignore whether or not the cell has a layer, sin
ce these backgrounds paint "behind" the | 268 // Note that we deliberately ignore whether or not the cell has a layer, sin
ce these backgrounds paint "behind" the |
| 269 // cell. | 269 // cell. |
| 270 if (columnGroup && columnGroup->hasBackground()) | 270 if (columnGroup && columnGroup->styleRef().hasBackground()) |
| 271 tableCellPainter.paintContainerBackgroundBehindCell(paintInfoForCells, c
ellPoint, *columnGroup, DisplayItem::TableCellBackgroundFromColumnGroup); | 271 tableCellPainter.paintContainerBackgroundBehindCell(paintInfoForCells, c
ellPoint, *columnGroup, DisplayItem::TableCellBackgroundFromColumnGroup); |
| 272 if (column && column->hasBackground()) | 272 if (column && column->styleRef().hasBackground()) |
| 273 tableCellPainter.paintContainerBackgroundBehindCell(paintInfoForCells, c
ellPoint, *column, DisplayItem::TableCellBackgroundFromColumn); | 273 tableCellPainter.paintContainerBackgroundBehindCell(paintInfoForCells, c
ellPoint, *column, DisplayItem::TableCellBackgroundFromColumn); |
| 274 | 274 |
| 275 // Paint the row group next. | 275 // Paint the row group next. |
| 276 if (m_layoutTableSection.hasBackground()) | 276 if (m_layoutTableSection.styleRef().hasBackground()) |
| 277 tableCellPainter.paintContainerBackgroundBehindCell(paintInfoForCells, c
ellPoint, m_layoutTableSection, DisplayItem::TableCellBackgroundFromSection); | 277 tableCellPainter.paintContainerBackgroundBehindCell(paintInfoForCells, c
ellPoint, m_layoutTableSection, DisplayItem::TableCellBackgroundFromSection); |
| 278 } | 278 } |
| 279 | 279 |
| 280 void TableSectionPainter::paintCell(const LayoutTableCell& cell, const PaintInfo
& paintInfoForCells, const LayoutPoint& paintOffset) | 280 void TableSectionPainter::paintCell(const LayoutTableCell& cell, const PaintInfo
& paintInfoForCells, const LayoutPoint& paintOffset) |
| 281 { | 281 { |
| 282 if (!cell.hasSelfPaintingLayer() && !cell.row()->hasSelfPaintingLayer()) { | 282 if (!cell.hasSelfPaintingLayer() && !cell.row()->hasSelfPaintingLayer()) { |
| 283 LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild(
&cell, paintOffset); | 283 LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild(
&cell, paintOffset); |
| 284 cell.paint(paintInfoForCells, cellPoint); | 284 cell.paint(paintInfoForCells, cellPoint); |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 | 287 |
| 288 void TableSectionPainter::paintBoxShadow(const PaintInfo& paintInfo, const Layou
tPoint& paintOffset, ShadowStyle shadowStyle) | 288 void TableSectionPainter::paintBoxShadow(const PaintInfo& paintInfo, const Layou
tPoint& paintOffset, ShadowStyle shadowStyle) |
| 289 { | 289 { |
| 290 DCHECK(shouldPaintSelfBlockBackground(paintInfo.phase)); | 290 DCHECK(shouldPaintSelfBlockBackground(paintInfo.phase)); |
| 291 if (!m_layoutTableSection.styleRef().boxShadow()) | 291 if (!m_layoutTableSection.styleRef().boxShadow()) |
| 292 return; | 292 return; |
| 293 | 293 |
| 294 DisplayItem::Type type = shadowStyle == Normal ? DisplayItem::TableSectionBo
xShadowNormal : DisplayItem::TableSectionBoxShadowInset; | 294 DisplayItem::Type type = shadowStyle == Normal ? DisplayItem::TableSectionBo
xShadowNormal : DisplayItem::TableSectionBoxShadowInset; |
| 295 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableSection, type)) | 295 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableSection, type)) |
| 296 return; | 296 return; |
| 297 | 297 |
| 298 LayoutRect bounds = BoxPainter(m_layoutTableSection).boundsForDrawingRecorde
r(paintOffset); | 298 LayoutRect bounds = BoxPainter(m_layoutTableSection).boundsForDrawingRecorde
r(paintOffset); |
| 299 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection
, type, bounds); | 299 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection
, type, bounds); |
| 300 BoxPainter::paintBoxShadow(paintInfo, LayoutRect(paintOffset, m_layoutTableS
ection.size()), m_layoutTableSection.styleRef(), shadowStyle); | 300 BoxPainter::paintBoxShadow(paintInfo, LayoutRect(paintOffset, m_layoutTableS
ection.size()), m_layoutTableSection.styleRef(), shadowStyle); |
| 301 } | 301 } |
| 302 | 302 |
| 303 } // namespace blink | 303 } // namespace blink |
| OLD | NEW |