| Index: third_party/WebKit/Source/core/paint/HTMLCanvasPainter.cpp
|
| diff --git a/third_party/WebKit/Source/core/paint/HTMLCanvasPainter.cpp b/third_party/WebKit/Source/core/paint/HTMLCanvasPainter.cpp
|
| index a1136ebb46d64e5e8271b9707761a5f205f9caab..4ec8ab0f32b3c32194deed8d12a9606ce5daa3f1 100644
|
| --- a/third_party/WebKit/Source/core/paint/HTMLCanvasPainter.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/HTMLCanvasPainter.cpp
|
| @@ -5,25 +5,41 @@
|
| #include "core/paint/HTMLCanvasPainter.h"
|
|
|
| #include "core/html/HTMLCanvasElement.h"
|
| +#include "core/html/canvas/CanvasRenderingContext.h"
|
| #include "core/layout/LayoutHTMLCanvas.h"
|
| #include "core/paint/LayoutObjectDrawingRecorder.h"
|
| #include "core/paint/PaintInfo.h"
|
| #include "platform/geometry/LayoutPoint.h"
|
| #include "platform/graphics/paint/ClipRecorder.h"
|
| +#include "platform/graphics/paint/ForeignLayerDisplayItem.h"
|
|
|
| namespace blink {
|
|
|
| void HTMLCanvasPainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
|
| {
|
| GraphicsContext& context = paintInfo.context;
|
| - if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layoutHTMLCanvas, paintInfo.phase))
|
| - return;
|
|
|
| LayoutRect contentRect = m_layoutHTMLCanvas.contentBoxRect();
|
| contentRect.moveBy(paintOffset);
|
| LayoutRect paintRect = m_layoutHTMLCanvas.replacedContentRect();
|
| paintRect.moveBy(paintOffset);
|
|
|
| + HTMLCanvasElement* canvas = toHTMLCanvasElement(m_layoutHTMLCanvas.node());
|
| +
|
| + if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()
|
| + && canvas->renderingContext() && canvas->renderingContext()->isAccelerated()) {
|
| + if (WebLayer* layer = canvas->renderingContext()->platformLayer()) {
|
| + IntRect pixelSnappedRect = pixelSnappedIntRect(contentRect);
|
| + recordForeignLayer(
|
| + context, m_layoutHTMLCanvas, DisplayItem::ForeignLayerCanvas,
|
| + layer, pixelSnappedRect.location(), pixelSnappedRect.size());
|
| + return;
|
| + }
|
| + }
|
| +
|
| + if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layoutHTMLCanvas, paintInfo.phase))
|
| + return;
|
| +
|
| LayoutObjectDrawingRecorder drawingRecorder(context, m_layoutHTMLCanvas, paintInfo.phase, contentRect);
|
| #if ENABLE(ASSERT)
|
| // The drawing may be in display list mode or image mode, producing different pictures for the same result.
|
| @@ -45,7 +61,7 @@ void HTMLCanvasPainter::paintReplaced(const PaintInfo& paintInfo, const LayoutPo
|
|
|
| InterpolationQuality previousInterpolationQuality = context.imageInterpolationQuality();
|
| context.setImageInterpolationQuality(interpolationQuality);
|
| - toHTMLCanvasElement(m_layoutHTMLCanvas.node())->paint(context, paintRect);
|
| + canvas->paint(context, paintRect);
|
| context.setImageInterpolationQuality(previousInterpolationQuality);
|
|
|
| if (clip)
|
|
|