| 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 63e6b6c1df0643300ef89950c14a23c6eba6add2..9c4e8a87ee3540c3c94eac9c1f67d86038472f71 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
|
| @@ -329,7 +329,17 @@ void HTMLCanvasElement::didDraw(const FloatRect& rect) {
|
| void HTMLCanvasElement::finalizeFrame() {
|
| if (hasImageBuffer())
|
| m_imageBuffer->finalizeFrame();
|
| - notifyListenersCanvasChanged();
|
| +
|
| + // If the canvas is visible, notifying listeners is taken
|
| + // care of in the in doDeferredPaintInvalidation, which allows
|
| + // the frame to be grabbed prior to compositing, which is
|
| + // critically important because compositing may clear the canvas's
|
| + // image. (e.g. WebGL context with preserveDrawingBuffer=false).
|
| + // If the canvas is not visible, doDeferredPaintInvalidation
|
| + // will not get called, so we need to take care of business here.
|
| + if (!m_didNotifyListenersForCurrentFrame)
|
| + notifyListenersCanvasChanged();
|
| + m_didNotifyListenersForCurrentFrame = false;
|
| }
|
|
|
| void HTMLCanvasElement::didDisableAcceleration() {
|
| @@ -371,6 +381,9 @@ void HTMLCanvasElement::doDeferredPaintInvalidation() {
|
| if (m_dirtyRect.isEmpty())
|
| return;
|
|
|
| + notifyListenersCanvasChanged();
|
| + m_didNotifyListenersForCurrentFrame = true;
|
| +
|
| // Propagate the m_dirtyRect accumulated so far to the compositor
|
| // before restarting with a blank dirty rect.
|
| FloatRect srcRect(0, 0, size().width(), size().height());
|
|
|