Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (219228 => 219229)
--- trunk/Source/WebCore/CMakeLists.txt 2017-07-07 01:11:00 UTC (rev 219228)
+++ trunk/Source/WebCore/CMakeLists.txt 2017-07-07 01:16:06 UTC (rev 219229)
@@ -1147,6 +1147,7 @@
bindings/js/JSDOMConvertDate.cpp
bindings/js/JSDOMConvertNumbers.cpp
bindings/js/JSDOMConvertStrings.cpp
+ bindings/js/JSDOMConvertWebGL.cpp
bindings/js/JSDOMIterator.cpp
bindings/js/JSFontFaceCustom.cpp
bindings/js/JSFontFaceSetCustom.cpp
@@ -3174,7 +3175,6 @@
html/canvas/OESTextureHalfFloatLinear.cpp
html/canvas/OESVertexArrayObject.cpp
html/canvas/WebGL2RenderingContext.cpp
- html/canvas/WebGLAny.cpp
html/canvas/WebGLBuffer.cpp
html/canvas/WebGLCompressedTextureATC.cpp
html/canvas/WebGLCompressedTexturePVRTC.cpp
Modified: trunk/Source/WebCore/ChangeLog (219228 => 219229)
--- trunk/Source/WebCore/ChangeLog 2017-07-07 01:11:00 UTC (rev 219228)
+++ trunk/Source/WebCore/ChangeLog 2017-07-07 01:16:06 UTC (rev 219229)
@@ -1,3 +1,52 @@
+2017-07-06 Sam Weinig <s...@webkit.org>
+
+ [WebIDL] Remove custom bindings for WebGL code dealing with WebGL extensions
+ https://bugs.webkit.org/show_bug.cgi?id=174186
+
+ Reviewed by Alex Christensen.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ Update files. Categorize some of the remaining custom bindings into groups.
+
+ * bindings/IDLTypes.h:
+ Add a IDLWebGLExtension type, to model the special WebGLExtension type. In
+ the future, WebGLExtension can probably be replaced by a Variant.
+
+ * bindings/js/JSDOMConvertWebGL.cpp: Added.
+ Move WebGLAny's convertToJSValue and add a convertToJSValue for WebGLExtension.
+
+ * bindings/js/JSDOMConvertWebGL.h:
+ (WebCore::convertToJSValue):
+ Since WebGLExtension is a wrapper type, we need both a pointer and reference variant
+ of the conversion.
+
+ (WebCore::JSConverter<IDLWebGLExtension>::convert):
+ Added.
+
+ * bindings/js/JSWebGL2RenderingContextCustom.cpp:
+ (WebCore::toJS): Deleted.
+ (WebCore::JSWebGL2RenderingContext::getExtension): Deleted.
+ Remove custom operation and converter.
+
+ * bindings/js/JSWebGLRenderingContextCustom.cpp:
+ (WebCore::toJS): Deleted.
+ (WebCore::JSWebGLRenderingContext::getExtension): Deleted.
+ Remove custom operation and converter.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (AddToIncludesForIDLType):
+ (NativeToJSValueDOMConvertNeedsState):
+ (NativeToJSValueDOMConvertNeedsGlobalObject):
+ Add support for IDLWebGLExtension.
+
+ * html/canvas/WebGLAny.cpp: Removed.
+ * html/canvas/WebGLAny.h:
+ Moved convertToJSValue to the bindings where it belongs.
+
+ * html/canvas/WebGLRenderingContextBase.idl:
+ Annotate getExtension with [OverrideIDLType=IDLWebGLExtension].
+
2017-07-06 Joseph Pecoraro <pecor...@apple.com>
[Cocoa] CTParagraphStyle leak under WebCore::LinkImageLayout::LinkImageLayout
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (219228 => 219229)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-07-07 01:11:00 UTC (rev 219228)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-07-07 01:16:06 UTC (rev 219229)
@@ -2906,7 +2906,6 @@
6E3FAE8E14733FDB00E42307 /* WebGLDepthTexture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAE8C14733FDB00E42307 /* WebGLDepthTexture.cpp */; };
6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextureS3TC.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */; };
6E3FAE8F14733FDB00E42307 /* WebGLDepthTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42307 /* WebGLDepthTexture.h */; };
- 6E47E66010B7944B00B186C8 /* WebGLAny.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E47E65E10B7944B00B186C8 /* WebGLAny.cpp */; };
6E47E66110B7944B00B186C8 /* WebGLAny.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E47E65F10B7944B00B186C8 /* WebGLAny.h */; settings = {ATTRIBUTES = (Private, ); }; };
6E4ABCD4138EA0B70071D291 /* JSHTMLUnknownElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4ABCD2138EA0B70071D291 /* JSHTMLUnknownElement.cpp */; };
6E4ABCD5138EA0B70071D291 /* JSHTMLUnknownElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4ABCD3138EA0B70071D291 /* JSHTMLUnknownElement.h */; };
@@ -3259,6 +3258,7 @@
7C9DBFEE1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9DBFEC1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h */; };
7CB5CA3F1E525C7100FAEF13 /* MediaQueryExpression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CB5CA3D1E525C6C00FAEF13 /* MediaQueryExpression.cpp */; };
7CB5CA401E525C7300FAEF13 /* MediaQueryExpression.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CB5CA3E1E525C6C00FAEF13 /* MediaQueryExpression.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 7CBA5BA71F0B4BDE0034D745 /* JSDOMConvertWebGL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CBA5BA61F0B4BDE0034D745 /* JSDOMConvertWebGL.cpp */; };
7CC01D0A1E4A7B0400E529CC /* JSDOMBuiltinConstructorBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0CEF2E1E4A5832008DEB80 /* JSDOMBuiltinConstructorBase.cpp */; };
7CC01D0B1E4A7B0400E529CC /* JSDOMConstructorBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0CEF2F1E4A58AD008DEB80 /* JSDOMConstructorBase.cpp */; };
7CC01D0C1E4A7B0400E529CC /* JSDOMConstructorWithDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0CEF301E4A58F1008DEB80 /* JSDOMConstructorWithDocument.cpp */; };
@@ -10759,7 +10759,6 @@
6E3FAE8D14733FDB00E42307 /* WebGLDepthTexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLDepthTexture.h; sourceTree = "<group>"; };
6E3FAE9014733FEA00E42306 /* WebGLCompressedTextureS3TC.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGLCompressedTextureS3TC.idl; sourceTree = "<group>"; };
6E3FAE9014733FEA00E42307 /* WebGLDepthTexture.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGLDepthTexture.idl; sourceTree = "<group>"; };
- 6E47E65E10B7944B00B186C8 /* WebGLAny.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGLAny.cpp; sourceTree = "<group>"; };
6E47E65F10B7944B00B186C8 /* WebGLAny.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLAny.h; sourceTree = "<group>"; };
6E4ABCD2138EA0B70071D291 /* JSHTMLUnknownElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLUnknownElement.cpp; sourceTree = "<group>"; };
6E4ABCD3138EA0B70071D291 /* JSHTMLUnknownElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLUnknownElement.h; sourceTree = "<group>"; };
@@ -11364,6 +11363,7 @@
7C9DBFEC1A9C49B1000D6B25 /* JSHTMLAttachmentElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLAttachmentElement.h; sourceTree = "<group>"; };
7CB5CA3D1E525C6C00FAEF13 /* MediaQueryExpression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQueryExpression.cpp; sourceTree = "<group>"; };
7CB5CA3E1E525C6C00FAEF13 /* MediaQueryExpression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaQueryExpression.h; sourceTree = "<group>"; };
+ 7CBA5BA61F0B4BDE0034D745 /* JSDOMConvertWebGL.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMConvertWebGL.cpp; sourceTree = "<group>"; };
7CC2DDF81EC9415A0027B774 /* NotificationPermission.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationPermission.h; sourceTree = "<group>"; };
7CC2DDFA1EC9415A0027B774 /* NotificationPermission.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NotificationPermission.idl; sourceTree = "<group>"; };
7CC2DDFE1EC95A440027B774 /* JSNotificationPermission.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotificationPermission.cpp; sourceTree = "<group>"; };
@@ -18081,7 +18081,6 @@
D3F3D35D1A69A5060059FC2B /* WebGL2RenderingContext.idl */,
A7D20F6B107F438B00A80392 /* WebGLActiveInfo.h */,
A7D20F3B107F373800A80392 /* WebGLActiveInfo.idl */,
- 6E47E65E10B7944B00B186C8 /* WebGLAny.cpp */,
6E47E65F10B7944B00B186C8 /* WebGLAny.h */,
49C7B9A81042D32E0009D447 /* WebGLBuffer.cpp */,
49C7B9A91042D32E0009D447 /* WebGLBuffer.h */,
@@ -19788,6 +19787,8 @@
516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */,
BE6DF708171CA2C500DD52B8 /* JSVideoTrackCustom.cpp */,
BE6DF70A171CA2C500DD52B8 /* JSVideoTrackListCustom.cpp */,
+ D3F3D3591A69A3B00059FC2B /* JSWebGL2RenderingContextCustom.cpp */,
+ 49EED14C1051971A00099FAB /* JSWebGLRenderingContextCustom.cpp */,
31A088C41E737B2C003B6609 /* JSWebGPURenderingContextCustom.cpp */,
31A088C51E737B2C003B6609 /* JSWebGPURenderPassAttachmentDescriptorCustom.cpp */,
83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */,
@@ -19858,11 +19859,23 @@
7C8E34A91E4A338E0054CE23 /* JSDOMConvertUnion.h */,
7C8E34AA1E4A338E0054CE23 /* JSDOMConvertVariadic.h */,
7C8E34AB1E4A338E0054CE23 /* JSDOMConvertWebGL.h */,
+ 7CBA5BA61F0B4BDE0034D745 /* JSDOMConvertWebGL.cpp */,
7C8E34AC1E4A338E0054CE23 /* JSDOMConvertXPathNSResolver.h */,
);
name = Conversions;
sourceTree = "<group>";
};
+ 7CBA5BA91F0B51480034D745 /* Promises Only */ = {
+ isa = PBXGroup;
+ children = (
+ C28083411C6DC96A001451B6 /* JSFontFaceCustom.cpp */,
+ 1C24EEAA1C72AA0A0080F8FC /* JSFontFaceSetCustom.cpp */,
+ 2D9BF7481DBFDDF8007A7D99 /* JSMediaKeySessionCustom.cpp */,
+ 38850C521E964C1100C60753 /* JSWebGPUCommandBufferCustom.cpp */,
+ );
+ name = "Promises Only";
+ sourceTree = "<group>";
+ };
7E4DE10B198B10810051CB02 /* cocoa */ = {
isa = PBXGroup;
children = (
@@ -23682,6 +23695,7 @@
isa = PBXGroup;
children = (
7C3D8EE41E08BABE0023B084 /* GC / Wrapping Only */,
+ 7CBA5BA91F0B51480034D745 /* Promises Only */,
A584FE371864DAC100843B10 /* JSCommandLineAPIHostCustom.cpp */,
E157A8E618184C67009F821D /* JSCryptoKeyCustom.cpp */,
BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */,
@@ -23690,8 +23704,6 @@
DEC2975D1B4DEB2A005F5945 /* JSCustomEventCustom.cpp */,
BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */,
652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */,
- C28083411C6DC96A001451B6 /* JSFontFaceCustom.cpp */,
- 1C24EEAA1C72AA0A0080F8FC /* JSFontFaceSetCustom.cpp */,
BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */,
BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */,
9392262C1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp */,
@@ -23701,7 +23713,6 @@
D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */,
7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */,
BCE1C43F0D9830F4003B02F2 /* JSLocationCustom.cpp */,
- 2D9BF7481DBFDDF8007A7D99 /* JSMediaKeySessionCustom.cpp */,
410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */,
A1E5B31D1AAD1DA4006EBEFB /* JSMockContentFilterSettingsCustom.cpp */,
C6F0917E143A2BB900685849 /* JSMutationObserverCustom.cpp */,
@@ -23709,9 +23720,6 @@
418C395D1C8F0AAB0051C8A3 /* JSReadableStreamSourceCustom.cpp */,
51D0C5150DAA90B7003B3831 /* JSStorageCustom.cpp */,
57A9C88D1DA70BF800BC7305 /* JSSubtleCryptoCustom.cpp */,
- D3F3D3591A69A3B00059FC2B /* JSWebGL2RenderingContextCustom.cpp */,
- 49EED14C1051971A00099FAB /* JSWebGLRenderingContextCustom.cpp */,
- 38850C521E964C1100C60753 /* JSWebGPUCommandBufferCustom.cpp */,
E1FF8F661807460800132674 /* JSWebKitSubtleCryptoCustom.cpp */,
E18258AB0EF3CD7000933242 /* JSWorkerGlobalScopeCustom.cpp */,
BC348BBD0DB7F531004ABAB9 /* JSXMLHttpRequestCustom.cpp */,
@@ -30784,6 +30792,7 @@
CD0EEE0E14743F39003EAFA2 /* AudioDestinationIOS.cpp in Sources */,
FD3160BC12B0272A00C1A359 /* AudioDestinationMac.cpp in Sources */,
FD31600712B0267600C1A359 /* AudioDestinationNode.cpp in Sources */,
+ 7CBA5BA71F0B4BDE0034D745 /* JSDOMConvertWebGL.cpp in Sources */,
FD31608112B026F700C1A359 /* AudioDSPKernelProcessor.cpp in Sources */,
CD5596911475B678001D0BD0 /* AudioFileReaderIOS.cpp in Sources */,
FD3160BE12B0272A00C1A359 /* AudioFileReaderMac.cpp in Sources */,
@@ -33870,7 +33879,6 @@
FE0D84EB1048436E001A179E /* WebEvent.mm in Sources */,
225A16B60D5C11E900090295 /* WebEventRegion.mm in Sources */,
D3F3D36D1A69B7DC0059FC2B /* WebGL2RenderingContext.cpp in Sources */,
- 6E47E66010B7944B00B186C8 /* WebGLAny.cpp in Sources */,
1AFFC4531D5E81C400267A66 /* WebGLBlacklist.mm in Sources */,
49C7B9C81042D32F0009D447 /* WebGLBuffer.cpp in Sources */,
7E66E23316D6EB6C00F7E7FF /* WebGLCompressedTextureATC.cpp in Sources */,
Modified: trunk/Source/WebCore/bindings/IDLTypes.h (219228 => 219229)
--- trunk/Source/WebCore/bindings/IDLTypes.h 2017-07-07 01:11:00 UTC (rev 219228)
+++ trunk/Source/WebCore/bindings/IDLTypes.h 2017-07-07 01:16:06 UTC (rev 219229)
@@ -51,6 +51,10 @@
class IDBValue;
class DOMPromise;
+#if ENABLE(WEBGL)
+class WebGLExtension;
+#endif
+
template<typename T>
struct IDLType {
using ImplementationType = T;
@@ -258,6 +262,7 @@
#if ENABLE(WEBGL)
struct IDLWebGLAny : IDLType<WebGLAny> { };
+struct IDLWebGLExtension : IDLWrapper<WebGLExtension> { };
#endif
// Helper predicates
Added: trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp (0 => 219229)
--- trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.cpp 2017-07-07 01:16:06 UTC (rev 219229)
@@ -0,0 +1,188 @@
+/*
+ * 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 "JSDOMConvertWebGL.h"
+
+#if ENABLE(WEBGL)
+
+#include "JSANGLEInstancedArrays.h"
+#include "JSDOMConvertBufferSource.h"
+#include "JSEXTBlendMinMax.h"
+#include "JSEXTFragDepth.h"
+#include "JSEXTShaderTextureLOD.h"
+#include "JSEXTTextureFilterAnisotropic.h"
+#include "JSEXTsRGB.h"
+#include "JSOESElementIndexUint.h"
+#include "JSOESStandardDerivatives.h"
+#include "JSOESTextureFloat.h"
+#include "JSOESTextureFloatLinear.h"
+#include "JSOESTextureHalfFloat.h"
+#include "JSOESTextureHalfFloatLinear.h"
+#include "JSOESVertexArrayObject.h"
+#include "JSWebGLBuffer.h"
+#include "JSWebGLCompressedTextureATC.h"
+#include "JSWebGLCompressedTexturePVRTC.h"
+#include "JSWebGLCompressedTextureS3TC.h"
+#include "JSWebGLDebugRendererInfo.h"
+#include "JSWebGLDebugShaders.h"
+#include "JSWebGLDepthTexture.h"
+#include "JSWebGLDrawBuffers.h"
+#include "JSWebGLFramebuffer.h"
+#include "JSWebGLLoseContext.h"
+#include "JSWebGLProgram.h"
+#include "JSWebGLRenderbuffer.h"
+#include "JSWebGLTexture.h"
+#include "JSWebGLVertexArrayObject.h"
+#include "JSWebGLVertexArrayObjectOES.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+// FIXME: This should use the IDLUnion JSConverter.
+JSValue convertToJSValue(ExecState& state, JSDOMGlobalObject& globalObject, const WebGLAny& any)
+{
+ return WTF::switchOn(any,
+ [] (std::nullptr_t) {
+ return jsNull();
+ },
+ [] (bool value) {
+ return jsBoolean(value);
+ },
+ [] (int value) {
+ return jsNumber(value);
+ },
+ [] (unsigned value) {
+ return jsNumber(value);
+ },
+ [] (long long value) {
+ return jsNumber(value);
+ },
+ [] (float value) {
+ return jsNumber(value);
+ },
+ [&] (const String& value) {
+ return jsStringWithCache(&state, value);
+ },
+ [&] (const Vector<bool>& values) {
+ MarkedArgumentBuffer list;
+ for (auto& value : values)
+ list.append(jsBoolean(value));
+ return constructArray(&state, 0, &globalObject, list);
+ },
+ [&] (const RefPtr<Float32Array>& array) {
+ return toJS(&state, &globalObject, array.get());
+ },
+ [&] (const RefPtr<Int32Array>& array) {
+ return toJS(&state, &globalObject, array.get());
+ },
+ [&] (const RefPtr<Uint8Array>& array) {
+ return toJS(&state, &globalObject, array.get());
+ },
+ [&] (const RefPtr<Uint32Array>& array) {
+ return toJS(&state, &globalObject, array.get());
+ },
+ [&] (const RefPtr<WebGLBuffer>& buffer) {
+ return toJS(&state, &globalObject, buffer.get());
+ },
+ [&] (const RefPtr<WebGLFramebuffer>& buffer) {
+ return toJS(&state, &globalObject, buffer.get());
+ },
+ [&] (const RefPtr<WebGLProgram>& program) {
+ return toJS(&state, &globalObject, program.get());
+ },
+ [&] (const RefPtr<WebGLRenderbuffer>& buffer) {
+ return toJS(&state, &globalObject, buffer.get());
+ },
+ [&] (const RefPtr<WebGLTexture>& texture) {
+ return toJS(&state, &globalObject, texture.get());
+ },
+ [&] (const RefPtr<WebGLVertexArrayObjectOES>& array) {
+ return toJS(&state, &globalObject, array.get());
+ }
+#if ENABLE(WEBGL2)
+ ,
+ [&] (const RefPtr<WebGLVertexArrayObject>& array) {
+ return toJS(&state, &globalObject, array.get());
+ }
+#endif
+ );
+}
+
+JSValue convertToJSValue(ExecState& state, JSDOMGlobalObject& globalObject, WebGLExtension& extension)
+{
+ switch (extension.getName()) {
+ case WebGLExtension::WebGLLoseContextName:
+ return toJS(&state, &globalObject, static_cast<WebGLLoseContext&>(extension));
+ case WebGLExtension::EXTShaderTextureLODName:
+ return toJS(&state, &globalObject, static_cast<EXTShaderTextureLOD&>(extension));
+ case WebGLExtension::EXTTextureFilterAnisotropicName:
+ return toJS(&state, &globalObject, static_cast<EXTTextureFilterAnisotropic&>(extension));
+ case WebGLExtension::EXTsRGBName:
+ return toJS(&state, &globalObject, static_cast<EXTsRGB&>(extension));
+ case WebGLExtension::EXTFragDepthName:
+ return toJS(&state, &globalObject, static_cast<EXTFragDepth&>(extension));
+ case WebGLExtension::EXTBlendMinMaxName:
+ return toJS(&state, &globalObject, static_cast<EXTBlendMinMax&>(extension));
+ case WebGLExtension::OESStandardDerivativesName:
+ return toJS(&state, &globalObject, static_cast<OESStandardDerivatives&>(extension));
+ case WebGLExtension::OESTextureFloatName:
+ return toJS(&state, &globalObject, static_cast<OESTextureFloat&>(extension));
+ case WebGLExtension::OESTextureFloatLinearName:
+ return toJS(&state, &globalObject, static_cast<OESTextureFloatLinear&>(extension));
+ case WebGLExtension::OESTextureHalfFloatName:
+ return toJS(&state, &globalObject, static_cast<OESTextureHalfFloat&>(extension));
+ case WebGLExtension::OESTextureHalfFloatLinearName:
+ return toJS(&state, &globalObject, static_cast<OESTextureHalfFloatLinear&>(extension));
+ case WebGLExtension::OESVertexArrayObjectName:
+ return toJS(&state, &globalObject, static_cast<OESVertexArrayObject&>(extension));
+ case WebGLExtension::OESElementIndexUintName:
+ return toJS(&state, &globalObject, static_cast<OESElementIndexUint&>(extension));
+ case WebGLExtension::WebGLDebugRendererInfoName:
+ return toJS(&state, &globalObject, static_cast<WebGLDebugRendererInfo&>(extension));
+ case WebGLExtension::WebGLDebugShadersName:
+ return toJS(&state, &globalObject, static_cast<WebGLDebugShaders&>(extension));
+ case WebGLExtension::WebGLCompressedTextureATCName:
+ return toJS(&state, &globalObject, static_cast<WebGLCompressedTextureATC&>(extension));
+ case WebGLExtension::WebGLCompressedTexturePVRTCName:
+ return toJS(&state, &globalObject, static_cast<WebGLCompressedTexturePVRTC&>(extension));
+ case WebGLExtension::WebGLCompressedTextureS3TCName:
+ return toJS(&state, &globalObject, static_cast<WebGLCompressedTextureS3TC&>(extension));
+ case WebGLExtension::WebGLDepthTextureName:
+ return toJS(&state, &globalObject, static_cast<WebGLDepthTexture&>(extension));
+ case WebGLExtension::WebGLDrawBuffersName:
+ return toJS(&state, &globalObject, static_cast<WebGLDrawBuffers&>(extension));
+ case WebGLExtension::ANGLEInstancedArraysName:
+ return toJS(&state, &globalObject, static_cast<ANGLEInstancedArrays&>(extension));
+ }
+ ASSERT_NOT_REACHED();
+ return jsNull();
+}
+
+}
+
+#endif
+
Modified: trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.h (219228 => 219229)
--- trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.h 2017-07-07 01:11:00 UTC (rev 219228)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvertWebGL.h 2017-07-07 01:16:06 UTC (rev 219229)
@@ -28,9 +28,20 @@
#if ENABLE(WEBGL)
#include "IDLTypes.h"
+#include "JSDOMConvertBase.h"
namespace WebCore {
+JSC::JSValue convertToJSValue(JSC::ExecState&, JSDOMGlobalObject&, const WebGLAny&);
+JSC::JSValue convertToJSValue(JSC::ExecState&, JSDOMGlobalObject&, WebGLExtension&);
+
+inline JSC::JSValue convertToJSValue(JSC::ExecState& state, JSDOMGlobalObject& globalObject, WebGLExtension* extension)
+{
+ if (!extension)
+ return JSC::jsNull();
+ return convertToJSValue(state, globalObject, *extension);
+}
+
template<> struct JSConverter<IDLWebGLAny> {
static constexpr bool needsState = true;
static constexpr bool needsGlobalObject = true;
@@ -41,6 +52,17 @@
}
};
+template<> struct JSConverter<IDLWebGLExtension> {
+ static constexpr bool needsState = true;
+ static constexpr bool needsGlobalObject = true;
+
+ template <typename T>
+ static JSC::JSValue convert(JSC::ExecState& state, JSDOMGlobalObject& globalObject, const T& value)
+ {
+ return convertToJSValue(state, globalObject, Detail::getPtrOrRef(value));
+ }
+};
+
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/bindings/js/JSWebGL2RenderingContextCustom.cpp (219228 => 219229)
--- trunk/Source/WebCore/bindings/js/JSWebGL2RenderingContextCustom.cpp 2017-07-07 01:11:00 UTC (rev 219228)
+++ trunk/Source/WebCore/bindings/js/JSWebGL2RenderingContextCustom.cpp 2017-07-07 01:16:06 UTC (rev 219229)
@@ -39,25 +39,6 @@
visitor.addOpaqueRoot(&wrapped());
}
-static JSValue toJS(ExecState&, JSDOMGlobalObject&, WebGLExtension*)
-{
- // No extensions for WebGL2 at the moment.
- return jsNull();
-}
-
-JSValue JSWebGL2RenderingContext::getExtension(ExecState& state)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() < 1)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- auto name = state.uncheckedArgument(0).toWTFString(&state);
- RETURN_IF_EXCEPTION(scope, { });
- return toJS(state, *globalObject(), wrapped().getExtension(name));
-}
-
} // namespace WebCore
#endif // ENABLE(WEBGL)
Modified: trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp (219228 => 219229)
--- trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp 2017-07-07 01:11:00 UTC (rev 219228)
+++ trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp 2017-07-07 01:16:06 UTC (rev 219229)
@@ -26,54 +26,8 @@
#include "config.h"
#if ENABLE(WEBGL)
+
#include "JSWebGLRenderingContext.h"
-#include "DOMWrapperWorld.h"
-#include "EXTBlendMinMax.h"
-#include "EXTFragDepth.h"
-#include "EXTShaderTextureLOD.h"
-#include "EXTTextureFilterAnisotropic.h"
-#include "EXTsRGB.h"
-#include "JSANGLEInstancedArrays.h"
-#include "JSEXTBlendMinMax.h"
-#include "JSEXTFragDepth.h"
-#include "JSEXTShaderTextureLOD.h"
-#include "JSEXTTextureFilterAnisotropic.h"
-#include "JSEXTsRGB.h"
-#include "JSOESElementIndexUint.h"
-#include "JSOESStandardDerivatives.h"
-#include "JSOESTextureFloat.h"
-#include "JSOESTextureFloatLinear.h"
-#include "JSOESTextureHalfFloat.h"
-#include "JSOESTextureHalfFloatLinear.h"
-#include "JSOESVertexArrayObject.h"
-#include "JSWebGLCompressedTextureATC.h"
-#include "JSWebGLCompressedTexturePVRTC.h"
-#include "JSWebGLCompressedTextureS3TC.h"
-#include "JSWebGLDebugRendererInfo.h"
-#include "JSWebGLDebugShaders.h"
-#include "JSWebGLDepthTexture.h"
-#include "JSWebGLDrawBuffers.h"
-#include "JSWebGLLoseContext.h"
-#include "JSWebGLVertexArrayObject.h"
-#include "JSWebGLVertexArrayObjectOES.h"
-#include "OESElementIndexUint.h"
-#include "OESStandardDerivatives.h"
-#include "OESTextureFloat.h"
-#include "OESTextureFloatLinear.h"
-#include "OESTextureHalfFloat.h"
-#include "OESTextureHalfFloatLinear.h"
-#include "OESVertexArrayObject.h"
-#include "WebGLCompressedTextureATC.h"
-#include "WebGLCompressedTexturePVRTC.h"
-#include "WebGLCompressedTextureS3TC.h"
-#include "WebGLDebugRendererInfo.h"
-#include "WebGLDebugShaders.h"
-#include "WebGLDepthTexture.h"
-#include "WebGLDrawBuffers.h"
-#include "WebGLExtension.h"
-#include "WebGLLoseContext.h"
-#include "WebGLVertexArrayObject.h"
-#include "WebGLVertexArrayObjectOES.h"
using namespace JSC;
@@ -84,71 +38,6 @@
visitor.addOpaqueRoot(&wrapped());
}
-static JSValue toJS(ExecState& state, JSDOMGlobalObject& globalObject, WebGLExtension* extension)
-{
- if (!extension)
- return jsNull();
- switch (extension->getName()) {
- case WebGLExtension::WebGLLoseContextName:
- return toJS(&state, &globalObject, static_cast<WebGLLoseContext*>(extension));
- case WebGLExtension::EXTShaderTextureLODName:
- return toJS(&state, &globalObject, static_cast<EXTShaderTextureLOD*>(extension));
- case WebGLExtension::EXTTextureFilterAnisotropicName:
- return toJS(&state, &globalObject, static_cast<EXTTextureFilterAnisotropic*>(extension));
- case WebGLExtension::EXTsRGBName:
- return toJS(&state, &globalObject, static_cast<EXTsRGB*>(extension));
- case WebGLExtension::EXTFragDepthName:
- return toJS(&state, &globalObject, static_cast<EXTFragDepth*>(extension));
- case WebGLExtension::EXTBlendMinMaxName:
- return toJS(&state, &globalObject, static_cast<EXTBlendMinMax*>(extension));
- case WebGLExtension::OESStandardDerivativesName:
- return toJS(&state, &globalObject, static_cast<OESStandardDerivatives*>(extension));
- case WebGLExtension::OESTextureFloatName:
- return toJS(&state, &globalObject, static_cast<OESTextureFloat*>(extension));
- case WebGLExtension::OESTextureFloatLinearName:
- return toJS(&state, &globalObject, static_cast<OESTextureFloatLinear*>(extension));
- case WebGLExtension::OESTextureHalfFloatName:
- return toJS(&state, &globalObject, static_cast<OESTextureHalfFloat*>(extension));
- case WebGLExtension::OESTextureHalfFloatLinearName:
- return toJS(&state, &globalObject, static_cast<OESTextureHalfFloatLinear*>(extension));
- case WebGLExtension::OESVertexArrayObjectName:
- return toJS(&state, &globalObject, static_cast<OESVertexArrayObject*>(extension));
- case WebGLExtension::OESElementIndexUintName:
- return toJS(&state, &globalObject, static_cast<OESElementIndexUint*>(extension));
- case WebGLExtension::WebGLDebugRendererInfoName:
- return toJS(&state, &globalObject, static_cast<WebGLDebugRendererInfo*>(extension));
- case WebGLExtension::WebGLDebugShadersName:
- return toJS(&state, &globalObject, static_cast<WebGLDebugShaders*>(extension));
- case WebGLExtension::WebGLCompressedTextureATCName:
- return toJS(&state, &globalObject, static_cast<WebGLCompressedTextureATC*>(extension));
- case WebGLExtension::WebGLCompressedTexturePVRTCName:
- return toJS(&state, &globalObject, static_cast<WebGLCompressedTexturePVRTC*>(extension));
- case WebGLExtension::WebGLCompressedTextureS3TCName:
- return toJS(&state, &globalObject, static_cast<WebGLCompressedTextureS3TC*>(extension));
- case WebGLExtension::WebGLDepthTextureName:
- return toJS(&state, &globalObject, static_cast<WebGLDepthTexture*>(extension));
- case WebGLExtension::WebGLDrawBuffersName:
- return toJS(&state, &globalObject, static_cast<WebGLDrawBuffers*>(extension));
- case WebGLExtension::ANGLEInstancedArraysName:
- return toJS(&state, &globalObject, static_cast<ANGLEInstancedArrays*>(extension));
- }
- ASSERT_NOT_REACHED();
- return jsNull();
-}
-
-JSValue JSWebGLRenderingContext::getExtension(ExecState& state)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() < 1)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- auto name = state.uncheckedArgument(0).toWTFString(&state);
- RETURN_IF_EXCEPTION(scope, { });
- return toJS(state, *globalObject(), wrapped().getExtension(name));
-}
-
} // namespace WebCore
#endif // ENABLE(WEBGL)
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (219228 => 219229)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2017-07-07 01:11:00 UTC (rev 219228)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2017-07-07 01:16:06 UTC (rev 219229)
@@ -321,7 +321,7 @@
return;
}
- if ($overrideTypeName eq "IDLWebGLAny") {
+ if ($overrideTypeName eq "IDLWebGLAny" || $overrideTypeName eq "IDLWebGLExtension") {
AddToIncludes("JSDOMConvertWebGL.h", $includesRef, $conditional);
return;
}
@@ -6381,6 +6381,7 @@
my $overrideTypeName = $type->extendedAttributes->{OverrideIDLType};
return 1 if $overrideTypeName eq "IDLIDBKey";
return 1 if $overrideTypeName eq "IDLWebGLAny";
+ return 1 if $overrideTypeName eq "IDLWebGLExtension";
return 0;
}
@@ -6413,6 +6414,7 @@
my $overrideTypeName = $type->extendedAttributes->{OverrideIDLType};
return 1 if $overrideTypeName eq "IDLIDBKey";
return 1 if $overrideTypeName eq "IDLWebGLAny";
+ return 1 if $overrideTypeName eq "IDLWebGLExtension";
return 0;
}
Deleted: trunk/Source/WebCore/html/canvas/WebGLAny.cpp (219228 => 219229)
--- trunk/Source/WebCore/html/canvas/WebGLAny.cpp 2017-07-07 01:11:00 UTC (rev 219228)
+++ trunk/Source/WebCore/html/canvas/WebGLAny.cpp 2017-07-07 01:16:06 UTC (rev 219229)
@@ -1,120 +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. ``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
- * 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 "WebGLAny.h"
-
-#if ENABLE(WEBGL)
-
-#include "JSDOMConvert.h"
-#include "JSWebGLBuffer.h"
-#include "JSWebGLFramebuffer.h"
-#include "JSWebGLProgram.h"
-#include "JSWebGLRenderbuffer.h"
-#include "JSWebGLTexture.h"
-#include "JSWebGLVertexArrayObjectOES.h"
-#include <wtf/Variant.h>
-
-#if ENABLE(WEBGL2)
-#include "JSWebGLVertexArrayObject.h"
-#endif
-
-namespace WebCore {
-
-using namespace JSC;
-
-// FIXME: This should use the IDLUnion JSConverter.
-JSValue convertToJSValue(ExecState& state, JSDOMGlobalObject& globalObject, const WebGLAny& any)
-{
- return WTF::switchOn(any,
- [] (std::nullptr_t) {
- return jsNull();
- },
- [] (bool value) {
- return jsBoolean(value);
- },
- [] (int value) {
- return jsNumber(value);
- },
- [] (unsigned value) {
- return jsNumber(value);
- },
- [] (long long value) {
- return jsNumber(value);
- },
- [] (float value) {
- return jsNumber(value);
- },
- [&] (const String& value) {
- return jsStringWithCache(&state, value);
- },
- [&] (const Vector<bool>& values) {
- MarkedArgumentBuffer list;
- for (auto& value : values)
- list.append(jsBoolean(value));
- return constructArray(&state, 0, &globalObject, list);
- },
- [&] (const RefPtr<Float32Array>& array) {
- return toJS(&state, &globalObject, array.get());
- },
- [&] (const RefPtr<Int32Array>& array) {
- return toJS(&state, &globalObject, array.get());
- },
- [&] (const RefPtr<Uint8Array>& array) {
- return toJS(&state, &globalObject, array.get());
- },
- [&] (const RefPtr<Uint32Array>& array) {
- return toJS(&state, &globalObject, array.get());
- },
- [&] (const RefPtr<WebGLBuffer>& buffer) {
- return toJS(&state, &globalObject, buffer.get());
- },
- [&] (const RefPtr<WebGLFramebuffer>& buffer) {
- return toJS(&state, &globalObject, buffer.get());
- },
- [&] (const RefPtr<WebGLProgram>& program) {
- return toJS(&state, &globalObject, program.get());
- },
- [&] (const RefPtr<WebGLRenderbuffer>& buffer) {
- return toJS(&state, &globalObject, buffer.get());
- },
- [&] (const RefPtr<WebGLTexture>& texture) {
- return toJS(&state, &globalObject, texture.get());
- },
- [&] (const RefPtr<WebGLVertexArrayObjectOES>& array) {
- return toJS(&state, &globalObject, array.get());
- }
-#if ENABLE(WEBGL2)
- ,
- [&] (const RefPtr<WebGLVertexArrayObject>& array) {
- return toJS(&state, &globalObject, array.get());
- }
-#endif
- );
-}
-
-}
-
-#endif
Modified: trunk/Source/WebCore/html/canvas/WebGLAny.h (219228 => 219229)
--- trunk/Source/WebCore/html/canvas/WebGLAny.h 2017-07-07 01:11:00 UTC (rev 219228)
+++ trunk/Source/WebCore/html/canvas/WebGLAny.h 2017-07-07 01:16:06 UTC (rev 219229)
@@ -72,8 +72,6 @@
#endif
>;
-JSC::JSValue convertToJSValue(JSC::ExecState&, JSDOMGlobalObject&, const WebGLAny&);
-
} // namespace WebCore
#endif
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl (219228 => 219229)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl 2017-07-07 01:11:00 UTC (rev 219228)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl 2017-07-07 01:16:06 UTC (rev 219229)
@@ -560,7 +560,7 @@
GLenum getError();
sequence<DOMString>? getSupportedExtensions();
- [Custom] object? getExtension(DOMString name);
+ [OverrideIDLType=IDLWebGLExtension] object? getExtension(DOMString name);
[OverrideIDLType=IDLWebGLAny] any getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname);
[OverrideIDLType=IDLWebGLAny] any getParameter(GLenum pname);