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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 void TableCellPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo,
const LayoutPoint& paintOffset) | 185 void TableCellPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo,
const LayoutPoint& paintOffset) |
186 { | 186 { |
187 LayoutTable* table = m_layoutTableCell.table(); | 187 LayoutTable* table = m_layoutTableCell.table(); |
188 if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() ==
HIDE && !m_layoutTableCell.firstChild()) | 188 if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() ==
HIDE && !m_layoutTableCell.firstChild()) |
189 return; | 189 return; |
190 | 190 |
191 bool needsToPaintBorder = m_layoutTableCell.styleRef().hasBorderDecoration()
&& !table->collapseBorders(); | 191 bool needsToPaintBorder = m_layoutTableCell.styleRef().hasBorderDecoration()
&& !table->collapseBorders(); |
192 if (!m_layoutTableCell.hasBackground() && !m_layoutTableCell.styleRef().boxS
hadow() && !needsToPaintBorder) | 192 if (!m_layoutTableCell.hasBackground() && !m_layoutTableCell.styleRef().hasB
ackdropFilter() && !m_layoutTableCell.styleRef().boxShadow() && !needsToPaintBor
der) |
193 return; | 193 return; |
194 | 194 |
195 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableCell, DisplayItem::BoxDecorationBackground, paintOffset)) | 195 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutTableCell, DisplayItem::BoxDecorationBackground, paintOffset)) |
196 return; | 196 return; |
197 | 197 |
198 LayoutRect visualOverflowRect = m_layoutTableCell.visualOverflowRect(); | 198 LayoutRect visualOverflowRect = m_layoutTableCell.visualOverflowRect(); |
199 visualOverflowRect.moveBy(paintOffset); | 199 visualOverflowRect.moveBy(paintOffset); |
200 // TODO(chrishtr): the pixel-snapping here is likely incorrect. | 200 // TODO(chrishtr): the pixel-snapping here is likely incorrect. |
201 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell, D
isplayItem::BoxDecorationBackground, pixelSnappedIntRect(visualOverflowRect), pa
intOffset); | 201 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell, D
isplayItem::BoxDecorationBackground, pixelSnappedIntRect(visualOverflowRect), pa
intOffset); |
202 | 202 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo
undOffsetBehavior paintBoundOffsetBehavior) | 235 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo
undOffsetBehavior paintBoundOffsetBehavior) |
236 { | 236 { |
237 LayoutPoint adjustedPaintOffset = paintOffset; | 237 LayoutPoint adjustedPaintOffset = paintOffset; |
238 if (paintBoundOffsetBehavior == AddOffsetFromParent) | 238 if (paintBoundOffsetBehavior == AddOffsetFromParent) |
239 adjustedPaintOffset.moveBy(m_layoutTableCell.location()); | 239 adjustedPaintOffset.moveBy(m_layoutTableCell.location()); |
240 return LayoutRect(adjustedPaintOffset, LayoutSize(m_layoutTableCell.pixelSna
ppedSize())); | 240 return LayoutRect(adjustedPaintOffset, LayoutSize(m_layoutTableCell.pixelSna
ppedSize())); |
241 } | 241 } |
242 | 242 |
243 } // namespace blink | 243 } // namespace blink |
244 | 244 |
OLD | NEW |