Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(777)

Side by Side Diff: third_party/WebKit/Source/core/paint/TableCellPainter.cpp

Issue 2507893002: Fix painting background for composited table cells in a non-composited row. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (style == BorderStyleOutset) 64 if (style == BorderStyleOutset)
65 return BorderStyleGroove; 65 return BorderStyleGroove;
66 if (style == BorderStyleInset) 66 if (style == BorderStyleInset)
67 return BorderStyleRidge; 67 return BorderStyleRidge;
68 return style; 68 return style;
69 } 69 }
70 70
71 const DisplayItemClient& TableCellPainter::displayItemClientForBorders() const { 71 const DisplayItemClient& TableCellPainter::displayItemClientForBorders() const {
72 // TODO(wkorman): We may need to handle PaintInvalidationDelayedFull. 72 // TODO(wkorman): We may need to handle PaintInvalidationDelayedFull.
73 // http://crbug.com/657186 73 // http://crbug.com/657186
74 return m_layoutTableCell.usesTableAsAdditionalDisplayItemClient() 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 const DisplayItemClient& TableCellPainter::displayItemClientForBackground()
81 const {
82 return m_layoutTableCell.usesCompositedCellDisplayItemClients()
83 ? static_cast<const DisplayItemClient&>(
84 *m_layoutTableCell.rowBackgroundDisplayItemClient())
85 : m_layoutTableCell;
86 }
87
80 void TableCellPainter::paintCollapsedBorders( 88 void TableCellPainter::paintCollapsedBorders(
81 const PaintInfo& paintInfo, 89 const PaintInfo& paintInfo,
82 const LayoutPoint& paintOffset, 90 const LayoutPoint& paintOffset,
83 const CollapsedBorderValue& currentBorderValue) { 91 const CollapsedBorderValue& currentBorderValue) {
84 if (m_layoutTableCell.style()->visibility() != EVisibility::Visible) 92 if (m_layoutTableCell.style()->visibility() != EVisibility::Visible)
85 return; 93 return;
86 94
87 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableCell.location(); 95 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableCell.location();
88 if (!BlockPainter(m_layoutTableCell) 96 if (!BlockPainter(m_layoutTableCell)
89 .intersectsPaintRect(paintInfo, adjustedPaintOffset)) 97 .intersectsPaintRect(paintInfo, adjustedPaintOffset))
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if (!BlockPainter(m_layoutTableCell) 196 if (!BlockPainter(m_layoutTableCell)
189 .intersectsPaintRect(paintInfo, adjustedPaintOffset)) 197 .intersectsPaintRect(paintInfo, adjustedPaintOffset))
190 return; 198 return;
191 199
192 LayoutTable* table = m_layoutTableCell.table(); 200 LayoutTable* table = m_layoutTableCell.table();
193 if (!table->collapseBorders() && 201 if (!table->collapseBorders() &&
194 m_layoutTableCell.style()->emptyCells() == EEmptyCells::Hide && 202 m_layoutTableCell.style()->emptyCells() == EEmptyCells::Hide &&
195 !m_layoutTableCell.firstChild()) 203 !m_layoutTableCell.firstChild())
196 return; 204 return;
197 205
198 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( 206 const DisplayItemClient& client = displayItemClientForBackground();
199 paintInfo.context, m_layoutTableCell, type)) 207 if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, client,
208 type))
200 return; 209 return;
201 210
202 LayoutRect paintRect = 211 LayoutRect paintRect =
203 paintRectNotIncludingVisualOverflow(adjustedPaintOffset); 212 paintRectNotIncludingVisualOverflow(adjustedPaintOffset);
204 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell, 213 DrawingRecorder recorder(paintInfo.context, client, type,
205 type, paintRect); 214 FloatRect(paintRect));
206 paintBackground(paintInfo, paintRect, backgroundObject); 215 paintBackground(paintInfo, paintRect, backgroundObject);
207 } 216 }
208 217
209 void TableCellPainter::paintBackground(const PaintInfo& paintInfo, 218 void TableCellPainter::paintBackground(const PaintInfo& paintInfo,
210 const LayoutRect& paintRect, 219 const LayoutRect& paintRect,
211 const LayoutObject& backgroundObject) { 220 const LayoutObject& backgroundObject) {
212 if (m_layoutTableCell.backgroundStolenForBeingBody()) 221 if (m_layoutTableCell.backgroundStolenForBeingBody())
213 return; 222 return;
214 223
215 Color c = backgroundObject.resolveColor(CSSPropertyBackgroundColor); 224 Color c = backgroundObject.resolveColor(CSSPropertyBackgroundColor);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect); 307 BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect);
299 } 308 }
300 309
301 LayoutRect TableCellPainter::paintRectNotIncludingVisualOverflow( 310 LayoutRect TableCellPainter::paintRectNotIncludingVisualOverflow(
302 const LayoutPoint& paintOffset) { 311 const LayoutPoint& paintOffset) {
303 return LayoutRect(paintOffset, 312 return LayoutRect(paintOffset,
304 LayoutSize(m_layoutTableCell.pixelSnappedSize())); 313 LayoutSize(m_layoutTableCell.pixelSnappedSize()));
305 } 314 }
306 315
307 } // namespace blink 316 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698