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

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

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 5 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
« no previous file with comments | « Source/core/paint/ImagePainter.cpp ('k') | Source/core/paint/InlinePainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/InlineFlowBoxPainter.cpp
diff --git a/Source/core/paint/InlineFlowBoxPainter.cpp b/Source/core/paint/InlineFlowBoxPainter.cpp
index 016c3cf794ee080dcac75c6e4b94e1864a8c5727..be99e182ee01028c29d712ddb92c6b8406df2c48 100644
--- a/Source/core/paint/InlineFlowBoxPainter.cpp
+++ b/Source/core/paint/InlineFlowBoxPainter.cpp
@@ -61,9 +61,11 @@ void InlineFlowBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint&
}
}
} else if (paintInfo.phase == PaintPhaseMask) {
- DrawingRecorder recorder(*paintInfo.context, m_inlineFlowBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase), pixelSnappedIntRect(overflowRect));
- if (!recorder.canUseCachedDrawing())
- paintMask(paintInfo, paintOffset);
+ DisplayItem::Type displayItemType = DisplayItem::paintPhaseToDrawingType(paintInfo.phase);
+ if (DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_inlineFlowBox, displayItemType))
+ return;
+ DrawingRecorder recorder(*paintInfo.context, m_inlineFlowBox, displayItemType, pixelSnappedIntRect(overflowRect));
+ paintMask(paintInfo, paintOffset);
return;
} else if (paintInfo.phase == PaintPhaseForeground) {
// Paint our background, border and box-shadow.
@@ -228,6 +230,11 @@ void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintIn
if (!shouldPaintBoxDecorationBackground)
return;
+ if (DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_inlineFlowBox, DisplayItem::BoxDecorationBackground))
+ return;
+
+ DrawingRecorder recorder(*paintInfo.context, m_inlineFlowBox, DisplayItem::BoxDecorationBackground, pixelSnappedIntRect(cullRect));
+
LayoutRect frameRect = roundedFrameRectClampedToLineTopAndBottomIfNeeded();
// Move x/y to our coordinates.
@@ -240,10 +247,6 @@ void InlineFlowBoxPainter::paintBoxDecorationBackground(const PaintInfo& paintIn
LayoutRect adjustedClipRect;
BorderPaintingType borderPaintingType = getBorderPaintType(adjustedFrameRect, adjustedClipRect);
- DrawingRecorder recorder(*paintInfo.context, m_inlineFlowBox, DisplayItem::BoxDecorationBackground, pixelSnappedIntRect(cullRect));
- if (recorder.canUseCachedDrawing())
- return;
-
// Shadow comes first and is behind the background and border.
if (!m_inlineFlowBox.boxModelObject()->boxShadowShouldBeAppliedToBackground(BackgroundBleedNone, &m_inlineFlowBox))
paintBoxShadow(paintInfo, *styleToUse, Normal, adjustedFrameRect);
« no previous file with comments | « Source/core/paint/ImagePainter.cpp ('k') | Source/core/paint/InlinePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698