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

Unified Diff: Source/core/paint/BlockFlowPainter.cpp

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix some !'s and &&'s. De Morgan would be proud. Created 5 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/paint/BlockFlowPainter.cpp
diff --git a/Source/core/paint/BlockFlowPainter.cpp b/Source/core/paint/BlockFlowPainter.cpp
index e7cc6442b07763df355665be6c824d19b3a12f02..b031906c3ce9a644c9a55c0cb41fcad9a8b0d469 100644
--- a/Source/core/paint/BlockFlowPainter.cpp
+++ b/Source/core/paint/BlockFlowPainter.cpp
@@ -53,6 +53,9 @@ void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo
if (!m_layoutBlockFlow.shouldPaintSelectionGaps())
return;
+ if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_layoutBlockFlow, DisplayItem::SelectionGap))
+ return;
+
LayoutUnit lastTop = 0;
LayoutUnit lastLeft = m_layoutBlockFlow.logicalLeftSelectionOffset(&m_layoutBlockFlow, lastTop);
LayoutUnit lastRight = m_layoutBlockFlow.logicalRightSelectionOffset(&m_layoutBlockFlow, lastTop);
@@ -65,9 +68,7 @@ void BlockFlowPainter::paintSelection(const PaintInfo& paintInfo, const LayoutPo
LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutBlockFlow, DisplayItem::SelectionGap, bounds);
ClipScope clipScope(paintInfo.context);
- LayoutRect gapRectsBounds = m_layoutBlockFlow.selectionGaps(&m_layoutBlockFlow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight,
- recorder.canUseCachedDrawing() ? nullptr : &paintInfo,
- recorder.canUseCachedDrawing() ? nullptr : &clipScope);
+ LayoutRect gapRectsBounds = m_layoutBlockFlow.selectionGaps(&m_layoutBlockFlow, paintOffset, LayoutSize(), lastTop, lastLeft, lastRight, &paintInfo, &clipScope);
// TODO(wkorman): Rework below to process paint invalidation rects during layout rather than paint.
Xianzhu 2015/07/03 01:24:41 If this TODO is still valid, then we can't early r
pdr. 2015/07/03 02:38:04 Good catch. Fixing this required a small amount of
if (!gapRectsBounds.isEmpty()) {
DeprecatedPaintLayer* layer = m_layoutBlockFlow.enclosingLayer();

Powered by Google App Engine
This is Rietveld 408576698