Index: Source/core/paint/ImagePainter.cpp |
diff --git a/Source/core/paint/ImagePainter.cpp b/Source/core/paint/ImagePainter.cpp |
index f4388257d6c5f8bb97f712a37fc636ecb5e4f560..eba533765c9f31c94db88a30610855af789ac77a 100644 |
--- a/Source/core/paint/ImagePainter.cpp |
+++ b/Source/core/paint/ImagePainter.cpp |
@@ -64,7 +64,10 @@ void ImagePainter::paintAreaElementFocusRing(const PaintInfo& paintInfo) |
// https://crbug.com/251206 |
GraphicsContextStateSaver savedContext(*paintInfo.context); |
IntRect focusRect = m_renderImage.absoluteContentBox(); |
- RenderDrawingRecorder recorder(paintInfo.context, &m_renderImage, paintInfo.phase, focusRect); |
+ RenderDrawingRecorder recorder(paintInfo.context, m_renderImage, paintInfo.phase, focusRect); |
+ if (recorder.canUseCachedDrawing()) |
+ return; |
+ |
paintInfo.context->clip(focusRect); |
paintInfo.context->drawFocusRing(path, outlineWidth, |
areaElementStyle->outlineOffset(), |
@@ -85,7 +88,10 @@ void ImagePainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint& |
if (cWidth > 2 && cHeight > 2) { |
// Draw an outline rect where the image should be. |
IntRect paintRect = pixelSnappedIntRect(LayoutRect(paintOffset.x() + m_renderImage.borderLeft() + m_renderImage.paddingLeft(), paintOffset.y() + m_renderImage.borderTop() + m_renderImage.paddingTop(), cWidth, cHeight)); |
- RenderDrawingRecorder recorder(context, &m_renderImage, paintInfo.phase, paintRect); |
+ RenderDrawingRecorder recorder(context, m_renderImage, paintInfo.phase, paintRect); |
+ if (recorder.canUseCachedDrawing()) |
+ return; |
+ |
context->setStrokeStyle(SolidStroke); |
context->setStrokeColor(Color::lightGray); |
context->setFillColor(Color::transparent); |
@@ -96,7 +102,10 @@ void ImagePainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint& |
contentRect.moveBy(paintOffset); |
LayoutRect paintRect = m_renderImage.replacedContentRect(); |
paintRect.moveBy(paintOffset); |
- RenderDrawingRecorder recorder(context, &m_renderImage, paintInfo.phase, contentRect); |
+ RenderDrawingRecorder recorder(context, m_renderImage, paintInfo.phase, contentRect); |
+ if (recorder.canUseCachedDrawing()) |
+ return; |
+ |
bool clip = !contentRect.contains(paintRect); |
if (clip) { |
context->save(); |