Add support for canvas.toBlob
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Mar 2017 04:12:15 +0000 (04:12 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Mar 2017 04:12:15 +0000 (04:12 +0000)
commit3e2bab1b4ca542d7957bf78ff0c10f23f89caff4
treeaba78af01bfa6094d02505c6a0cbc4581821431d
parent59ab3967f95f4502f1d17c30deef4ccfb5787792
Add support for canvas.toBlob
https://bugs.webkit.org/show_bug.cgi?id=148878
<rdar://problem/22590406>

Reviewed by Tim Horton.

LayoutTests/imported/w3c:

* web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.jpeg-expected.txt:
* web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.png-expected.txt:

Source/WebCore:

These tests now pass:
imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.jpeg.html
imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.png.html

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* fileapi/BlobCallback.cpp: Added.
(WebCore::BlobCallback::scheduleCallback):
* fileapi/BlobCallback.h: Added.
(WebCore::BlobCallback::~BlobCallback):
* fileapi/BlobCallback.idl: Added.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::toBlob):
* html/HTMLCanvasElement.h:
* html/HTMLCanvasElement.idl:
* platform/graphics/ImageBuffer.h:
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::writeFunction):
(WebCore::encodeImage):
(WebCore::ImageBuffer::toDataURL):
(WebCore::ImageBuffer::toData):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::data):
(WebCore::ImageBuffer::toDataURL):
(WebCore::ImageBuffer::toData):
(WebCore::ImageBuffer::toCGImage):
(WebCore::cgImage):
(WebCore::dataURL):
* platform/graphics/gtk/ImageBufferGtk.cpp:
(WebCore::ImageBuffer::toDataURL):
(WebCore::ImageBuffer::toData):
* platform/graphics/win/ImageBufferDirect2D.cpp:
(WebCore::ImageBuffer::toData):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213344 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.jpeg-expected.txt
LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.png-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/fileapi/BlobCallback.cpp [new file with mode: 0644]
Source/WebCore/fileapi/BlobCallback.h [new file with mode: 0644]
Source/WebCore/fileapi/BlobCallback.idl [new file with mode: 0644]
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/HTMLCanvasElement.h
Source/WebCore/html/HTMLCanvasElement.idl
Source/WebCore/platform/graphics/ImageBuffer.h
Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp
Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp