toDataURL() uses stale data after putImageData()
authormdelaney@apple.com <mdelaney@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Feb 2012 20:54:13 +0000 (20:54 +0000)
committermdelaney@apple.com <mdelaney@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 6 Feb 2012 20:54:13 +0000 (20:54 +0000)
commit4382025fa39d743311e372e8adf879c71b0603cc
tree2d08fd2db6c607896b678f1a2b71b220cd8b4abb
parent99bb4622825e3d55fec71d9f77be057cb7ee9a33
toDataURL() uses stale data after putImageData()
https://bugs.webkit.org/show_bug.cgi?id=65767

Source/WebCore:

This patch fixes the issue we've encountered of getting back
stale copies of the CGContext of accelerated ImageBuffers who have seen
putImageData calls but have not been drawn into via the CG API.
This issue is fixed by modifying the way we implement putImageData
in ImageBufferCG to draw the bits wrapped in a CGImage while the CGContext
is in a state where the data will effectively be copied (as is needed for
implementing putImageData) instead of directly modifying the bits of the IOSurface.

Reviewed by Chris Marrin.

Test: fast/canvas/check-stale-putImageData, pixel test to check that the canvas is in fact painted.

* platform/graphics/cg/ImageBufferCG.cpp: Implement new way of putting image data.
* platform/graphics/ImageBuffer.h: Merged two previously separate put data calls
    into a single and more sensibly named 'putByteArray', since that's what it does!

* WebCore.exp.in: Added new WKSI call for use in ImageBufferCG.cpp
* platform/mac/WebCoreSystemInterface.h:
* platform/mac/WebCoreSystemInterface.mm:

Using new method name.
* html/canvas/CanvasRenderingContext2D.cpp:
* platform/graphics/ImageBuffer.cpp:
* platform/graphics/ShadowBlur.cpp:
* platform/graphics/filters/FEColorMatrix.cpp:
* platform/graphics/filters/FEDropShadow.cpp:
* platform/graphics/filters/FilterEffect.cpp:

Updated other ports' ImageBuffers to use new method.
* platform/graphics/cairo/ImageBufferCairo.cpp:
* platform/graphics/qt/ImageBufferQt.cpp:
* platform/graphics/skia/ImageBufferSkia.cpp:
* platform/graphics/wince/ImageBufferWinCE.cpp:
* platform/graphics/wx/ImageBufferWx.cpp:

Source/WebKit/chromium:

Reviewed by Chris Marrin.

* src/WebViewImpl.cpp: Updated method name.
(WebKit::WebViewImpl::doPixelReadbackToCanvas):

Source/WebKit/mac:

Reviewed by Chris Marrin.

* WebCoreSupport/WebSystemInterface.mm:

Source/WebKit2:

Reviewed by Chris Marrin.

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface):

WebKitLibraries:

Added WKCGContextResetClip for use in reseting clip for new putByteArray method.

Reviewed by Chris Marrin.

* WebKitSystemInterface.h: Added WKCGContextResetClip.
* libWebKitSystemInterfaceLeopard.a:
* libWebKitSystemInterfaceSnowLeopard.a:
* libWebKitSystemInterfaceLion.a:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
LayoutTests/fast/canvas/check-stale-putImageData-expected.png [new file with mode: 0644]
LayoutTests/fast/canvas/check-stale-putImageData-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/check-stale-putImageData.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
Source/WebCore/platform/graphics/ImageBuffer.cpp
Source/WebCore/platform/graphics/ImageBuffer.h
Source/WebCore/platform/graphics/ShadowBlur.cpp
Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp
Source/WebCore/platform/graphics/filters/FEDropShadow.cpp
Source/WebCore/platform/graphics/filters/FilterEffect.cpp
Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp
Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp
Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp
Source/WebCore/platform/mac/WebCoreSystemInterface.h
Source/WebCore/platform/mac/WebCoreSystemInterface.mm
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
WebKitLibraries/ChangeLog
WebKitLibraries/WebKitSystemInterface.h
WebKitLibraries/libWebKitSystemInterfaceLeopard.a
WebKitLibraries/libWebKitSystemInterfaceLion.a
WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a