| Index: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| index 47dfe4296a9a8aeefa3b9b225774817d354caf02..9791b58fd132a4603ab551f1452a7319dfe03dab 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| @@ -278,6 +278,7 @@ void HTMLCanvasElement::didDraw(const FloatRect& rect)
|
| m_dirtyRect.unite(rect);
|
| if (m_context && m_context->is2d() && hasImageBuffer())
|
| buffer()->didDraw(rect);
|
| + notifyListenersCanvasChanged();
|
| }
|
|
|
| void HTMLCanvasElement::didFinalizeFrame()
|
| @@ -392,13 +393,24 @@ bool HTMLCanvasElement::paintsIntoCanvasBuffer() const
|
|
|
| if (!m_context->isAccelerated())
|
| return true;
|
| -
|
| if (layoutBox() && layoutBox()->hasAcceleratedCompositing())
|
| return false;
|
|
|
| return true;
|
| }
|
|
|
| +void HTMLCanvasElement::notifyListenersCanvasChanged()
|
| +{
|
| + for (CanvasDrawListener* listener : m_listeners) {
|
| + if (listener->needsNewFrameCapture()) {
|
| + SourceImageStatus status;
|
| + RefPtr<Image> sourceImage = getSourceImageForCanvas(&status, PreferAcceleration);
|
| + ASSERT(status == NormalSourceImageStatus);
|
| + listener->setNewFrameCapture(sourceImage->imageForCurrentFrame());
|
| + }
|
| + }
|
| +}
|
| +
|
| void HTMLCanvasElement::paint(GraphicsContext* context, const LayoutRect& r)
|
| {
|
| // FIXME: crbug.com/438240; there is a bug with the new CSS blending and compositing feature.
|
| @@ -567,6 +579,17 @@ void HTMLCanvasElement::toBlob(FileCallback* callback, const String& mimeType, c
|
| }
|
| }
|
|
|
| +void HTMLCanvasElement::addListener(CanvasDrawListener* listener)
|
| +{
|
| + m_listeners.add(listener);
|
| + notifyListenersCanvasChanged();
|
| +}
|
| +
|
| +void HTMLCanvasElement::removeListener(CanvasDrawListener* listener)
|
| +{
|
| + m_listeners.remove(listener);
|
| +}
|
| +
|
| SecurityOrigin* HTMLCanvasElement::securityOrigin() const
|
| {
|
| return document().securityOrigin();
|
|
|