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

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

Issue 799563002: Use DrawingRecorder::canUseCachedDrawing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/RenderDrawingRecorder.cpp ('k') | Source/core/paint/TablePainter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "core/paint/TableCellPainter.h" 6 #include "core/paint/TableCellPainter.h"
7 7
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/RenderDrawingRecorder.h" 10 #include "core/paint/RenderDrawingRecorder.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 LayoutRect paintRect = paintBounds(paintOffset, AddOffsetFromParent); 124 LayoutRect paintRect = paintBounds(paintOffset, AddOffsetFromParent);
125 if (paintRect.y() - m_renderTableCell.table()->outerBorderTop() >= paintInfo .rect.maxY()) 125 if (paintRect.y() - m_renderTableCell.table()->outerBorderTop() >= paintInfo .rect.maxY())
126 return; 126 return;
127 127
128 if (paintRect.maxY() + m_renderTableCell.table()->outerBorderBottom() <= pai ntInfo.rect.y()) 128 if (paintRect.maxY() + m_renderTableCell.table()->outerBorderBottom() <= pai ntInfo.rect.y())
129 return; 129 return;
130 130
131 if (!m_renderTableCell.table()->currentBorderValue()) 131 if (!m_renderTableCell.table()->currentBorderValue())
132 return; 132 return;
133 133
134 RenderDrawingRecorder recorder(paintInfo.context, &m_renderTableCell, paintI nfo.phase, paintRect); 134 RenderDrawingRecorder recorder(paintInfo.context, m_renderTableCell, paintIn fo.phase, paintRect);
135 if (recorder.canUseCachedDrawing())
136 return;
135 137
136 const RenderStyle* styleForCellFlow = m_renderTableCell.styleForCellFlow(); 138 const RenderStyle* styleForCellFlow = m_renderTableCell.styleForCellFlow();
137 CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(styleForCellFlow); 139 CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(styleForCellFlow);
138 CollapsedBorderValue rightVal = cachedCollapsedRightBorder(styleForCellFlow) ; 140 CollapsedBorderValue rightVal = cachedCollapsedRightBorder(styleForCellFlow) ;
139 CollapsedBorderValue topVal = cachedCollapsedTopBorder(styleForCellFlow); 141 CollapsedBorderValue topVal = cachedCollapsedTopBorder(styleForCellFlow);
140 CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(styleForCellFlo w); 142 CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(styleForCellFlo w);
141 143
142 // Adjust our x/y/width/height so that we paint the collapsed borders at the correct location. 144 // Adjust our x/y/width/height so that we paint the collapsed borders at the correct location.
143 int topWidth = topVal.width(); 145 int topWidth = topVal.width();
144 int bottomWidth = bottomVal.width(); 146 int bottomWidth = bottomVal.width();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 void TableCellPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) 218 void TableCellPainter::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
217 { 219 {
218 if (!paintInfo.shouldPaintWithinRoot(&m_renderTableCell)) 220 if (!paintInfo.shouldPaintWithinRoot(&m_renderTableCell))
219 return; 221 return;
220 222
221 RenderTable* tableElt = m_renderTableCell.table(); 223 RenderTable* tableElt = m_renderTableCell.table();
222 if (!tableElt->collapseBorders() && m_renderTableCell.style()->emptyCells() == HIDE && !m_renderTableCell.firstChild()) 224 if (!tableElt->collapseBorders() && m_renderTableCell.style()->emptyCells() == HIDE && !m_renderTableCell.firstChild())
223 return; 225 return;
224 226
225 LayoutRect paintRect = paintBounds(paintOffset, DoNotAddOffsetFromParent); 227 LayoutRect paintRect = paintBounds(paintOffset, DoNotAddOffsetFromParent);
226 RenderDrawingRecorder recorder(paintInfo.context, &m_renderTableCell, paintI nfo.phase, pixelSnappedIntRect(paintRect)); 228 RenderDrawingRecorder recorder(paintInfo.context, m_renderTableCell, paintIn fo.phase, pixelSnappedIntRect(paintRect));
229 if (recorder.canUseCachedDrawing())
230 return;
231
227 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_renderTableCell.style(), Normal); 232 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_renderTableCell.style(), Normal);
228 233
229 // Paint our cell background. 234 // Paint our cell background.
230 paintBackgroundsBehindCell(paintInfo, paintOffset, &m_renderTableCell); 235 paintBackgroundsBehindCell(paintInfo, paintOffset, &m_renderTableCell);
231 236
232 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_renderTableCell.style(), Inset); 237 BoxPainter::paintBoxShadow(paintInfo, paintRect, m_renderTableCell.style(), Inset);
233 238
234 if (!m_renderTableCell.style()->hasBorder() || tableElt->collapseBorders()) 239 if (!m_renderTableCell.style()->hasBorder() || tableElt->collapseBorders())
235 return; 240 return;
236 241
(...skipping 15 matching lines...) Expand all
252 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo undOffsetBehavior paintBoundOffsetBehavior) 257 LayoutRect TableCellPainter::paintBounds(const LayoutPoint& paintOffset, PaintBo undOffsetBehavior paintBoundOffsetBehavior)
253 { 258 {
254 LayoutPoint adjustedPaintOffset = paintOffset; 259 LayoutPoint adjustedPaintOffset = paintOffset;
255 if (paintBoundOffsetBehavior == AddOffsetFromParent) 260 if (paintBoundOffsetBehavior == AddOffsetFromParent)
256 adjustedPaintOffset.moveBy(m_renderTableCell.location()); 261 adjustedPaintOffset.moveBy(m_renderTableCell.location());
257 return LayoutRect(adjustedPaintOffset, LayoutSize(m_renderTableCell.pixelSna ppedSize())); 262 return LayoutRect(adjustedPaintOffset, LayoutSize(m_renderTableCell.pixelSna ppedSize()));
258 } 263 }
259 264
260 } // namespace blink 265 } // namespace blink
261 266
OLDNEW
« no previous file with comments | « Source/core/paint/RenderDrawingRecorder.cpp ('k') | Source/core/paint/TablePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698