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/TableCellPainter.h" | 6 #include "core/paint/TableCellPainter.h" |
7 | 7 |
8 #include "core/layout/LayoutTableCell.h" | 8 #include "core/layout/LayoutTableCell.h" |
9 #include "core/paint/BlockPainter.h" | 9 #include "core/paint/BlockPainter.h" |
10 #include "core/paint/BoxPainter.h" | 10 #include "core/paint/BoxPainter.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 return; | 173 return; |
174 | 174 |
175 LayoutTable* table = m_layoutTableCell.table(); | 175 LayoutTable* table = m_layoutTableCell.table(); |
176 if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() ==
HIDE && !m_layoutTableCell.firstChild()) | 176 if (!table->collapseBorders() && m_layoutTableCell.style()->emptyCells() ==
HIDE && !m_layoutTableCell.firstChild()) |
177 return; | 177 return; |
178 | 178 |
179 bool needsToPaintBorder = m_layoutTableCell.styleRef().hasBorderDecoration()
&& !table->collapseBorders(); | 179 bool needsToPaintBorder = m_layoutTableCell.styleRef().hasBorderDecoration()
&& !table->collapseBorders(); |
180 if (!m_layoutTableCell.hasBackground() && !m_layoutTableCell.styleRef().boxS
hadow() && !needsToPaintBorder) | 180 if (!m_layoutTableCell.hasBackground() && !m_layoutTableCell.styleRef().boxS
hadow() && !needsToPaintBorder) |
181 return; | 181 return; |
182 | 182 |
183 LayoutRect paintRect = paintBounds(paintOffset, DoNotAddOffsetFromParent); | 183 LayoutRect visualOverflowRect = m_layoutTableCell.visualOverflowRect(); |
184 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutTableCell,
DisplayItem::BoxDecorationBackground, pixelSnappedIntRect(paintRect)); | 184 visualOverflowRect.moveBy(paintOffset); |
| 185 LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutTableCell,
DisplayItem::BoxDecorationBackground, pixelSnappedIntRect(visualOverflowRect)); |
185 if (recorder.canUseCachedDrawing()) | 186 if (recorder.canUseCachedDrawing()) |
186 return; | 187 return; |
187 | 188 |
| 189 LayoutRect paintRect = paintBounds(paintOffset, DoNotAddOffsetFromParent); |
| 190 |
188 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutTableCell.styleRef(
), Normal); | 191 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutTableCell.styleRef(
), Normal); |
189 | 192 |
190 // Paint our cell background. | 193 // Paint our cell background. |
191 paintBackgroundsBehindCell(paintInfo, paintOffset, &m_layoutTableCell); | 194 paintBackgroundsBehindCell(paintInfo, paintOffset, &m_layoutTableCell); |
192 | 195 |
193 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutTableCell.styleRef(
), Inset); | 196 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_layoutTableCell.styleRef(
), Inset); |
194 | 197 |
195 if (!needsToPaintBorder) | 198 if (!needsToPaintBorder) |
196 return; | 199 return; |
197 | 200 |
(...skipping 15 matching lines...) Expand all Loading... |
213 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo
undOffsetBehavior paintBoundOffsetBehavior) | 216 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo
undOffsetBehavior paintBoundOffsetBehavior) |
214 { | 217 { |
215 LayoutPoint adjustedPaintOffset = paintOffset; | 218 LayoutPoint adjustedPaintOffset = paintOffset; |
216 if (paintBoundOffsetBehavior == AddOffsetFromParent) | 219 if (paintBoundOffsetBehavior == AddOffsetFromParent) |
217 adjustedPaintOffset.moveBy(m_layoutTableCell.location()); | 220 adjustedPaintOffset.moveBy(m_layoutTableCell.location()); |
218 return LayoutRect(adjustedPaintOffset, LayoutSize(m_layoutTableCell.pixelSna
ppedSize())); | 221 return LayoutRect(adjustedPaintOffset, LayoutSize(m_layoutTableCell.pixelSna
ppedSize())); |
219 } | 222 } |
220 | 223 |
221 } // namespace blink | 224 } // namespace blink |
222 | 225 |
OLD | NEW |