| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 LayoutTableCol* column = colAndColGroup.col; | 267 LayoutTableCol* column = colAndColGroup.col; |
| 268 LayoutTableCol* columnGroup = colAndColGroup.colgroup; | 268 LayoutTableCol* columnGroup = colAndColGroup.colgroup; |
| 269 TableCellPainter tableCellPainter(cell); | 269 TableCellPainter tableCellPainter(cell); |
| 270 | 270 |
| 271 // Column groups and columns first. | 271 // Column groups and columns first. |
| 272 // FIXME: Columns and column groups do not currently support opacity, and th
ey are being painted "too late" in | 272 // FIXME: Columns and column groups do not currently support opacity, and th
ey are being painted "too late" in |
| 273 // the stack, since we have already opened a transparency layer (potentially
) for the table row group. | 273 // the stack, since we have already opened a transparency layer (potentially
) for the table row group. |
| 274 // Note that we deliberately ignore whether or not the cell has a layer, sin
ce these backgrounds paint "behind" the | 274 // Note that we deliberately ignore whether or not the cell has a layer, sin
ce these backgrounds paint "behind" the |
| 275 // cell. | 275 // cell. |
| 276 if (columnGroup && columnGroup->styleRef().hasBackground()) | 276 if (columnGroup && columnGroup->styleRef().hasBackground()) |
| 277 tableCellPainter.paintContainerBackgroundBehindCell(paintInfoForCells, c
ellPoint, *columnGroup, DisplayItem::TableCellBackgroundFromColumnGroup); | 277 tableCellPainter.paintContainerBackgroundBehindCell(paintInfoForCells, c
ellPoint, *columnGroup, DisplayItem::kTableCellBackgroundFromColumnGroup); |
| 278 if (column && column->styleRef().hasBackground()) | 278 if (column && column->styleRef().hasBackground()) |
| 279 tableCellPainter.paintContainerBackgroundBehindCell(paintInfoForCells, c
ellPoint, *column, DisplayItem::TableCellBackgroundFromColumn); | 279 tableCellPainter.paintContainerBackgroundBehindCell(paintInfoForCells, c
ellPoint, *column, DisplayItem::kTableCellBackgroundFromColumn); |
| 280 | 280 |
| 281 // Paint the row group next. | 281 // Paint the row group next. |
| 282 if (m_layoutTableSection.styleRef().hasBackground()) | 282 if (m_layoutTableSection.styleRef().hasBackground()) |
| 283 tableCellPainter.paintContainerBackgroundBehindCell(paintInfoForCells, c
ellPoint, m_layoutTableSection, DisplayItem::TableCellBackgroundFromSection); | 283 tableCellPainter.paintContainerBackgroundBehindCell(paintInfoForCells, c
ellPoint, m_layoutTableSection, DisplayItem::kTableCellBackgroundFromSection); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void TableSectionPainter::paintCell(const LayoutTableCell& cell, const PaintInfo
& paintInfoForCells, const LayoutPoint& paintOffset) | 286 void TableSectionPainter::paintCell(const LayoutTableCell& cell, const PaintInfo
& paintInfoForCells, const LayoutPoint& paintOffset) |
| 287 { | 287 { |
| 288 if (!cell.hasSelfPaintingLayer() && !cell.row()->hasSelfPaintingLayer()) { | 288 if (!cell.hasSelfPaintingLayer() && !cell.row()->hasSelfPaintingLayer()) { |
| 289 LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild(
&cell, paintOffset); | 289 LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild(
&cell, paintOffset); |
| 290 cell.paint(paintInfoForCells, cellPoint); | 290 cell.paint(paintInfoForCells, cellPoint); |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 void TableSectionPainter::paintBoxShadow(const PaintInfo& paintInfo, const Layou
tPoint& paintOffset, ShadowStyle shadowStyle) | 294 void TableSectionPainter::paintBoxShadow(const PaintInfo& paintInfo, const Layou
tPoint& paintOffset, ShadowStyle shadowStyle) |
| 295 { | 295 { |
| 296 DCHECK(shouldPaintSelfBlockBackground(paintInfo.phase)); | 296 DCHECK(shouldPaintSelfBlockBackground(paintInfo.phase)); |
| 297 if (!m_layoutTableSection.styleRef().boxShadow()) | 297 if (!m_layoutTableSection.styleRef().boxShadow()) |
| 298 return; | 298 return; |
| 299 | 299 |
| 300 DisplayItem::Type type = shadowStyle == Normal ? DisplayItem::TableSectionBo
xShadowNormal : DisplayItem::TableSectionBoxShadowInset; | 300 DisplayItem::Type type = shadowStyle == Normal ? DisplayItem::kTableSectionB
oxShadowNormal : DisplayItem::kTableSectionBoxShadowInset; |
| 301 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableSection, type)) | 301 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableSection, type)) |
| 302 return; | 302 return; |
| 303 | 303 |
| 304 LayoutRect bounds = BoxPainter(m_layoutTableSection).boundsForDrawingRecorde
r(paintInfo, paintOffset); | 304 LayoutRect bounds = BoxPainter(m_layoutTableSection).boundsForDrawingRecorde
r(paintInfo, paintOffset); |
| 305 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection
, type, bounds); | 305 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableSection
, type, bounds); |
| 306 BoxPainter::paintBoxShadow(paintInfo, LayoutRect(paintOffset, m_layoutTableS
ection.size()), m_layoutTableSection.styleRef(), shadowStyle); | 306 BoxPainter::paintBoxShadow(paintInfo, LayoutRect(paintOffset, m_layoutTableS
ection.size()), m_layoutTableSection.styleRef(), shadowStyle); |
| 307 } | 307 } |
| 308 | 308 |
| 309 } // namespace blink | 309 } // namespace blink |
| OLD | NEW |