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

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

Issue 2515573002: 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 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::Visible)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::Hide &&
195 !m_layoutTableCell.firstChild()) 195 !m_layoutTableCell.firstChild())
196 return; 196 return;
197 197
198 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( 198 const DisplayItemClient& client =
199 paintInfo.context, m_layoutTableCell, type)) 199 m_layoutTableCell.backgroundDisplayItemClient();
200 if (DrawingRecorder::useCachedDrawingIfPossible(paintInfo.context, client,
201 type))
200 return; 202 return;
201 203
202 LayoutRect paintRect = 204 LayoutRect paintRect =
203 paintRectNotIncludingVisualOverflow(adjustedPaintOffset); 205 paintRectNotIncludingVisualOverflow(adjustedPaintOffset);
204 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutTableCell, 206 DrawingRecorder recorder(paintInfo.context, client, type,
205 type, paintRect); 207 FloatRect(paintRect));
206 paintBackground(paintInfo, paintRect, backgroundObject); 208 paintBackground(paintInfo, paintRect, backgroundObject);
207 } 209 }
208 210
209 void TableCellPainter::paintBackground(const PaintInfo& paintInfo, 211 void TableCellPainter::paintBackground(const PaintInfo& paintInfo,
210 const LayoutRect& paintRect, 212 const LayoutRect& paintRect,
211 const LayoutObject& backgroundObject) { 213 const LayoutObject& backgroundObject) {
212 if (m_layoutTableCell.backgroundStolenForBeingBody()) 214 if (m_layoutTableCell.backgroundStolenForBeingBody())
213 return; 215 return;
214 216
215 Color c = backgroundObject.resolveColor(CSSPropertyBackgroundColor); 217 Color c = backgroundObject.resolveColor(CSSPropertyBackgroundColor);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect); 300 BoxPainter(m_layoutTableCell).paintMaskImages(paintInfo, paintRect);
299 } 301 }
300 302
301 LayoutRect TableCellPainter::paintRectNotIncludingVisualOverflow( 303 LayoutRect TableCellPainter::paintRectNotIncludingVisualOverflow(
302 const LayoutPoint& paintOffset) { 304 const LayoutPoint& paintOffset) {
303 return LayoutRect(paintOffset, 305 return LayoutRect(paintOffset,
304 LayoutSize(m_layoutTableCell.pixelSnappedSize())); 306 LayoutSize(m_layoutTableCell.pixelSnappedSize()));
305 } 307 }
306 308
307 } // namespace blink 309 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698