| 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/TableCellPainter.h" | 5 #include "core/paint/TableCellPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutTableCell.h" | 7 #include "core/layout/LayoutTableCell.h" |
| 8 #include "core/paint/BlockPainter.h" | 8 #include "core/paint/BlockPainter.h" |
| 9 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" |
| 10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 return m_layoutTableCell.usesCompositedCellDisplayItemClients() | 74 return m_layoutTableCell.usesCompositedCellDisplayItemClients() |
| 75 ? static_cast<const DisplayItemClient&>( | 75 ? static_cast<const DisplayItemClient&>( |
| 76 *m_layoutTableCell.collapsedBorderValues()) | 76 *m_layoutTableCell.collapsedBorderValues()) |
| 77 : m_layoutTableCell; | 77 : m_layoutTableCell; |
| 78 } | 78 } |
| 79 | 79 |
| 80 void TableCellPainter::paintCollapsedBorders( | 80 void TableCellPainter::paintCollapsedBorders( |
| 81 const PaintInfo& paintInfo, | 81 const PaintInfo& paintInfo, |
| 82 const LayoutPoint& paintOffset, | 82 const LayoutPoint& paintOffset, |
| 83 const CollapsedBorderValue& currentBorderValue) { | 83 const CollapsedBorderValue& currentBorderValue) { |
| 84 if (m_layoutTableCell.style()->visibility() != EVisibility::Visible) | 84 if (m_layoutTableCell.style()->visibility() != EVisibility::kVisible) |
| 85 return; | 85 return; |
| 86 | 86 |
| 87 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableCell.location(); | 87 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableCell.location(); |
| 88 if (!BlockPainter(m_layoutTableCell) | 88 if (!BlockPainter(m_layoutTableCell) |
| 89 .intersectsPaintRect(paintInfo, adjustedPaintOffset)) | 89 .intersectsPaintRect(paintInfo, adjustedPaintOffset)) |
| 90 return; | 90 return; |
| 91 | 91 |
| 92 const LayoutTableCell::CollapsedBorderValues* values = | 92 const LayoutTableCell::CollapsedBorderValues* values = |
| 93 m_layoutTableCell.collapsedBorderValues(); | 93 m_layoutTableCell.collapsedBorderValues(); |
| 94 if (!values) | 94 if (!values) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 void TableCellPainter::paintContainerBackgroundBehindCell( | 177 void TableCellPainter::paintContainerBackgroundBehindCell( |
| 178 const PaintInfo& paintInfo, | 178 const PaintInfo& paintInfo, |
| 179 const LayoutPoint& paintOffset, | 179 const LayoutPoint& paintOffset, |
| 180 const LayoutObject& backgroundObject, | 180 const LayoutObject& backgroundObject, |
| 181 DisplayItem::Type type) { | 181 DisplayItem::Type type) { |
| 182 DCHECK(backgroundObject != m_layoutTableCell); | 182 DCHECK(backgroundObject != m_layoutTableCell); |
| 183 | 183 |
| 184 if (m_layoutTableCell.style()->visibility() != EVisibility::Visible) | 184 if (m_layoutTableCell.style()->visibility() != EVisibility::kVisible) |
| 185 return; | 185 return; |
| 186 | 186 |
| 187 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableCell.location(); | 187 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableCell.location(); |
| 188 if (!BlockPainter(m_layoutTableCell) | 188 if (!BlockPainter(m_layoutTableCell) |
| 189 .intersectsPaintRect(paintInfo, adjustedPaintOffset)) | 189 .intersectsPaintRect(paintInfo, adjustedPaintOffset)) |
| 190 return; | 190 return; |
| 191 | 191 |
| 192 LayoutTable* table = m_layoutTableCell.table(); | 192 LayoutTable* table = m_layoutTableCell.table(); |
| 193 if (!table->collapseBorders() && | 193 if (!table->collapseBorders() && |
| 194 m_layoutTableCell.style()->emptyCells() == EEmptyCells::Hide && | 194 m_layoutTableCell.style()->emptyCells() == EEmptyCells::kHide && |
| 195 !m_layoutTableCell.firstChild()) | 195 !m_layoutTableCell.firstChild()) |
| 196 return; | 196 return; |
| 197 | 197 |
| 198 const DisplayItemClient& client = | 198 const DisplayItemClient& client = |
| 199 m_layoutTableCell.backgroundDisplayItemClient(); | 199 m_layoutTableCell.backgroundDisplayItemClient(); |
| 200 if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, client, | 200 if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, client, |
| 201 type)) | 201 type)) |
| 202 return; | 202 return; |
| 203 | 203 |
| 204 LayoutRect paintRect = | 204 LayoutRect paintRect = |
| (...skipping 28 matching lines...) Expand all Loading... |
| 233 .paintFillLayers(paintInfo, c, bgLayer, paintRect, BackgroundBleedNone, | 233 .paintFillLayers(paintInfo, c, bgLayer, paintRect, BackgroundBleedNone, |
| 234 SkBlendMode::kSrcOver, &backgroundObject); | 234 SkBlendMode::kSrcOver, &backgroundObject); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 void TableCellPainter::paintBoxDecorationBackground( | 238 void TableCellPainter::paintBoxDecorationBackground( |
| 239 const PaintInfo& paintInfo, | 239 const PaintInfo& paintInfo, |
| 240 const LayoutPoint& paintOffset) { | 240 const LayoutPoint& paintOffset) { |
| 241 LayoutTable* table = m_layoutTableCell.table(); | 241 LayoutTable* table = m_layoutTableCell.table(); |
| 242 const ComputedStyle& style = m_layoutTableCell.styleRef(); | 242 const ComputedStyle& style = m_layoutTableCell.styleRef(); |
| 243 if (!table->collapseBorders() && style.emptyCells() == EEmptyCells::Hide && | 243 if (!table->collapseBorders() && style.emptyCells() == EEmptyCells::kHide && |
| 244 !m_layoutTableCell.firstChild()) | 244 !m_layoutTableCell.firstChild()) |
| 245 return; | 245 return; |
| 246 | 246 |
| 247 bool needsToPaintBorder = | 247 bool needsToPaintBorder = |
| 248 style.hasBorderDecoration() && !table->collapseBorders(); | 248 style.hasBorderDecoration() && !table->collapseBorders(); |
| 249 if (!style.hasBackground() && !style.boxShadow() && !needsToPaintBorder) | 249 if (!style.hasBackground() && !style.boxShadow() && !needsToPaintBorder) |
| 250 return; | 250 return; |
| 251 | 251 |
| 252 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( | 252 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( |
| 253 paintInfo.context, m_layoutTableCell, | 253 paintInfo.context, m_layoutTableCell, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 270 BoxPainter::paintInsetBoxShadow(paintInfo, paintRect, style); | 270 BoxPainter::paintInsetBoxShadow(paintInfo, paintRect, style); |
| 271 | 271 |
| 272 if (!needsToPaintBorder) | 272 if (!needsToPaintBorder) |
| 273 return; | 273 return; |
| 274 | 274 |
| 275 BoxPainter::paintBorder(m_layoutTableCell, paintInfo, paintRect, style); | 275 BoxPainter::paintBorder(m_layoutTableCell, paintInfo, paintRect, style); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void TableCellPainter::paintMask(const PaintInfo& paintInfo, | 278 void TableCellPainter::paintMask(const PaintInfo& paintInfo, |
| 279 const LayoutPoint& paintOffset) { | 279 const LayoutPoint& paintOffset) { |
| 280 if (m_layoutTableCell.style()->visibility() != EVisibility::Visible || | 280 if (m_layoutTableCell.style()->visibility() != EVisibility::kVisible || |
| 281 paintInfo.phase != PaintPhaseMask) | 281 paintInfo.phase != PaintPhaseMask) |
| 282 return; | 282 return; |
| 283 | 283 |
| 284 LayoutTable* tableElt = m_layoutTableCell.table(); | 284 LayoutTable* tableElt = m_layoutTableCell.table(); |
| 285 if (!tableElt->collapseBorders() && | 285 if (!tableElt->collapseBorders() && |
| 286 m_layoutTableCell.style()->emptyCells() == EEmptyCells::Hide && | 286 m_layoutTableCell.style()->emptyCells() == EEmptyCells::kHide && |
| 287 !m_layoutTableCell.firstChild()) | 287 !m_layoutTableCell.firstChild()) |
| 288 return; | 288 return; |
| 289 | 289 |
| 290 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( | 290 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( |
| 291 paintInfo.context, m_layoutTableCell, paintInfo.phase)) | 291 paintInfo.context, m_layoutTableCell, paintInfo.phase)) |
| 292 return; | 292 return; |
| 293 | 293 |
| 294 LayoutRect paintRect = paintRectNotIncludingVisualOverflow(paintOffset); | 294 LayoutRect paintRect = paintRectNotIncludingVisualOverflow(paintOffset); |
| 295 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell, | 295 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell, |
| 296 paintInfo.phase, paintRect); | 296 paintInfo.phase, paintRect); |
| 297 BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect); | 297 BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect); |
| 298 } | 298 } |
| 299 | 299 |
| 300 LayoutRect TableCellPainter::paintRectNotIncludingVisualOverflow( | 300 LayoutRect TableCellPainter::paintRectNotIncludingVisualOverflow( |
| 301 const LayoutPoint& paintOffset) { | 301 const LayoutPoint& paintOffset) { |
| 302 return LayoutRect(paintOffset, | 302 return LayoutRect(paintOffset, |
| 303 LayoutSize(m_layoutTableCell.pixelSnappedSize())); | 303 LayoutSize(m_layoutTableCell.pixelSnappedSize())); |
| 304 } | 304 } |
| 305 | 305 |
| 306 } // namespace blink | 306 } // namespace blink |
| OLD | NEW |