| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 graphicsContext, borderRect.maxX() - rightWidth, borderRect.y(), | 170 graphicsContext, borderRect.maxX() - rightWidth, borderRect.y(), |
| 171 borderRect.maxX(), borderRect.maxY(), BSRight, | 171 borderRect.maxX(), borderRect.maxY(), BSRight, |
| 172 rightBorderValue.color().resolve(cellColor), | 172 rightBorderValue.color().resolve(cellColor), |
| 173 collapsedBorderStyle(rightBorderValue.style()), 0, 0, true); | 173 collapsedBorderStyle(rightBorderValue.style()), 0, 0, true); |
| 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) { | |
| 182 DCHECK(backgroundObject != m_layoutTableCell); | 181 DCHECK(backgroundObject != m_layoutTableCell); |
| 183 | 182 |
| 184 if (m_layoutTableCell.style()->visibility() != EVisibility::kVisible) | 183 if (m_layoutTableCell.style()->visibility() != EVisibility::kVisible) |
| 185 return; | 184 return; |
| 186 | 185 |
| 187 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableCell.location(); | |
| 188 if (!BlockPainter(m_layoutTableCell) | |
| 189 .intersectsPaintRect(paintInfo, adjustedPaintOffset)) | |
| 190 return; | |
| 191 | |
| 192 LayoutTable* table = m_layoutTableCell.table(); | 186 LayoutTable* table = m_layoutTableCell.table(); |
| 193 if (!table->collapseBorders() && | 187 if (!table->collapseBorders() && |
| 194 m_layoutTableCell.style()->emptyCells() == EEmptyCells::kHide && | 188 m_layoutTableCell.style()->emptyCells() == EEmptyCells::kHide && |
| 195 !m_layoutTableCell.firstChild()) | 189 !m_layoutTableCell.firstChild()) |
| 196 return; | 190 return; |
| 197 | 191 |
| 198 const DisplayItemClient& client = | 192 LayoutRect paintRect = paintRectNotIncludingVisualOverflow( |
| 199 m_layoutTableCell.backgroundDisplayItemClient(); | 193 paintOffset + m_layoutTableCell.location()); |
| 200 if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, client, | |
| 201 type)) | |
| 202 return; | |
| 203 | |
| 204 LayoutRect paintRect = | |
| 205 paintRectNotIncludingVisualOverflow(adjustedPaintOffset); | |
| 206 DrawingRecorder recorder(paintInfo.context, client, type, | |
| 207 FloatRect(paintRect)); | |
| 208 paintBackground(paintInfo, paintRect, backgroundObject); | 194 paintBackground(paintInfo, paintRect, backgroundObject); |
| 209 } | 195 } |
| 210 | 196 |
| 211 void TableCellPainter::paintBackground(const PaintInfo& paintInfo, | 197 void TableCellPainter::paintBackground(const PaintInfo& paintInfo, |
| 212 const LayoutRect& paintRect, | 198 const LayoutRect& paintRect, |
| 213 const LayoutObject& backgroundObject) { | 199 const LayoutObject& backgroundObject) { |
| 214 if (m_layoutTableCell.backgroundStolenForBeingBody()) | 200 if (m_layoutTableCell.backgroundStolenForBeingBody()) |
| 215 return; | 201 return; |
| 216 | 202 |
| 217 Color c = backgroundObject.resolveColor(CSSPropertyBackgroundColor); | 203 Color c = backgroundObject.resolveColor(CSSPropertyBackgroundColor); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect); | 283 BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect); |
| 298 } | 284 } |
| 299 | 285 |
| 300 LayoutRect TableCellPainter::paintRectNotIncludingVisualOverflow( | 286 LayoutRect TableCellPainter::paintRectNotIncludingVisualOverflow( |
| 301 const LayoutPoint& paintOffset) { | 287 const LayoutPoint& paintOffset) { |
| 302 return LayoutRect(paintOffset, | 288 return LayoutRect(paintOffset, |
| 303 LayoutSize(m_layoutTableCell.pixelSnappedSize())); | 289 LayoutSize(m_layoutTableCell.pixelSnappedSize())); |
| 304 } | 290 } |
| 305 | 291 |
| 306 } // namespace blink | 292 } // namespace blink |
| OLD | NEW |