Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (213377 => 213378)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-03-03 21:15:28 UTC (rev 213378)
@@ -1,3 +1,15 @@
+2017-03-03 Ryan Haddad <[email protected]>
+
+ Unreviewed, rolling out r213344.
+
+ This changed caused LayoutTest crashes under GuardMalloc.
+
+ Reverted changeset:
+
+ "Add support for canvas.toBlob"
+ https://bugs.webkit.org/show_bug.cgi?id=148878
+ http://trac.webkit.org/changeset/213344
+
2017-03-02 Jiewen Tan <[email protected]>
WebCrypto API support for AES-GCM
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.jpeg-expected.txt (213377 => 213378)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.jpeg-expected.txt 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.jpeg-expected.txt 2017-03-03 21:15:28 UTC (rev 213378)
@@ -1,3 +1,5 @@
-PASS toBlob with image/jpeg returns a JPEG Blob
+FAIL toBlob with image/jpeg returns a JPEG Blob canvas.toBlob is not a function. (In 'canvas.toBlob(this.step_func_done(function(data) {
+ assert_equals(data.type, "image/jpeg");
+ }), 'image/jpeg')', 'canvas.toBlob' is undefined)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.png-expected.txt (213377 => 213378)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.png-expected.txt 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-canvas-element/toBlob.png-expected.txt 2017-03-03 21:15:28 UTC (rev 213378)
@@ -1,3 +1,5 @@
-PASS toBlob with image/png returns a PNG Blob
+FAIL toBlob with image/png returns a PNG Blob canvas.toBlob is not a function. (In 'canvas.toBlob(this.step_func_done(function(data) {
+ assert_equals(data.type, "image/png");
+ }), 'image/png')', 'canvas.toBlob' is undefined)
Modified: trunk/Source/WebCore/CMakeLists.txt (213377 => 213378)
--- trunk/Source/WebCore/CMakeLists.txt 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/CMakeLists.txt 2017-03-03 21:15:28 UTC (rev 213378)
@@ -475,7 +475,6 @@
dom/XMLDocument.idl
fileapi/Blob.idl
- fileapi/BlobCallback.idl
fileapi/BlobLineEndings.idl
fileapi/BlobPropertyBag.idl
fileapi/File.idl
@@ -1606,7 +1605,6 @@
fileapi/AsyncFileStream.cpp
fileapi/Blob.cpp
fileapi/BlobBuilder.cpp
- fileapi/BlobCallback.cpp
fileapi/BlobURL.cpp
fileapi/File.cpp
fileapi/FileException.cpp
Modified: trunk/Source/WebCore/ChangeLog (213377 => 213378)
--- trunk/Source/WebCore/ChangeLog 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/ChangeLog 2017-03-03 21:15:28 UTC (rev 213378)
@@ -1,3 +1,15 @@
+2017-03-03 Ryan Haddad <[email protected]>
+
+ Unreviewed, rolling out r213344.
+
+ This changed caused LayoutTest crashes under GuardMalloc.
+
+ Reverted changeset:
+
+ "Add support for canvas.toBlob"
+ https://bugs.webkit.org/show_bug.cgi?id=148878
+ http://trac.webkit.org/changeset/213344
+
2017-03-03 Konstantin Tokarev <[email protected]>
Unreviewed typo fix
Modified: trunk/Source/WebCore/DerivedSources.make (213377 => 213378)
--- trunk/Source/WebCore/DerivedSources.make 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/DerivedSources.make 2017-03-03 21:15:28 UTC (rev 213378)
@@ -404,7 +404,6 @@
$(WebCore)/dom/WheelEvent.idl \
$(WebCore)/dom/XMLDocument.idl \
$(WebCore)/fileapi/Blob.idl \
- $(WebCore)/fileapi/BlobCallback.idl \
$(WebCore)/fileapi/BlobLineEndings.idl \
$(WebCore)/fileapi/BlobPropertyBag.idl \
$(WebCore)/fileapi/File.idl \
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (213377 => 213378)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-03-03 21:15:28 UTC (rev 213378)
@@ -4033,10 +4033,6 @@
A149786E1ABAF33800CEF7E4 /* ContentFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A149786C1ABAF33800CEF7E4 /* ContentFilter.cpp */; };
A149786F1ABAF33800CEF7E4 /* ContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A149786D1ABAF33800CEF7E4 /* ContentFilter.h */; };
A14978711ABAF3A500CEF7E4 /* PlatformContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = A14978701ABAF3A500CEF7E4 /* PlatformContentFilter.h */; };
- A15D75151E68F7C400A35FBC /* BlobCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A15D75121E68F7B100A35FBC /* BlobCallback.cpp */; };
- A15D75161E68F7C800A35FBC /* BlobCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = A15D75131E68F7B100A35FBC /* BlobCallback.h */; };
- A15D751A1E68F89E00A35FBC /* JSBlobCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A15D75171E68F83600A35FBC /* JSBlobCallback.cpp */; };
- A15D751B1E68F8A300A35FBC /* JSBlobCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = A15D75181E68F83600A35FBC /* JSBlobCallback.h */; };
A15E31F31E0CB0B2004B371C /* QuickLook.mm in Sources */ = {isa = PBXBuildFile; fileRef = A15E31F21E0CB0AA004B371C /* QuickLook.mm */; };
A15E31F41E0CB0B5004B371C /* QuickLook.h in Headers */ = {isa = PBXBuildFile; fileRef = A15E31F11E0CB0AA004B371C /* QuickLook.h */; settings = {ATTRIBUTES = (Private, ); }; };
A15E6BF11E212A6A0080AF34 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A15E6BF01E212A6A0080AF34 /* Foundation.framework */; };
@@ -11900,11 +11896,6 @@
A149786C1ABAF33800CEF7E4 /* ContentFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentFilter.cpp; sourceTree = "<group>"; };
A149786D1ABAF33800CEF7E4 /* ContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentFilter.h; sourceTree = "<group>"; };
A14978701ABAF3A500CEF7E4 /* PlatformContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformContentFilter.h; sourceTree = "<group>"; };
- A15D75121E68F7B100A35FBC /* BlobCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobCallback.cpp; sourceTree = "<group>"; };
- A15D75131E68F7B100A35FBC /* BlobCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobCallback.h; sourceTree = "<group>"; };
- A15D75141E68F7B100A35FBC /* BlobCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BlobCallback.idl; sourceTree = "<group>"; };
- A15D75171E68F83600A35FBC /* JSBlobCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSBlobCallback.cpp; sourceTree = "<group>"; };
- A15D75181E68F83600A35FBC /* JSBlobCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBlobCallback.h; sourceTree = "<group>"; };
A15E31F11E0CB0AA004B371C /* QuickLook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickLook.h; sourceTree = "<group>"; };
A15E31F21E0CB0AA004B371C /* QuickLook.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = QuickLook.mm; sourceTree = "<group>"; };
A15E6BF01E212A6A0080AF34 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -18960,8 +18951,6 @@
children = (
2E2D99CB10E2BBDA00496337 /* JSBlob.cpp */,
2E2D99CC10E2BBDA00496337 /* JSBlob.h */,
- A15D75171E68F83600A35FBC /* JSBlobCallback.cpp */,
- A15D75181E68F83600A35FBC /* JSBlobCallback.h */,
7C77C3D91DEF86D700A50BFA /* JSBlobLineEndings.cpp */,
7C77C3DA1DEF86D700A50BFA /* JSBlobLineEndings.h */,
7C77C3D21DEF178E00A50BFA /* JSBlobPropertyBag.cpp */,
@@ -19896,9 +19885,6 @@
14A98E05136386A200C9FED2 /* Blob.idl */,
976D6C5C122B8A3D001FD1F7 /* BlobBuilder.cpp */,
976D6C5D122B8A3D001FD1F7 /* BlobBuilder.h */,
- A15D75121E68F7B100A35FBC /* BlobCallback.cpp */,
- A15D75131E68F7B100A35FBC /* BlobCallback.h */,
- A15D75141E68F7B100A35FBC /* BlobCallback.idl */,
7C77C3D61DEF850A00A50BFA /* BlobLineEndings.h */,
7C77C3D81DEF854000A50BFA /* BlobLineEndings.idl */,
7C77C3D01DEE472400A50BFA /* BlobPropertyBag.h */,
@@ -26932,7 +26918,6 @@
1AE2ABAB0A1CE90500B42B25 /* JSHTMLPreElement.h in Headers */,
A4226E5C1163D695008B8397 /* JSHTMLProgressElement.h in Headers */,
1AE2AEC80A1D297B00B42B25 /* JSHTMLQuoteElement.h in Headers */,
- A15D751B1E68F8A300A35FBC /* JSBlobCallback.h in Headers */,
1AE2ABAD0A1CE90500B42B25 /* JSHTMLScriptElement.h in Headers */,
E1E6EEA80B628DB3005F2F70 /* JSHTMLSelectElement.h in Headers */,
AB4CB4EB0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h in Headers */,
@@ -28328,7 +28313,6 @@
FEE1811416C319E800084849 /* SQLTransactionBackend.h in Headers */,
97BC6A521505F081001B74AC /* SQLTransactionCallback.h in Headers */,
97BC6A571505F081001B74AC /* SQLTransactionCoordinator.h in Headers */,
- A15D75161E68F7C800A35FBC /* BlobCallback.h in Headers */,
97BC6A581505F081001B74AC /* SQLTransactionErrorCallback.h in Headers */,
FE36FD1816C7826500F887C1 /* SQLTransactionState.h in Headers */,
FE36FD1716C7826500F887C1 /* SQLTransactionStateMachine.h in Headers */,
@@ -31111,7 +31095,6 @@
B2FA3E080AB75A6F000E5AC4 /* JSSVGTitleElement.cpp in Sources */,
B2FA3E0A0AB75A6F000E5AC4 /* JSSVGTransform.cpp in Sources */,
B2FA3E0C0AB75A6F000E5AC4 /* JSSVGTransformList.cpp in Sources */,
- A15D75151E68F7C400A35FBC /* BlobCallback.cpp in Sources */,
B2FA3E0E0AB75A6F000E5AC4 /* JSSVGTRefElement.cpp in Sources */,
B2FA3E100AB75A6F000E5AC4 /* JSSVGTSpanElement.cpp in Sources */,
B2FA3E120AB75A6F000E5AC4 /* JSSVGUnitTypes.cpp in Sources */,
@@ -32463,7 +32446,6 @@
444D4E230F708B2E003158E0 /* WebCoreURLResponseIOS.mm in Sources */,
93F19B0708245E59001E9ABC /* WebCoreView.m in Sources */,
A5E616731894581F009ADF50 /* WebDebuggerAgent.cpp in Sources */,
- A15D751A1E68F89E00A35FBC /* JSBlobCallback.cpp in Sources */,
FE0D84EB1048436E001A179E /* WebEvent.mm in Sources */,
225A16B60D5C11E900090295 /* WebEventRegion.mm in Sources */,
D3F3D36D1A69B7DC0059FC2B /* WebGL2RenderingContext.cpp in Sources */,
Deleted: trunk/Source/WebCore/fileapi/BlobCallback.cpp (213377 => 213378)
--- trunk/Source/WebCore/fileapi/BlobCallback.cpp 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/fileapi/BlobCallback.cpp 2017-03-03 21:15:28 UTC (rev 213378)
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "BlobCallback.h"
-
-#include "Blob.h"
-#include "ScriptExecutionContext.h"
-
-namespace WebCore {
-
-void BlobCallback::scheduleCallback(ScriptExecutionContext& context, RefPtr<Blob>&& blob)
-{
- context.postTask([this, protectedThis = makeRef(*this), blob = WTFMove(blob)](ScriptExecutionContext&) {
- handleEvent(blob.get());
- });
-}
-
-} // namespace WebCore
Deleted: trunk/Source/WebCore/fileapi/BlobCallback.h (213377 => 213378)
--- trunk/Source/WebCore/fileapi/BlobCallback.h 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/fileapi/BlobCallback.h 2017-03-03 21:15:28 UTC (rev 213378)
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class Blob;
-class ScriptExecutionContext;
-
-class BlobCallback : public RefCounted<BlobCallback> {
-public:
- virtual ~BlobCallback() { }
- virtual bool handleEvent(Blob*) = 0;
-
- void scheduleCallback(ScriptExecutionContext&, RefPtr<Blob>&&);
-};
-
-} // namespace WebCore
Deleted: trunk/Source/WebCore/fileapi/BlobCallback.idl (213377 => 213378)
--- trunk/Source/WebCore/fileapi/BlobCallback.idl 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/fileapi/BlobCallback.idl 2017-03-03 21:15:28 UTC (rev 213378)
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-callback BlobCallback = void (Blob? blob);
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (213377 => 213378)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2017-03-03 21:15:28 UTC (rev 213378)
@@ -28,8 +28,6 @@
#include "config.h"
#include "HTMLCanvasElement.h"
-#include "Blob.h"
-#include "BlobCallback.h"
#include "CanvasGradient.h"
#include "CanvasPattern.h"
#include "CanvasRenderingContext2D.h"
@@ -487,36 +485,6 @@
return buffer()->toDataURL(encodingMIMEType, quality);
}
-ExceptionOr<void> HTMLCanvasElement::toBlob(ScriptExecutionContext& context, Ref<BlobCallback>&& callback, const String& mimeType, JSC::JSValue qualityValue)
-{
- if (!m_originClean)
- return Exception { SECURITY_ERR };
-
- if (m_size.isEmpty() || !buffer()) {
- callback->scheduleCallback(context, nullptr);
- return { };
- }
-
- String encodingMIMEType = toEncodingMimeType(mimeType);
- std::optional<double> quality;
- if (qualityValue.isNumber())
- quality = qualityValue.toNumber(context.execState());
-
-#if USE(CG)
- if (auto imageData = getImageData()) {
- Vector<uint8_t> blobData = data(*imageData, encodingMIMEType, quality);
- callback->scheduleCallback(context, Blob::create(WTFMove(blobData), encodingMIMEType));
- return { };
- }
-#endif
-
- makeRenderingResultsAvailable();
-
- Vector<uint8_t> blobData = buffer()->toData(encodingMIMEType, quality);
- callback->scheduleCallback(context, Blob::create(WTFMove(blobData), encodingMIMEType));
- return { };
-}
-
RefPtr<ImageData> HTMLCanvasElement::getImageData()
{
#if ENABLE(WEBGL)
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (213377 => 213378)
--- trunk/Source/WebCore/html/HTMLCanvasElement.h 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h 2017-03-03 21:15:28 UTC (rev 213378)
@@ -39,7 +39,6 @@
namespace WebCore {
-class BlobCallback;
class CanvasRenderingContext;
class GraphicsContext;
class GraphicsContextStateSaver;
@@ -102,7 +101,6 @@
static String toEncodingMimeType(const String& mimeType);
WEBCORE_EXPORT ExceptionOr<String> toDataURL(const String& mimeType, std::optional<double> quality);
ExceptionOr<String> toDataURL(const String& mimeType) { return toDataURL(mimeType, std::nullopt); }
- ExceptionOr<void> toBlob(ScriptExecutionContext&, Ref<BlobCallback>&&, const String& mimeType, JSC::JSValue qualityValue);
// Used for rendering
void didDraw(const FloatRect&);
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.idl (213377 => 213378)
--- trunk/Source/WebCore/html/HTMLCanvasElement.idl 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.idl 2017-03-03 21:15:28 UTC (rev 213378)
@@ -37,5 +37,4 @@
[Custom] RenderingContext? getContext(DOMString contextId, any... arguments);
[Custom, MayThrowException] DOMString toDataURL(optional DOMString? type);
- [CallWith=ScriptExecutionContext, MayThrowException] void toBlob(BlobCallback callback, optional DOMString type, optional any quality);
};
Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (213377 => 213378)
--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2017-03-03 21:15:28 UTC (rev 213378)
@@ -112,7 +112,6 @@
void convertToLuminanceMask();
String toDataURL(const String& mimeType, std::optional<double> quality = std::nullopt, CoordinateSystem = LogicalCoordinateSystem) const;
- Vector<uint8_t> toData(const String& mimeType, std::optional<double> quality = std::nullopt) const;
#if !USE(CG)
AffineTransform baseTransform() const { return AffineTransform(); }
void transformColorSpace(ColorSpace srcColorSpace, ColorSpace dstColorSpace);
@@ -175,7 +174,6 @@
WEBCORE_EXPORT ImageBuffer(const FloatSize&, float resolutionScale, ColorSpace, RenderingMode, bool& success);
#if USE(CG)
ImageBuffer(const FloatSize&, float resolutionScale, CGColorSpaceRef, RenderingMode, bool& success);
- RetainPtr<CGImageRef> toCGImage(const String& mimeType) const;
#elif USE(DIRECT2D)
ImageBuffer(const FloatSize&, float resolutionScale, ColorSpace, RenderingMode, const GraphicsContext*, bool& success);
#endif
@@ -183,7 +181,6 @@
#if USE(CG)
String dataURL(const ImageData&, const String& mimeType, std::optional<double> quality);
-Vector<uint8_t> data(const ImageData&, const String& mimeType, std::optional<double> quality);
#endif
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp (213377 => 213378)
--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp 2017-03-03 21:15:28 UTC (rev 213378)
@@ -539,12 +539,12 @@
#if !PLATFORM(GTK)
static cairo_status_t writeFunction(void* output, const unsigned char* data, unsigned int length)
{
- if (!reinterpret_cast<Vector<uint8_t>*>(output)->tryAppend(data, length))
+ if (!reinterpret_cast<Vector<unsigned char>*>(output)->tryAppend(data, length))
return CAIRO_STATUS_WRITE_ERROR;
return CAIRO_STATUS_SUCCESS;
}
-static bool encodeImage(cairo_surface_t* image, const String& mimeType, Vector<uint8_t>* output)
+static bool encodeImage(cairo_surface_t* image, const String& mimeType, Vector<char>* output)
{
ASSERT_UNUSED(mimeType, mimeType == "image/png"); // Only PNG output is supported for now.
@@ -553,29 +553,19 @@
String ImageBuffer::toDataURL(const String& mimeType, std::optional<double>, CoordinateSystem) const
{
- Vector<uint8_t> encodedImage = toData(mimeType, quality);
- if (encodedImage.isEmpty())
- return "data:,";
-
- Vector<char> base64Data;
- base64Encode(encodedImage.data(), encodedImage.size(), base64Data);
-
- return "data:" + mimeType + ";base64," + base64Data;
-}
-
-Vector<uint8_t> ImageBuffer::toData(const String& mimeType, std::optional<double> quality) const
-{
ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
cairo_surface_t* image = cairo_get_target(context().platformContext()->cr());
- Vector<uint8_t> encodedImage;
+ Vector<char> encodedImage;
if (!image || !encodeImage(image, mimeType, &encodedImage))
- return { };
+ return "data:,";
- return encodedImage;
+ Vector<char> base64Data;
+ base64Encode(encodedImage, base64Data);
+
+ return "data:" + mimeType + ";base64," + base64Data;
}
-
#endif
#if ENABLE(ACCELERATED_2D_CANVAS) && !USE(COORDINATED_GRAPHICS_THREADED)
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (213377 => 213378)
--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp 2017-03-03 21:15:28 UTC (rev 213378)
@@ -498,36 +498,8 @@
return "data:" + mimeType + ";base64," + base64Data;
}
-static Vector<uint8_t> data(CGImageRef image, const String& mimeType, std::optional<double> quality)
-{
- auto uti = utiFromMIMEType(mimeType);
- ASSERT(uti);
-
- auto cfData = adoptCF(CFDataCreateMutable(kCFAllocatorDefault, 0));
- if (!encodeImage(image, uti.get(), quality, cfData.get()))
- return { };
-
- Vector<uint8_t> data;
- data.append(CFDataGetBytePtr(cfData.get()), CFDataGetLength(cfData.get()));
- return data;
-}
-
String ImageBuffer::toDataURL(const String& mimeType, std::optional<double> quality, CoordinateSystem) const
{
- if (auto image = toCGImage(mimeType))
- return dataURL(image.get(), mimeType, quality);
- return ASCIILiteral("data:,");
-}
-
-Vector<uint8_t> ImageBuffer::toData(const String& mimeType, std::optional<double> quality) const
-{
- if (auto image = toCGImage(mimeType))
- return data(image.get(), mimeType, quality);
- return { };
-}
-
-RetainPtr<CGImageRef> ImageBuffer::toCGImage(const String& mimeType) const
-{
ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
if (context().isAcceleratedContext())
@@ -543,13 +515,14 @@
// JPEGs don't have an alpha channel, so we have to manually composite on top of black.
premultipliedData = getPremultipliedImageData(IntRect(IntPoint(0, 0), logicalSize()));
if (!premultipliedData)
- return nullptr;
+ return ASCIILiteral("data:,");
auto dataProvider = adoptCF(CGDataProviderCreateWithData(0, premultipliedData->data(), 4 * logicalSize().width() * logicalSize().height(), 0));
if (!dataProvider)
- return nullptr;
+ return ASCIILiteral("data:,");
- image = adoptCF(CGImageCreate(logicalSize().width(), logicalSize().height(), 8, 32, 4 * logicalSize().width(), sRGBColorSpaceRef(), kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
+ image = adoptCF(CGImageCreate(logicalSize().width(), logicalSize().height(), 8, 32, 4 * logicalSize().width(),
+ sRGBColorSpaceRef(), kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
} else if (m_resolutionScale == 1) {
image = copyNativeImage(CopyBackingStore);
image = createCroppedImageIfNecessary(image.get(), internalSize());
@@ -563,10 +536,10 @@
image = adoptCF(CGBitmapContextCreateImage(context.get()));
}
- return image;
+ return dataURL(image.get(), mimeType, quality);
}
-static RetainPtr<CGImageRef> cgImage(const ImageData& source, const String& mimeType)
+String dataURL(const ImageData& source, const String& mimeType, std::optional<double> quality)
{
ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
@@ -581,7 +554,7 @@
// JPEGs don't have an alpha channel, so we have to manually composite on top of black.
size_t size = 4 * source.width() * source.height();
if (!premultipliedData.tryReserveCapacity(size))
- return nullptr;
+ return ASCIILiteral("data:,");
premultipliedData.resize(size);
unsigned char *buffer = premultipliedData.data();
@@ -604,26 +577,13 @@
auto dataProvider = adoptCF(CGDataProviderCreateWithData(0, data, 4 * source.width() * source.height(), 0));
if (!dataProvider)
- return nullptr;
+ return ASCIILiteral("data:,");
- auto image = adoptCF(CGImageCreate(source.width(), source.height(), 8, 32, 4 * source.width(), sRGBColorSpaceRef(), kCGBitmapByteOrderDefault | dataAlphaInfo, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
- return image;
+ auto image = adoptCF(CGImageCreate(source.width(), source.height(), 8, 32, 4 * source.width(),
+ sRGBColorSpaceRef(), kCGBitmapByteOrderDefault | dataAlphaInfo, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
+ return dataURL(image.get(), mimeType, quality);
}
-String dataURL(const ImageData& source, const String& mimeType, std::optional<double> quality)
-{
- if (auto image = cgImage(source, mimeType))
- return dataURL(image.get(), mimeType, quality);
- return ASCIILiteral("data:,");
-}
-
-Vector<uint8_t> data(const ImageData& source, const String& mimeType, std::optional<double> quality)
-{
- if (auto image = cgImage(source, mimeType))
- return data(image.get(), mimeType, quality);
- return { };
-}
-
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp (213377 => 213378)
--- trunk/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp 2017-03-03 21:15:28 UTC (rev 213378)
@@ -77,28 +77,17 @@
String ImageBuffer::toDataURL(const String& mimeType, std::optional<double> quality, CoordinateSystem) const
{
- Vector<uint8_t> imageData = toData(mimeType, quality);
- if (imageData.isEmpty())
- return "data:,";
-
- Vector<char> base64Data;
- base64Encode(imageData.data(), imageData.size(), base64Data);
-
- return "data:" + mimeType + ";base64," + base64Data;
-}
-
-Vector<uint8_t> ImageBuffer::toData(const String& mimeType, std::optional<double> quality) const
-{
ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
GUniqueOutPtr<gchar> buffer;
gsize bufferSize;
if (!encodeImage(m_data.m_surface.get(), mimeType, quality, buffer, bufferSize))
- return { };
+ return "data:,";
- Vector<uint8_t> imageData;
- imageData.append(buffer.get(), bufferSize);
- return imageData;
+ Vector<char> base64Data;
+ base64Encode(buffer.get(), bufferSize, base64Data);
+
+ return "data:" + mimeType + ";base64," + base64Data;
}
}
Modified: trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp (213377 => 213378)
--- trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp 2017-03-03 21:14:03 UTC (rev 213377)
+++ trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp 2017-03-03 21:15:28 UTC (rev 213378)
@@ -260,12 +260,6 @@
return ASCIILiteral("data:,");
}
-Vector<uint8_t> ImageBuffer::toData(const String& mimeType, std::optional<double> quality) const
-{
- notImplemented();
- return { };
-}
-
String ImageDataToDataURL(const ImageData& source, const String& mimeType, const double* quality)
{
notImplemented();