<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[210567] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/210567">210567</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-01-10 17:02:34 -0800 (Tue, 10 Jan 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>[WebIDL] Remove most of the custom bindings for the WebGL code
https://bugs.webkit.org/show_bug.cgi?id=166834
Patch by Sam Weinig <sam@webkit.org> on 2017-01-10
Reviewed by Alex Christensen.
Source/JavaScriptCore:
* runtime/ArrayPrototype.h:
* runtime/ObjectPrototype.h:
Export the ClassInfo so it can be used from WebCore.
Source/WebCore:
Removes all but one custom getter (getExtension) from the WebGL code.
* Modules/indexeddb/IDBKeyRange.idl:
Replace use of non-standard type, with new OverrideIDLType extended attribute, allowing us
to stay more consistent with the IDL files spec's provide.
* WebCore.xcodeproj/project.pbxproj:
Move JSWebGL2RenderingContextCustom to the GC/Wrapping only group.
* bindings/IDLTypes.h:
Add IDLWebGLAny, and simplify IDLIDBKey to not be templatized.
* bindings/js/JSDOMConvert.h:
(WebCore::Converter<IDLLong>::convert):
(WebCore::Converter<IDLFloat>::convert):
(WebCore::Converter<IDLUnrestrictedFloat>::convert):
(WebCore::Converter<IDLDouble>::convert):
(WebCore::Converter<IDLUnrestrictedDouble>::convert):
Add overloads of convert that convert a double to the numeric type.
(WebCore::Detail::GenericSequenceConverter::convert):
Add optimized specialization for JSArrays that does not use the iterator protocol.
(WebCore::Detail::NumericSequenceConverter::convert):
Add an even more optimized specialization for numeric types, which checks to see
if the array's butterfly has an optimized shape, and extracts the numeric values
from that.
(WebCore::Detail::SequenceConverter::convert):
(WebCore::Detail::SequenceConverter<IDLLong>::convert):
(WebCore::Detail::SequenceConverter<IDLFloat>::convert):
(WebCore::Detail::SequenceConverter<IDLUnrestrictedFloat>::convert):
(WebCore::Detail::SequenceConverter<IDLDouble>::convert):
(WebCore::Detail::SequenceConverter<IDLUnrestrictedDouble>::convert):
Select the right specialization based on type.
(WebCore::Converter<IDLSequence<T>>::convert):
(WebCore::Converter<IDLFrozenArray<T>>::convert):
Rename converter to be more accurate.
(WebCore::JSConverter<IDLWebGLAny>::convert):
Added. Calls through to converter in WebGLAny.h. We should replace this with a
call to the IDLUnion JSConverter when feasible.
* bindings/js/JSWebGL2RenderingContextCustom.cpp:
(WebCore::JSWebGL2RenderingContext::getInternalformatParameter): Deleted.
(WebCore::JSWebGL2RenderingContext::getQueryParameter): Deleted.
(WebCore::JSWebGL2RenderingContext::getSamplerParameter): Deleted.
(WebCore::JSWebGL2RenderingContext::getSyncParameter): Deleted.
(WebCore::JSWebGL2RenderingContext::getIndexedParameter): Deleted.
(WebCore::JSWebGL2RenderingContext::getActiveUniformBlockParameter): Deleted.
(WebCore::JSWebGL2RenderingContext::getActiveUniformBlockName): Deleted.
Remove unnecessary custom functions.
* bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
(WebCore::objectParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Deleted.
(WebCore::JSWebGLRenderingContextBase::getBufferParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getProgramParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getRenderbufferParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getShaderParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getSupportedExtensions): Deleted.
(WebCore::JSWebGLRenderingContextBase::getTexParameter): Deleted.
(WebCore::JSWebGLRenderingContextBase::getUniform): Deleted.
(WebCore::JSWebGLRenderingContextBase::getVertexAttrib): Deleted.
(WebCore::toNumberVector): Deleted.
(WebCore::functionForUniform): Deleted.
(WebCore::dataFunctionf): Deleted.
(WebCore::dataFunctioni): Deleted.
(WebCore::dataFunctionMatrix): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform1fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform1iv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform2fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform2iv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform3fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform3iv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform4fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniform4iv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniformMatrix2fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniformMatrix3fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::uniformMatrix4fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::vertexAttrib1fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::vertexAttrib2fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::vertexAttrib3fv): Deleted.
(WebCore::JSWebGLRenderingContextBase::vertexAttrib4fv): Deleted.
Remove unnecessary custom functions.
* bindings/scripts/CodeGenerator.pm:
(IsBuiltinType):
Remove specialization of IDBKey.
* bindings/scripts/CodeGeneratorJS.pm:
(GetBaseIDLType):
(GetIDLType):
(NativeToJSValueDOMConvertNeedsState):
(NativeToJSValueDOMConvertNeedsGlobalObject):
(NativeToJSValue):
Allow IDL files to override the type of signature using a new OverrideIDLType
extended attribute. Currently this only works conversion to JS, but could be
extended to support more.
* bindings/scripts/IDLAttributes.txt:
Add OverrideIDLType.
* html/canvas/WebGL2RenderingContext.idl:
Add OverrideIDLType=IDLWebGLAny annotations to remove the need for custom functions.
* html/canvas/WebGLAny.cpp:
(WebCore::convertToJSValue):
(WebCore::toJS): Deleted.
* html/canvas/WebGLAny.h:
Rename the toJS function to convertToJSValue to avoid a template specialization issue.
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::getAttachedShaders):
Update signature to match IDL, replacing bool return value plus out parameter with an
optional return value. Modernize the code a bit.
(WebCore::WebGLRenderingContextBase::uniform2f):
(WebCore::WebGLRenderingContextBase::uniform3f):
(WebCore::WebGLRenderingContextBase::uniform4f):
(WebCore::WebGLRenderingContextBase::uniform1i):
(WebCore::WebGLRenderingContextBase::uniform3i):
(WebCore::WebGLRenderingContextBase::uniform4i):
(WebCore::WebGLRenderingContextBase::uniform1fv):
(WebCore::WebGLRenderingContextBase::uniform2fv):
(WebCore::WebGLRenderingContextBase::uniform3fv):
(WebCore::WebGLRenderingContextBase::uniform4fv):
(WebCore::WebGLRenderingContextBase::uniform1iv):
(WebCore::WebGLRenderingContextBase::uniform2iv):
(WebCore::WebGLRenderingContextBase::uniform3iv):
(WebCore::WebGLRenderingContextBase::uniform4iv):
(WebCore::WebGLRenderingContextBase::uniformMatrix2fv):
(WebCore::WebGLRenderingContextBase::uniformMatrix3fv):
(WebCore::WebGLRenderingContextBase::uniformMatrix4fv):
(WebCore::WebGLRenderingContextBase::vertexAttrib4f):
(WebCore::WebGLRenderingContextBase::vertexAttrib1fv):
(WebCore::WebGLRenderingContextBase::vertexAttrib2fv):
(WebCore::WebGLRenderingContextBase::vertexAttrib3fv):
(WebCore::WebGLRenderingContextBase::vertexAttrib4fv):
(WebCore::WebGLRenderingContextBase::validateUniformParameters):
(WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters):
(WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):
* html/canvas/WebGLRenderingContextBase.h:
(WebCore::WebGLRenderingContextBase::TypedList::TypedList):
(WebCore::WebGLRenderingContextBase::TypedList::data):
(WebCore::WebGLRenderingContextBase::TypedList::length):
Re-order/group to match order in the IDL file. Remove overloads taking a pointer and
length, and replace it by having the main function take a specialized TypedList. TypedList
allows the bindings to pass the correct Variant type, but then the code to only think in
terms of the data() and length() functions.
* html/canvas/WebGLRenderingContextBase.idl:
Remove [Custom] annotations and re-order/group to match the spec. Update types of uniform*fv/iv
functions to take typedef'd unions.
LayoutTests:
* fast/canvas/webgl/gl-object-get-calls-expected.txt:
Update result for better error message.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcanvaswebglglobjectgetcallsexpectedtxt">trunk/LayoutTests/fast/canvas/webgl/gl-object-get-calls-expected.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeArrayPrototypeh">trunk/Source/JavaScriptCore/runtime/ArrayPrototype.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeObjectPrototypeh">trunk/Source/JavaScriptCore/runtime/ObjectPrototype.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBKeyRangeidl">trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsIDLTypesh">trunk/Source/WebCore/bindings/IDLTypes.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMConverth">trunk/Source/WebCore/bindings/js/JSDOMConvert.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSWebGL2RenderingContextCustomcpp">trunk/Source/WebCore/bindings/js/JSWebGL2RenderingContextCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSWebGLRenderingContextBaseCustomcpp">trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextBaseCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorpm">trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsIDLAttributestxt">trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGL2RenderingContextcpp">trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGL2RenderingContexth">trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGL2RenderingContextidl">trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLAnycpp">trunk/Source/WebCore/html/canvas/WebGLAny.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLAnyh">trunk/Source/WebCore/html/canvas/WebGLAny.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextcpp">trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContexth">trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextBasecpp">trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseh">trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseidl">trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreForwardingHeadersruntimeJSGlobalObjectInlinesh">trunk/Source/WebCore/ForwardingHeaders/runtime/JSGlobalObjectInlines.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/LayoutTests/ChangeLog        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2017-01-10 Sam Weinig <sam@webkit.org>
+
+ [WebIDL] Remove most of the custom bindings for the WebGL code
+ https://bugs.webkit.org/show_bug.cgi?id=166834
+
+ Reviewed by Alex Christensen.
+
+ * fast/canvas/webgl/gl-object-get-calls-expected.txt:
+ Update result for better error message.
+
</ins><span class="cx"> 2017-01-10 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> :active and :hover states may not be updated across slots
</span></span></pre></div>
<a id="trunkLayoutTestsfastcanvaswebglglobjectgetcallsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/canvas/webgl/gl-object-get-calls-expected.txt (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/webgl/gl-object-get-calls-expected.txt        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/LayoutTests/fast/canvas/webgl/gl-object-get-calls-expected.txt        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -7,7 +7,7 @@
</span><span class="cx"> PASS getError was expected value: NO_ERROR :
</span><span class="cx"> PASS gl.getAttachedShaders(null) is null
</span><span class="cx"> PASS getError was expected value: INVALID_VALUE :
</span><del>-PASS gl.getAttachedShaders(standardVert) threw exception TypeError: Type error.
</del><ins>+PASS gl.getAttachedShaders(standardVert) threw exception TypeError: Argument 1 ('program') to WebGLRenderingContextBase.getAttachedShaders must be an instance of WebGLProgram.
</ins><span class="cx"> PASS getError was expected value: NO_ERROR :
</span><span class="cx"> PASS gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE) is 16
</span><span class="cx"> PASS gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_USAGE) is gl.DYNAMIC_DRAW
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-01-10 Sam Weinig <sam@webkit.org>
+
+ [WebIDL] Remove most of the custom bindings for the WebGL code
+ https://bugs.webkit.org/show_bug.cgi?id=166834
+
+ Reviewed by Alex Christensen.
+
+ * runtime/ArrayPrototype.h:
+ * runtime/ObjectPrototype.h:
+ Export the ClassInfo so it can be used from WebCore.
+
</ins><span class="cx"> 2017-01-09 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> Streamline the GC barrier slowpath
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeArrayPrototypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ArrayPrototype.h (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ArrayPrototype.h        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/JavaScriptCore/runtime/ArrayPrototype.h        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx">
</span><span class="cx"> static ArrayPrototype* create(VM&, JSGlobalObject*, Structure*);
</span><span class="cx">
</span><del>- DECLARE_INFO;
</del><ins>+ DECLARE_EXPORT_INFO;
</ins><span class="cx">
</span><span class="cx"> static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeObjectPrototypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ObjectPrototype.h (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ObjectPrototype.h        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/JavaScriptCore/runtime/ObjectPrototype.h        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx">
</span><span class="cx"> static ObjectPrototype* create(VM&, JSGlobalObject*, Structure*);
</span><span class="cx">
</span><del>- DECLARE_INFO;
</del><ins>+ DECLARE_EXPORT_INFO;
</ins><span class="cx">
</span><span class="cx"> static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/ChangeLog        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -1,3 +1,168 @@
</span><ins>+2017-01-10 Sam Weinig <sam@webkit.org>
+
+ [WebIDL] Remove most of the custom bindings for the WebGL code
+ https://bugs.webkit.org/show_bug.cgi?id=166834
+
+ Reviewed by Alex Christensen.
+
+ Removes all but one custom getter (getExtension) from the WebGL code.
+
+ * Modules/indexeddb/IDBKeyRange.idl:
+ Replace use of non-standard type, with new OverrideIDLType extended attribute, allowing us
+ to stay more consistent with the IDL files spec's provide.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ Move JSWebGL2RenderingContextCustom to the GC/Wrapping only group.
+
+ * bindings/IDLTypes.h:
+ Add IDLWebGLAny, and simplify IDLIDBKey to not be templatized.
+
+ * bindings/js/JSDOMConvert.h:
+ (WebCore::Converter<IDLLong>::convert):
+ (WebCore::Converter<IDLFloat>::convert):
+ (WebCore::Converter<IDLUnrestrictedFloat>::convert):
+ (WebCore::Converter<IDLDouble>::convert):
+ (WebCore::Converter<IDLUnrestrictedDouble>::convert):
+ Add overloads of convert that convert a double to the numeric type.
+
+ (WebCore::Detail::GenericSequenceConverter::convert):
+ Add optimized specialization for JSArrays that does not use the iterator protocol.
+
+ (WebCore::Detail::NumericSequenceConverter::convert):
+ Add an even more optimized specialization for numeric types, which checks to see
+ if the array's butterfly has an optimized shape, and extracts the numeric values
+ from that.
+
+ (WebCore::Detail::SequenceConverter::convert):
+ (WebCore::Detail::SequenceConverter<IDLLong>::convert):
+ (WebCore::Detail::SequenceConverter<IDLFloat>::convert):
+ (WebCore::Detail::SequenceConverter<IDLUnrestrictedFloat>::convert):
+ (WebCore::Detail::SequenceConverter<IDLDouble>::convert):
+ (WebCore::Detail::SequenceConverter<IDLUnrestrictedDouble>::convert):
+ Select the right specialization based on type.
+
+ (WebCore::Converter<IDLSequence<T>>::convert):
+ (WebCore::Converter<IDLFrozenArray<T>>::convert):
+ Rename converter to be more accurate.
+
+ (WebCore::JSConverter<IDLWebGLAny>::convert):
+ Added. Calls through to converter in WebGLAny.h. We should replace this with a
+ call to the IDLUnion JSConverter when feasible.
+
+ * bindings/js/JSWebGL2RenderingContextCustom.cpp:
+ (WebCore::JSWebGL2RenderingContext::getInternalformatParameter): Deleted.
+ (WebCore::JSWebGL2RenderingContext::getQueryParameter): Deleted.
+ (WebCore::JSWebGL2RenderingContext::getSamplerParameter): Deleted.
+ (WebCore::JSWebGL2RenderingContext::getSyncParameter): Deleted.
+ (WebCore::JSWebGL2RenderingContext::getIndexedParameter): Deleted.
+ (WebCore::JSWebGL2RenderingContext::getActiveUniformBlockParameter): Deleted.
+ (WebCore::JSWebGL2RenderingContext::getActiveUniformBlockName): Deleted.
+ Remove unnecessary custom functions.
+
+ * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
+ (WebCore::objectParameter): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::getBufferParameter): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::getParameter): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::getProgramParameter): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::getRenderbufferParameter): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::getShaderParameter): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::getSupportedExtensions): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::getTexParameter): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::getUniform): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::getVertexAttrib): Deleted.
+ (WebCore::toNumberVector): Deleted.
+ (WebCore::functionForUniform): Deleted.
+ (WebCore::dataFunctionf): Deleted.
+ (WebCore::dataFunctioni): Deleted.
+ (WebCore::dataFunctionMatrix): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::uniform1fv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::uniform1iv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::uniform2fv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::uniform2iv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::uniform3fv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::uniform3iv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::uniform4fv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::uniform4iv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::uniformMatrix2fv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::uniformMatrix3fv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::uniformMatrix4fv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::vertexAttrib1fv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::vertexAttrib2fv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::vertexAttrib3fv): Deleted.
+ (WebCore::JSWebGLRenderingContextBase::vertexAttrib4fv): Deleted.
+ Remove unnecessary custom functions.
+
+ * bindings/scripts/CodeGenerator.pm:
+ (IsBuiltinType):
+ Remove specialization of IDBKey.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GetBaseIDLType):
+ (GetIDLType):
+ (NativeToJSValueDOMConvertNeedsState):
+ (NativeToJSValueDOMConvertNeedsGlobalObject):
+ (NativeToJSValue):
+ Allow IDL files to override the type of signature using a new OverrideIDLType
+ extended attribute. Currently this only works conversion to JS, but could be
+ extended to support more.
+
+ * bindings/scripts/IDLAttributes.txt:
+ Add OverrideIDLType.
+
+ * html/canvas/WebGL2RenderingContext.idl:
+ Add OverrideIDLType=IDLWebGLAny annotations to remove the need for custom functions.
+
+ * html/canvas/WebGLAny.cpp:
+ (WebCore::convertToJSValue):
+ (WebCore::toJS): Deleted.
+ * html/canvas/WebGLAny.h:
+ Rename the toJS function to convertToJSValue to avoid a template specialization issue.
+
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::getAttachedShaders):
+ Update signature to match IDL, replacing bool return value plus out parameter with an
+ optional return value. Modernize the code a bit.
+
+ (WebCore::WebGLRenderingContextBase::uniform2f):
+ (WebCore::WebGLRenderingContextBase::uniform3f):
+ (WebCore::WebGLRenderingContextBase::uniform4f):
+ (WebCore::WebGLRenderingContextBase::uniform1i):
+ (WebCore::WebGLRenderingContextBase::uniform3i):
+ (WebCore::WebGLRenderingContextBase::uniform4i):
+ (WebCore::WebGLRenderingContextBase::uniform1fv):
+ (WebCore::WebGLRenderingContextBase::uniform2fv):
+ (WebCore::WebGLRenderingContextBase::uniform3fv):
+ (WebCore::WebGLRenderingContextBase::uniform4fv):
+ (WebCore::WebGLRenderingContextBase::uniform1iv):
+ (WebCore::WebGLRenderingContextBase::uniform2iv):
+ (WebCore::WebGLRenderingContextBase::uniform3iv):
+ (WebCore::WebGLRenderingContextBase::uniform4iv):
+ (WebCore::WebGLRenderingContextBase::uniformMatrix2fv):
+ (WebCore::WebGLRenderingContextBase::uniformMatrix3fv):
+ (WebCore::WebGLRenderingContextBase::uniformMatrix4fv):
+ (WebCore::WebGLRenderingContextBase::vertexAttrib4f):
+ (WebCore::WebGLRenderingContextBase::vertexAttrib1fv):
+ (WebCore::WebGLRenderingContextBase::vertexAttrib2fv):
+ (WebCore::WebGLRenderingContextBase::vertexAttrib3fv):
+ (WebCore::WebGLRenderingContextBase::vertexAttrib4fv):
+ (WebCore::WebGLRenderingContextBase::validateUniformParameters):
+ (WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters):
+ (WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):
+ * html/canvas/WebGLRenderingContextBase.h:
+ (WebCore::WebGLRenderingContextBase::TypedList::TypedList):
+ (WebCore::WebGLRenderingContextBase::TypedList::data):
+ (WebCore::WebGLRenderingContextBase::TypedList::length):
+ Re-order/group to match order in the IDL file. Remove overloads taking a pointer and
+ length, and replace it by having the main function take a specialized TypedList. TypedList
+ allows the bindings to pass the correct Variant type, but then the code to only think in
+ terms of the data() and length() functions.
+
+ * html/canvas/WebGLRenderingContextBase.idl:
+ Remove [Custom] annotations and re-order/group to match the spec. Update types of uniform*fv/iv
+ functions to take typedef'd unions.
+
</ins><span class="cx"> 2017-01-10 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> :active and :hover states may not be updated across slots
</span></span></pre></div>
<a id="trunkSourceWebCoreForwardingHeadersruntimeJSGlobalObjectInlinesh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/ForwardingHeaders/runtime/JSGlobalObjectInlines.h (0 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ForwardingHeaders/runtime/JSGlobalObjectInlines.h         (rev 0)
+++ trunk/Source/WebCore/ForwardingHeaders/runtime/JSGlobalObjectInlines.h        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+#pragma once
+#include <JavaScriptCore/JSGlobalObjectInlines.h>
</ins></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBKeyRangeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -28,11 +28,8 @@
</span><span class="cx"> ImplementationLacksVTable,
</span><span class="cx"> EnabledAtRuntime=IndexedDB,
</span><span class="cx"> ] interface IDBKeyRange {
</span><del>- // NOTE: The 'lower' and 'upper' attributes are specified to be of type 'any'
- // but we use the extension type IDBKey, to allow code generator to know our
- // which conversion to use based on our actual implementation type.
- readonly attribute IDBKey lower;
- readonly attribute IDBKey upper;
</del><ins>+ [OverrideIDLType=IDLIDBKey] readonly attribute any lower;
+ [OverrideIDLType=IDLIDBKey] readonly attribute any upper;
</ins><span class="cx"> readonly attribute boolean lowerOpen;
</span><span class="cx"> readonly attribute boolean upperOpen;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -2610,7 +2610,7 @@
</span><span class="cx">                 6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextureS3TC.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */; };
</span><span class="cx">                 6E3FAE8F14733FDB00E42307 /* WebGLDepthTexture.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42307 /* WebGLDepthTexture.h */; };
</span><span class="cx">                 6E47E66010B7944B00B186C8 /* WebGLAny.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E47E65E10B7944B00B186C8 /* WebGLAny.cpp */; };
</span><del>-                6E47E66110B7944B00B186C8 /* WebGLAny.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E47E65F10B7944B00B186C8 /* WebGLAny.h */; };
</del><ins>+                6E47E66110B7944B00B186C8 /* WebGLAny.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E47E65F10B7944B00B186C8 /* WebGLAny.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 6E4ABCD4138EA0B70071D291 /* JSHTMLUnknownElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4ABCD2138EA0B70071D291 /* JSHTMLUnknownElement.cpp */; };
</span><span class="cx">                 6E4ABCD5138EA0B70071D291 /* JSHTMLUnknownElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4ABCD3138EA0B70071D291 /* JSHTMLUnknownElement.h */; };
</span><span class="cx">                 6E4E91AF10F7FB3100A2779C /* WebGLContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -18362,6 +18362,7 @@
</span><span class="cx">                                 07846384145B1B8E00A58DF1 /* JSTrackCustom.h */,
</span><span class="cx">                                 516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */,
</span><span class="cx">                                 BE6DF70A171CA2C500DD52B8 /* JSVideoTrackListCustom.cpp */,
</span><ins>+                                D3F3D3591A69A3B00059FC2B /* JSWebGL2RenderingContextCustom.cpp */,
</ins><span class="cx">                                 49EED14C1051971A00099FAB /* JSWebGLRenderingContextCustom.cpp */,
</span><span class="cx">                                 83A4A9F81CE7FD7E00709B00 /* JSXMLDocumentCustom.cpp */,
</span><span class="cx">                                 836C14421CDEAFCA0073493F /* JSXPathNSResolverCustom.cpp */,
</span><span class="lines">@@ -22155,7 +22156,6 @@
</span><span class="cx">                                 07E116B01489C9A100EC5ACE /* JSTextTrackCustom.cpp */,
</span><span class="cx">                                 7C73FB17191EF808007DE061 /* JSUserMessageHandlersNamespaceCustom.cpp */,
</span><span class="cx">                                 BE6DF708171CA2C500DD52B8 /* JSVideoTrackCustom.cpp */,
</span><del>-                                D3F3D3591A69A3B00059FC2B /* JSWebGL2RenderingContextCustom.cpp */,
</del><span class="cx">                                 D3F3D35A1A69A3B00059FC2B /* JSWebGLRenderingContextBaseCustom.cpp */,
</span><span class="cx">                                 E1FF8F661807460800132674 /* JSWebKitSubtleCryptoCustom.cpp */,
</span><span class="cx">                                 E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsIDLTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/IDLTypes.h (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/IDLTypes.h        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/bindings/IDLTypes.h        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -31,6 +31,10 @@
</span><span class="cx"> #include <wtf/StdLibExtras.h>
</span><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><ins>+#if ENABLE(WEBGL)
+#include "WebGLAny.h"
+#endif
+
</ins><span class="cx"> namespace JSC {
</span><span class="cx"> class ArrayBuffer;
</span><span class="cx"> class ArrayBufferView;
</span><span class="lines">@@ -41,6 +45,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+class IDBKey;
</ins><span class="cx"> template<typename> class DOMPromise;
</span><span class="cx">
</span><span class="cx"> template<typename T>
</span><span class="lines">@@ -83,13 +88,11 @@
</span><span class="cx"> struct IDLLongLong : IDLInteger<int64_t> { };
</span><span class="cx"> struct IDLUnsignedLongLong : IDLInteger<uint64_t> { };
</span><span class="cx">
</span><del>-template<typename FloatingPointType, bool unrestricted = false> struct IDLFloatingPoint : IDLNumber<FloatingPointType> {
- static constexpr bool isUnrestricted = unrestricted;
-};
</del><ins>+template<typename FloatingPointType> struct IDLFloatingPoint : IDLNumber<FloatingPointType> { };
</ins><span class="cx"> struct IDLFloat : IDLFloatingPoint<float> { };
</span><del>-struct IDLUnrestrictedFloat : IDLFloatingPoint<float, true> { };
</del><ins>+struct IDLUnrestrictedFloat : IDLFloatingPoint<float> { };
</ins><span class="cx"> struct IDLDouble : IDLFloatingPoint<double> { };
</span><del>-struct IDLUnrestrictedDouble : IDLFloatingPoint<double, true> { };
</del><ins>+struct IDLUnrestrictedDouble : IDLFloatingPoint<double> { };
</ins><span class="cx">
</span><span class="cx"> struct IDLString : IDLType<String> {
</span><span class="cx"> using ParameterType = const String&;
</span><span class="lines">@@ -190,8 +193,13 @@
</span><span class="cx"> template<typename T> struct IDLSerializedScriptValue : IDLWrapper<T> { };
</span><span class="cx"> template<typename T> struct IDLEventListener : IDLWrapper<T> { };
</span><span class="cx"> template<typename T> struct IDLXPathNSResolver : IDLWrapper<T> { };
</span><del>-template<typename T> struct IDLIDBKey : IDLWrapper<T> { };
</del><span class="cx">
</span><ins>+struct IDLIDBKey : IDLWrapper<IDBKey> { };
+
+#if ENABLE(WEBGL)
+struct IDLWebGLAny : IDLType<WebGLAny> { };
+#endif
+
</ins><span class="cx"> // Non-WebIDL convenience type aliases
</span><span class="cx">
</span><span class="cx"> using IDLBufferSource = IDLUnion<IDLInterface<JSC::ArrayBufferView>, IDLInterface<JSC::ArrayBuffer>>;
</span><span class="lines">@@ -223,4 +231,7 @@
</span><span class="cx"> template<typename T>
</span><span class="cx"> struct IsIDLInteger : public std::integral_constant<bool, WTF::IsBaseOfTemplate<IDLInteger, T>::value> { };
</span><span class="cx">
</span><ins>+template<typename T>
+struct IsIDLFloatingPoint : public std::integral_constant<bool, WTF::IsBaseOfTemplate<IDLFloatingPoint, T>::value> { };
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMConverth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMConvert.h (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include "IDBBindingUtilities.h"
</span><span class="cx"> #include "IDLTypes.h"
</span><span class="cx"> #include "JSDOMBinding.h"
</span><ins>+#include <runtime/JSGlobalObjectInlines.h>
</ins><span class="cx"> #include <runtime/JSONObject.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -583,6 +584,11 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<> struct Converter<IDLLong> : DefaultConverter<IDLLong> {
</span><ins>+ static inline int32_t convert(JSC::ExecState&, JSC::ThrowScope&, double number)
+ {
+ return JSC::toInt32(number);
+ }
+
</ins><span class="cx"> static int32_t convert(JSC::ExecState& state, JSC::JSValue value, IntegerConversionConfiguration configuration = IntegerConversionConfiguration::Normal)
</span><span class="cx"> {
</span><span class="cx"> switch (configuration) {
</span><span class="lines">@@ -700,6 +706,14 @@
</span><span class="cx"> // MARK: Floating point types
</span><span class="cx">
</span><span class="cx"> template<> struct Converter<IDLFloat> : DefaultConverter<IDLFloat> {
</span><ins>+
+ static inline float convert(JSC::ExecState& state, JSC::ThrowScope& scope, double number)
+ {
+ if (UNLIKELY(!std::isfinite(number)))
+ throwNonFiniteTypeError(state, scope);
+ return static_cast<float>(number);
+ }
+
</ins><span class="cx"> static float convert(JSC::ExecState& state, JSC::JSValue value)
</span><span class="cx"> {
</span><span class="cx"> JSC::VM& vm = state.vm();
</span><span class="lines">@@ -724,6 +738,11 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<> struct Converter<IDLUnrestrictedFloat> : DefaultConverter<IDLUnrestrictedFloat> {
</span><ins>+ static inline float convert(JSC::ExecState&, JSC::ThrowScope&, double number)
+ {
+ return static_cast<float>(number);
+ }
+
</ins><span class="cx"> static float convert(JSC::ExecState& state, JSC::JSValue value)
</span><span class="cx"> {
</span><span class="cx"> return static_cast<float>(value.toNumber(&state));
</span><span class="lines">@@ -743,6 +762,13 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<> struct Converter<IDLDouble> : DefaultConverter<IDLDouble> {
</span><ins>+ static inline double convert(JSC::ExecState& state, JSC::ThrowScope& scope, double number)
+ {
+ if (UNLIKELY(!std::isfinite(number)))
+ throwNonFiniteTypeError(state, scope);
+ return number;
+ }
+
</ins><span class="cx"> static double convert(JSC::ExecState& state, JSC::JSValue value)
</span><span class="cx"> {
</span><span class="cx"> JSC::VM& vm = state.vm();
</span><span class="lines">@@ -767,6 +793,11 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<> struct Converter<IDLUnrestrictedDouble> : DefaultConverter<IDLUnrestrictedDouble> {
</span><ins>+ static inline double convert(JSC::ExecState&, JSC::ThrowScope&, double number)
+ {
+ return number;
+ }
+
</ins><span class="cx"> static double convert(JSC::ExecState& state, JSC::JSValue value)
</span><span class="cx"> {
</span><span class="cx"> return value.toNumber(&state);
</span><span class="lines">@@ -875,21 +906,125 @@
</span><span class="cx">
</span><span class="cx"> namespace Detail {
</span><span class="cx"> template<typename IDLType>
</span><del>- struct ArrayConverterBase;
</del><ins>+ struct GenericSequenceConverter {
+ using ReturnType = Vector<typename IDLType::ImplementationType>;
</ins><span class="cx">
</span><del>- template<typename IDLType>
- struct ArrayConverterBase {
- using ReturnType = Vector<typename IDLType::ImplementationType>;
</del><ins>+ static ReturnType convert(JSC::ExecState& state, JSC::JSObject* jsObject)
+ {
+ ReturnType result;
+ forEachInIterable(&state, jsObject, [&result](JSC::VM& vm, JSC::ExecState* state, JSC::JSValue jsValue) {
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
+ auto convertedValue = Converter<IDLType>::convert(*state, jsValue);
+ if (UNLIKELY(scope.exception()))
+ return;
+ result.append(WTFMove(convertedValue));
+ });
+ return result;
+ }
</ins><span class="cx"> };
</span><span class="cx">
</span><del>- template<typename T>
- struct ArrayConverterBase<IDLInterface<T>> {
- using ReturnType = Vector<RefPtr<T>>;
</del><ins>+ // Specialization for numeric types
+ // FIXME: This is only implemented for the IDLFloatingPointTypes and IDLLong. To add
+ // support for more numeric types, add an overload of Converter<IDLType>::convert that
+ // takes an ExecState, ThrowScope, double as its arguments.
+ template<typename IDLType>
+ struct NumericSequenceConverter {
+ using GenericConverter = GenericSequenceConverter<IDLType>;
+ using ReturnType = typename GenericConverter::ReturnType;
+
+ static ReturnType convert(JSC::ExecState& state, JSC::JSValue value)
+ {
+ auto& vm = state.vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
+ if (!value.isObject()) {
+ throwSequenceTypeError(state, scope);
+ return { };
+ }
+
+ JSC::JSObject* object = JSC::asObject(value);
+ if (!JSC::isJSArray(object))
+ return GenericConverter::convert(state, object);
+
+ JSC::JSArray* array = JSC::asArray(object);
+ if (!array->globalObject()->isArrayIteratorProtocolFastAndNonObservable())
+ return GenericConverter::convert(state, object);
+
+ unsigned length = array->length();
+
+ ReturnType result;
+ if (!result.tryReserveCapacity(length)) {
+ // FIXME: Is the right exception to throw?
+ throwTypeError(&state, scope);
+ return { };
+ }
+
+ JSC::IndexingType indexingType = array->indexingType() & JSC::IndexingShapeMask;
+
+ if (indexingType == JSC::ContiguousShape) {
+ for (unsigned i = 0; i < length; i++) {
+ auto indexValue = array->butterfly()->contiguous()[i].get();
+ if (!indexValue)
+ result.uncheckedAppend(0);
+ else {
+ auto convertedValue = Converter<IDLType>::convert(state, indexValue);
+ RETURN_IF_EXCEPTION(scope, { });
+
+ result.uncheckedAppend(convertedValue);
+ }
+ }
+ return result;
+ }
+
+ if (indexingType == JSC::Int32Shape) {
+ for (unsigned i = 0; i < length; i++) {
+ auto indexValue = array->butterfly()->contiguousInt32()[i].get();
+ ASSERT(!indexValue || indexValue.isInt32());
+ if (!indexValue)
+ result.uncheckedAppend(0);
+ else
+ result.uncheckedAppend(indexValue.asInt32());
+ }
+ return result;
+ }
+
+ if (indexingType == JSC::DoubleShape) {
+ for (unsigned i = 0; i < length; i++) {
+ auto doubleValue = array->butterfly()->contiguousDouble()[i];
+ if (std::isnan(doubleValue))
+ result.uncheckedAppend(0);
+ else {
+ auto convertedValue = Converter<IDLType>::convert(state, scope, doubleValue);
+ RETURN_IF_EXCEPTION(scope, { });
+
+ result.uncheckedAppend(convertedValue);
+ }
+ }
+ return result;
+ }
+
+ for (unsigned i = 0; i < length; i++) {
+ auto indexValue = array->getDirectIndex(&state, i);
+ RETURN_IF_EXCEPTION(scope, { });
+
+ if (!indexValue)
+ result.uncheckedAppend(0);
+ else {
+ auto convertedValue = Converter<IDLType>::convert(state, indexValue);
+ RETURN_IF_EXCEPTION(scope, { });
+
+ result.uncheckedAppend(convertedValue);
+ }
+ }
+ return result;
+ }
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<typename IDLType>
</span><del>- struct ArrayConverter : ArrayConverterBase<IDLType> {
- using ReturnType = typename ArrayConverterBase<IDLType>::ReturnType;
</del><ins>+ struct SequenceConverter {
+ using GenericConverter = GenericSequenceConverter<IDLType>;
+ using ReturnType = typename GenericConverter::ReturnType;
</ins><span class="cx">
</span><span class="cx"> static ReturnType convert(JSC::ExecState& state, JSC::JSValue value)
</span><span class="cx"> {
</span><span class="lines">@@ -901,26 +1036,112 @@
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ JSC::JSObject* object = JSC::asObject(value);
+ if (!JSC::isJSArray(object))
+ return GenericConverter::convert(state, object);
+
+ JSC::JSArray* array = JSC::asArray(object);
+ if (!array->globalObject()->isArrayIteratorProtocolFastAndNonObservable())
+ return GenericConverter::convert(state, object);
+
+ unsigned length = array->length();
+
</ins><span class="cx"> ReturnType result;
</span><del>- forEachInIterable(&state, value, [&result](JSC::VM& vm, JSC::ExecState* state, JSC::JSValue jsValue) {
- auto scope = DECLARE_THROW_SCOPE(vm);
</del><ins>+ if (!result.tryReserveCapacity(length)) {
+ // FIXME: Is the right exception to throw?
+ throwTypeError(&state, scope);
+ return { };
+ }
</ins><span class="cx">
</span><del>- auto convertedValue = Converter<IDLType>::convert(*state, jsValue);
- if (UNLIKELY(scope.exception()))
- return;
- result.append(WTFMove(convertedValue));
- });
</del><ins>+ JSC::IndexingType indexingType = array->indexingType() & JSC::IndexingShapeMask;
+
+ if (indexingType == JSC::ContiguousShape) {
+ for (unsigned i = 0; i < length; i++) {
+ auto indexValue = array->butterfly()->contiguous()[i].get();
+ if (!indexValue)
+ indexValue = JSC::jsUndefined();
+
+ auto convertedValue = Converter<IDLType>::convert(state, indexValue);
+ RETURN_IF_EXCEPTION(scope, { });
+
+ result.uncheckedAppend(convertedValue);
+ }
+ return result;
+ }
+
+ for (unsigned i = 0; i < length; i++) {
+ auto indexValue = array->getDirectIndex(&state, i);
+ RETURN_IF_EXCEPTION(scope, { });
+
+ if (!indexValue)
+ indexValue = JSC::jsUndefined();
+
+ auto convertedValue = Converter<IDLType>::convert(state, indexValue);
+ RETURN_IF_EXCEPTION(scope, { });
+
+ result.uncheckedAppend(convertedValue);
+ }
</ins><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx"> };
</span><ins>+
+ template<>
+ struct SequenceConverter<IDLLong> {
+ using ReturnType = typename GenericSequenceConverter<IDLLong>::ReturnType;
+
+ static ReturnType convert(JSC::ExecState& state, JSC::JSValue value)
+ {
+ return NumericSequenceConverter<IDLLong>::convert(state, value);
+ }
+ };
+
+ template<>
+ struct SequenceConverter<IDLFloat> {
+ using ReturnType = typename GenericSequenceConverter<IDLFloat>::ReturnType;
+
+ static ReturnType convert(JSC::ExecState& state, JSC::JSValue value)
+ {
+ return NumericSequenceConverter<IDLFloat>::convert(state, value);
+ }
+ };
+
+ template<>
+ struct SequenceConverter<IDLUnrestrictedFloat> {
+ using ReturnType = typename GenericSequenceConverter<IDLUnrestrictedFloat>::ReturnType;
+
+ static ReturnType convert(JSC::ExecState& state, JSC::JSValue value)
+ {
+ return NumericSequenceConverter<IDLUnrestrictedFloat>::convert(state, value);
+ }
+ };
+
+ template<>
+ struct SequenceConverter<IDLDouble> {
+ using ReturnType = typename GenericSequenceConverter<IDLDouble>::ReturnType;
+
+ static ReturnType convert(JSC::ExecState& state, JSC::JSValue value)
+ {
+ return NumericSequenceConverter<IDLDouble>::convert(state, value);
+ }
+ };
+
+ template<>
+ struct SequenceConverter<IDLUnrestrictedDouble> {
+ using ReturnType = typename GenericSequenceConverter<IDLUnrestrictedDouble>::ReturnType;
+
+ static ReturnType convert(JSC::ExecState& state, JSC::JSValue value)
+ {
+ return NumericSequenceConverter<IDLUnrestrictedDouble>::convert(state, value);
+ }
+ };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template<typename T> struct Converter<IDLSequence<T>> : DefaultConverter<IDLSequence<T>> {
</span><del>- using ReturnType = typename Detail::ArrayConverter<T>::ReturnType;
</del><ins>+ using ReturnType = typename Detail::SequenceConverter<T>::ReturnType;
</ins><span class="cx">
</span><span class="cx"> static ReturnType convert(JSC::ExecState& state, JSC::JSValue value)
</span><span class="cx"> {
</span><del>- return Detail::ArrayConverter<T>::convert(state, value);
</del><ins>+ return Detail::SequenceConverter<T>::convert(state, value);
</ins><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -939,11 +1160,11 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<typename T> struct Converter<IDLFrozenArray<T>> : DefaultConverter<IDLFrozenArray<T>> {
</span><del>- using ReturnType = typename Detail::ArrayConverter<T>::ReturnType;
</del><ins>+ using ReturnType = typename Detail::SequenceConverter<T>::ReturnType;
</ins><span class="cx">
</span><span class="cx"> static ReturnType convert(JSC::ExecState& state, JSC::JSValue value)
</span><span class="cx"> {
</span><del>- return Detail::ArrayConverter<T>::convert(state, value);
</del><ins>+ return Detail::SequenceConverter<T>::convert(state, value);
</ins><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -1577,7 +1798,7 @@
</span><span class="cx"> // MARK: -
</span><span class="cx"> // MARK: IDLIDBKey type
</span><span class="cx">
</span><del>-template<typename T> struct JSConverter<IDLIDBKey<T>> {
</del><ins>+template<> struct JSConverter<IDLIDBKey> {
</ins><span class="cx"> static constexpr bool needsState = true;
</span><span class="cx"> static constexpr bool needsGlobalObject = true;
</span><span class="cx">
</span><span class="lines">@@ -1588,7 +1809,24 @@
</span><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+#if ENABLE(WEBGL)
+
</ins><span class="cx"> // MARK: -
</span><ins>+// MARK: IDLWebGLAny type
+
+template<> struct JSConverter<IDLWebGLAny> {
+ static constexpr bool needsState = true;
+ static constexpr bool needsGlobalObject = true;
+
+ static JSC::JSValue convert(JSC::ExecState& state, JSDOMGlobalObject& globalObject, const WebGLAny& value)
+ {
+ return convertToJSValue(state, globalObject, value);
+ }
+};
+
+#endif
+
+// MARK: -
</ins><span class="cx"> // MARK: Support for variadic tail convertions
</span><span class="cx">
</span><span class="cx"> namespace Detail {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSWebGL2RenderingContextCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSWebGL2RenderingContextCustom.cpp (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSWebGL2RenderingContextCustom.cpp        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/bindings/js/JSWebGL2RenderingContextCustom.cpp        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -28,9 +28,7 @@
</span><span class="cx"> #if ENABLE(WEBGL) && ENABLE(WEBGL2)
</span><span class="cx">
</span><span class="cx"> #include "JSWebGL2RenderingContext.h"
</span><del>-#include "NotImplemented.h"
</del><span class="cx"> #include <heap/HeapInlines.h>
</span><del>-#include <runtime/Error.h>
</del><span class="cx">
</span><span class="cx"> using namespace JSC;
</span><span class="cx">
</span><span class="lines">@@ -41,51 +39,6 @@
</span><span class="cx"> visitor.addOpaqueRoot(&wrapped());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-JSValue JSWebGL2RenderingContext::getInternalformatParameter(ExecState&)
-{
- return jsUndefined();
-}
-
-JSValue JSWebGL2RenderingContext::getQueryParameter(ExecState&)
-{
- return jsUndefined();
-}
-
-JSValue JSWebGL2RenderingContext::getSamplerParameter(ExecState&)
-{
- return jsUndefined();
-}
-
-JSValue JSWebGL2RenderingContext::getSyncParameter(ExecState&)
-{
- return jsUndefined();
-}
-
-JSValue JSWebGL2RenderingContext::getIndexedParameter(ExecState& state)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() < 2)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- unsigned pname = state.uncheckedArgument(0).toInt32(&state);
- RETURN_IF_EXCEPTION(scope, JSValue());
- unsigned index = state.uncheckedArgument(1).toInt32(&state);
- RETURN_IF_EXCEPTION(scope, JSValue());
- return toJS(state, *globalObject(), wrapped().getIndexedParameter(pname, index));
-}
-
-JSValue JSWebGL2RenderingContext::getActiveUniformBlockParameter(ExecState&)
-{
- return jsUndefined();
-}
-
-JSValue JSWebGL2RenderingContext::getActiveUniformBlockName(ExecState&)
-{
- return jsUndefined();
-}
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(WEBGL)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSWebGLRenderingContextBaseCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextBaseCustom.cpp (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextBaseCustom.cpp        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextBaseCustom.cpp        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -123,21 +123,6 @@
</span><span class="cx"> return wrap(state, globalObject, object);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static JSValue objectParameter(JSWebGLRenderingContextBase& context, ExecState& state, WebGLAny (WebGLRenderingContextBase::*getter)(GC3Denum target, GC3Denum pname))
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() != 2)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- auto target = state.uncheckedArgument(0).toInt32(&state);
- RETURN_IF_EXCEPTION(scope, { });
- auto pname = state.uncheckedArgument(1).toInt32(&state);
- RETURN_IF_EXCEPTION(scope, { });
- return toJS(state, *context.globalObject(), (context.wrapped().*getter)(target, pname));
-}
-
</del><span class="cx"> static JSValue toJS(ExecState& state, JSDOMGlobalObject& globalObject, WebGLExtension* extension)
</span><span class="cx"> {
</span><span class="cx"> if (!extension)
</span><span class="lines">@@ -203,26 +188,6 @@
</span><span class="cx"> visitor.addOpaqueRoot(root(wrapped().canvas()));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-JSValue JSWebGLRenderingContextBase::getAttachedShaders(ExecState& state)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() < 1)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
- auto& context = wrapped();
- auto* program = JSWebGLProgram::toWrapped(state.uncheckedArgument(0));
- if (!program && !state.uncheckedArgument(0).isUndefinedOrNull())
- return throwTypeError(&state, scope);
- Vector<RefPtr<WebGLShader>> shaders;
- if (!context.getAttachedShaders(program, shaders))
- return jsNull();
- MarkedArgumentBuffer list;
- for (auto& shader : shaders)
- list.append(toJS(&state, globalObject(), shader.get()));
- return constructArray(&state, 0, globalObject(), list);
-}
-
</del><span class="cx"> JSValue JSWebGLRenderingContextBase::getExtension(ExecState& state)
</span><span class="cx"> {
</span><span class="cx"> VM& vm = state.vm();
</span><span class="lines">@@ -236,423 +201,6 @@
</span><span class="cx"> return toJS(state, *globalObject(), wrapped().getExtension(name));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-JSValue JSWebGLRenderingContextBase::getBufferParameter(ExecState& state)
-{
- return objectParameter(*this, state, &WebGLRenderingContextBase::getBufferParameter);
-}
-
-JSValue JSWebGLRenderingContextBase::getFramebufferAttachmentParameter(ExecState& state)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() != 3)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- auto target = state.uncheckedArgument(0).toInt32(&state);
- RETURN_IF_EXCEPTION(scope, { });
- auto attachment = state.uncheckedArgument(1).toInt32(&state);
- RETURN_IF_EXCEPTION(scope, { });
- auto pname = state.uncheckedArgument(2).toInt32(&state);
- RETURN_IF_EXCEPTION(scope, { });
- return toJS(state, *globalObject(), wrapped().getFramebufferAttachmentParameter(target, attachment, pname));
-}
-
-JSValue JSWebGLRenderingContextBase::getParameter(ExecState& state)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() != 1)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- auto pname = state.uncheckedArgument(0).toInt32(&state);
- RETURN_IF_EXCEPTION(scope, { });
- return toJS(state, *globalObject(), wrapped().getParameter(pname));
-}
-
-JSValue JSWebGLRenderingContextBase::getProgramParameter(ExecState& state)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() != 2)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- auto* program = JSWebGLProgram::toWrapped(state.uncheckedArgument(0));
- if (!program && !state.uncheckedArgument(0).isUndefinedOrNull())
- return throwTypeError(&state, scope);
- auto pname = state.uncheckedArgument(1).toInt32(&state);
- RETURN_IF_EXCEPTION(scope, { });
- return toJS(state, *globalObject(), wrapped().getProgramParameter(program, pname));
-}
-
-JSValue JSWebGLRenderingContextBase::getRenderbufferParameter(ExecState& state)
-{
- return objectParameter(*this, state, &WebGLRenderingContextBase::getRenderbufferParameter);
-}
-
-JSValue JSWebGLRenderingContextBase::getShaderParameter(ExecState& state)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() != 2)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- if (!state.uncheckedArgument(0).isUndefinedOrNull() && !state.uncheckedArgument(0).inherits(JSWebGLShader::info()))
- return throwTypeError(&state, scope);
- WebGLShader* shader = JSWebGLShader::toWrapped(state.uncheckedArgument(0));
- unsigned pname = state.uncheckedArgument(1).toInt32(&state);
- RETURN_IF_EXCEPTION(scope, { });
- return toJS(state, *globalObject(), wrapped().getShaderParameter(shader, pname));
-}
-
-JSValue JSWebGLRenderingContextBase::getSupportedExtensions(ExecState& state)
-{
- WebGLRenderingContextBase& context = wrapped();
- if (context.isContextLost())
- return jsNull();
- MarkedArgumentBuffer list;
- for (auto& extension : context.getSupportedExtensions())
- list.append(jsStringWithCache(&state, extension));
- return constructArray(&state, 0, globalObject(), list);
-}
-
-JSValue JSWebGLRenderingContextBase::getTexParameter(ExecState& state)
-{
- return objectParameter(*this, state, &WebGLRenderingContextBase::getTexParameter);
-}
-
-JSValue JSWebGLRenderingContextBase::getUniform(ExecState& state)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() != 2)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- WebGLProgram* program = JSWebGLProgram::toWrapped(state.uncheckedArgument(0));
- if (!program && !state.uncheckedArgument(0).isUndefinedOrNull())
- return throwTypeError(&state, scope);
- WebGLUniformLocation* location = JSWebGLUniformLocation::toWrapped(state.uncheckedArgument(1));
- if (!location && !state.uncheckedArgument(1).isUndefinedOrNull())
- return throwTypeError(&state, scope);
- return toJS(state, *globalObject(), wrapped().getUniform(program, location));
-}
-
-JSValue JSWebGLRenderingContextBase::getVertexAttrib(ExecState& state)
-{
- return objectParameter(*this, state, &WebGLRenderingContextBase::getVertexAttrib);
-}
-
-template<typename VectorType> bool toNumberVector(ExecState& state, JSValue value, VectorType& vector)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (!value.isObject())
- return false;
-
- auto& object = *asObject(value);
- int32_t length = object.get(&state, state.vm().propertyNames->length).toInt32(&state);
-
- if (!vector.tryReserveCapacity(length))
- return false;
-
- for (int32_t i = 0; i < length; ++i) {
- auto value = object.get(&state, i);
- RETURN_IF_EXCEPTION(scope, false);
- vector.uncheckedAppend(value.toNumber(&state));
- RETURN_IF_EXCEPTION(scope, false);
- }
-
- return true;
-}
-
-enum DataFunctionToCall {
- f_uniform1v, f_uniform2v, f_uniform3v, f_uniform4v,
- f_vertexAttrib1v, f_vertexAttrib2v, f_vertexAttrib3v, f_vertexAttrib4v
-};
-
-enum DataFunctionMatrixToCall {
- f_uniformMatrix2fv, f_uniformMatrix3fv, f_uniformMatrix4fv
-};
-
-static inline bool functionForUniform(DataFunctionToCall f)
-{
- switch (f) {
- case f_uniform1v:
- case f_uniform2v:
- case f_uniform3v:
- case f_uniform4v:
- return true;
- default:
- return false;
- }
-}
-
-static JSValue dataFunctionf(DataFunctionToCall f, ExecState& state, WebGLRenderingContextBase& context)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() != 2)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- WebGLUniformLocation* location = nullptr;
- GLuint index = -1;
-
- if (functionForUniform(f)) {
- location = JSWebGLUniformLocation::toWrapped(state.uncheckedArgument(0));
- if (!location && !state.uncheckedArgument(0).isUndefinedOrNull())
- return throwTypeError(&state, scope);
- } else {
- index = state.uncheckedArgument(0).toInt32(&state);
- RETURN_IF_EXCEPTION(scope, { });
- }
-
- if (auto webGLArray = toUnsharedFloat32Array(state.uncheckedArgument(1))) {
- switch (f) {
- case f_uniform1v:
- context.uniform1fv(location, *webGLArray);
- break;
- case f_uniform2v:
- context.uniform2fv(location, *webGLArray);
- break;
- case f_uniform3v:
- context.uniform3fv(location, *webGLArray);
- break;
- case f_uniform4v:
- context.uniform4fv(location, *webGLArray);
- break;
- case f_vertexAttrib1v:
- context.vertexAttrib1fv(index, *webGLArray);
- break;
- case f_vertexAttrib2v:
- context.vertexAttrib2fv(index, *webGLArray);
- break;
- case f_vertexAttrib3v:
- context.vertexAttrib3fv(index, *webGLArray);
- break;
- case f_vertexAttrib4v:
- context.vertexAttrib4fv(index, *webGLArray);
- break;
- }
- return jsUndefined();
- }
-
- Vector<float, 64> array;
- if (!toNumberVector(state, state.uncheckedArgument(1), array))
- return throwTypeError(&state, scope);
-
- switch (f) {
- case f_uniform1v:
- context.uniform1fv(location, array.data(), array.size());
- break;
- case f_uniform2v:
- context.uniform2fv(location, array.data(), array.size());
- break;
- case f_uniform3v:
- context.uniform3fv(location, array.data(), array.size());
- break;
- case f_uniform4v:
- context.uniform4fv(location, array.data(), array.size());
- break;
- case f_vertexAttrib1v:
- context.vertexAttrib1fv(index, array.data(), array.size());
- break;
- case f_vertexAttrib2v:
- context.vertexAttrib2fv(index, array.data(), array.size());
- break;
- case f_vertexAttrib3v:
- context.vertexAttrib3fv(index, array.data(), array.size());
- break;
- case f_vertexAttrib4v:
- context.vertexAttrib4fv(index, array.data(), array.size());
- break;
- }
- return jsUndefined();
-}
-
-static JSValue dataFunctioni(DataFunctionToCall f, ExecState& state, WebGLRenderingContextBase& context)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() != 2)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- auto* location = JSWebGLUniformLocation::toWrapped(state.uncheckedArgument(0));
- if (!location && !state.uncheckedArgument(0).isUndefinedOrNull())
- return throwTypeError(&state, scope);
-
- if (auto webGLArray = toUnsharedInt32Array(state.uncheckedArgument(1))) {
- switch (f) {
- case f_uniform1v:
- context.uniform1iv(location, *webGLArray);
- break;
- case f_uniform2v:
- context.uniform2iv(location, *webGLArray);
- break;
- case f_uniform3v:
- context.uniform3iv(location, *webGLArray);
- break;
- case f_uniform4v:
- context.uniform4iv(location, *webGLArray);
- break;
- default:
- break;
- }
- return jsUndefined();
- }
-
- Vector<int, 64> array;
- if (!toNumberVector(state, state.uncheckedArgument(1), array))
- return throwTypeError(&state, scope);
-
- switch (f) {
- case f_uniform1v:
- context.uniform1iv(location, array.data(), array.size());
- break;
- case f_uniform2v:
- context.uniform2iv(location, array.data(), array.size());
- break;
- case f_uniform3v:
- context.uniform3iv(location, array.data(), array.size());
- break;
- case f_uniform4v:
- context.uniform4iv(location, array.data(), array.size());
- break;
- default:
- break;
- }
- return jsUndefined();
-}
-
-static JSValue dataFunctionMatrix(DataFunctionMatrixToCall f, ExecState& state, WebGLRenderingContextBase& context)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (state.argumentCount() != 3)
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- auto* location = JSWebGLUniformLocation::toWrapped(state.uncheckedArgument(0));
- if (!location && !state.uncheckedArgument(0).isUndefinedOrNull())
- return throwTypeError(&state, scope);
-
- bool transpose = state.uncheckedArgument(1).toBoolean(&state);
- RETURN_IF_EXCEPTION(scope, { });
-
- if (auto webGLArray = toUnsharedFloat32Array(state.uncheckedArgument(2))) {
- switch (f) {
- case f_uniformMatrix2fv:
- context.uniformMatrix2fv(location, transpose, *webGLArray);
- break;
- case f_uniformMatrix3fv:
- context.uniformMatrix3fv(location, transpose, *webGLArray);
- break;
- case f_uniformMatrix4fv:
- context.uniformMatrix4fv(location, transpose, *webGLArray);
- break;
- }
- return jsUndefined();
- }
-
- Vector<float, 64> array;
- if (!toNumberVector(state, state.uncheckedArgument(2), array))
- return throwTypeError(&state, scope);
-
- switch (f) {
- case f_uniformMatrix2fv:
- context.uniformMatrix2fv(location, transpose, array.data(), array.size());
- break;
- case f_uniformMatrix3fv:
- context.uniformMatrix3fv(location, transpose, array.data(), array.size());
- break;
- case f_uniformMatrix4fv:
- context.uniformMatrix4fv(location, transpose, array.data(), array.size());
- break;
- }
- return jsUndefined();
-}
-
-JSValue JSWebGLRenderingContextBase::uniform1fv(ExecState& state)
-{
- return dataFunctionf(f_uniform1v, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::uniform1iv(ExecState& state)
-{
- return dataFunctioni(f_uniform1v, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::uniform2fv(ExecState& state)
-{
- return dataFunctionf(f_uniform2v, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::uniform2iv(ExecState& state)
-{
- return dataFunctioni(f_uniform2v, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::uniform3fv(ExecState& state)
-{
- return dataFunctionf(f_uniform3v, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::uniform3iv(ExecState& state)
-{
- return dataFunctioni(f_uniform3v, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::uniform4fv(ExecState& state)
-{
- return dataFunctionf(f_uniform4v, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::uniform4iv(ExecState& state)
-{
- return dataFunctioni(f_uniform4v, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::uniformMatrix2fv(ExecState& state)
-{
- return dataFunctionMatrix(f_uniformMatrix2fv, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::uniformMatrix3fv(ExecState& state)
-{
- return dataFunctionMatrix(f_uniformMatrix3fv, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::uniformMatrix4fv(ExecState& state)
-{
- return dataFunctionMatrix(f_uniformMatrix4fv, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::vertexAttrib1fv(ExecState& state)
-{
- return dataFunctionf(f_vertexAttrib1v, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::vertexAttrib2fv(ExecState& state)
-{
- return dataFunctionf(f_vertexAttrib2v, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::vertexAttrib3fv(ExecState& state)
-{
- return dataFunctionf(f_vertexAttrib3v, state, wrapped());
-}
-
-JSValue JSWebGLRenderingContextBase::vertexAttrib4fv(ExecState& state)
-{
- return dataFunctionf(f_vertexAttrib4v, state, wrapped());
-}
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(WEBGL)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -878,7 +878,6 @@
</span><span class="cx"> return 1 if $type->isUnion;
</span><span class="cx"> return 1 if $type->name eq "BufferSource";
</span><span class="cx"> return 1 if $type->name eq "EventListener";
</span><del>- return 1 if $type->name eq "IDBKey";
</del><span class="cx"> return 1 if $type->name eq "JSON";
</span><span class="cx"> return 1 if $type->name eq "Promise";
</span><span class="cx"> return 1 if $type->name eq "SerializedScriptValue";
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -5083,8 +5083,12 @@
</span><span class="cx">
</span><span class="cx"> sub GetBaseIDLType
</span><span class="cx"> {
</span><del>- my ($interface, $type) = @_;
</del><ins>+ my ($interface, $type, $context) = @_;
</ins><span class="cx">
</span><ins>+ if ($context && $context->extendedAttributes->{OverrideIDLType}) {
+ return $context->extendedAttributes->{OverrideIDLType};
+ }
+
</ins><span class="cx"> my %IDLTypes = (
</span><span class="cx"> "any" => "IDLAny",
</span><span class="cx"> "boolean" => "IDLBoolean",
</span><span class="lines">@@ -5108,7 +5112,6 @@
</span><span class="cx"> # Non-WebIDL extensions
</span><span class="cx"> "Date" => "IDLDate",
</span><span class="cx"> "EventListener" => "IDLEventListener<JSEventListener>",
</span><del>- "IDBKey" => "IDLIDBKey<IDBKey>",
</del><span class="cx"> "JSON" => "IDLJSON",
</span><span class="cx"> "SerializedScriptValue" => "IDLSerializedScriptValue<SerializedScriptValue>",
</span><span class="cx"> "XPathNSResolver" => "IDLXPathNSResolver<XPathNSResolver>",
</span><span class="lines">@@ -5133,9 +5136,9 @@
</span><span class="cx">
</span><span class="cx"> sub GetIDLType
</span><span class="cx"> {
</span><del>- my ($interface, $type) = @_;
</del><ins>+ my ($interface, $type, $context) = @_;
</ins><span class="cx">
</span><del>- my $baseIDLType = GetBaseIDLType($interface, $type);
</del><ins>+ my $baseIDLType = GetBaseIDLType($interface, $type, $context);
</ins><span class="cx"> return "IDLNullable<" . $baseIDLType . ">" if $type->isNullable;
</span><span class="cx"> return $baseIDLType;
</span><span class="cx"> }
</span><span class="lines">@@ -5322,8 +5325,19 @@
</span><span class="cx">
</span><span class="cx"> sub NativeToJSValueDOMConvertNeedsState
</span><span class="cx"> {
</span><del>- my ($type) = @_;
-
</del><ins>+ my ($type, $context) = @_;
+
+ # FIXME: We need a more robost way to specify this requirement so as not
+ # to require specializing each type. Perhaps just requiring all override
+ # types to take both state and the global object would work?
+ if ($context->extendedAttributes->{OverrideIDLType}) {
+ my $overrideTypeName = $context->extendedAttributes->{OverrideIDLType};
+ return 1 if $overrideTypeName eq "IDLIDBKey";
+ return 1 if $overrideTypeName eq "IDLWebGLAny";
+
+ return 0;
+ }
+
</ins><span class="cx"> # FIXME: This should actually check if all the sub-objects of the union need the state.
</span><span class="cx"> return 1 if $type->isUnion;
</span><span class="cx"> return 1 if $codeGenerator->IsSequenceOrFrozenArrayType($type);
</span><span class="lines">@@ -5334,7 +5348,6 @@
</span><span class="cx"> return 1 if $codeGenerator->IsInterfaceType($type);
</span><span class="cx"> return 1 if $codeGenerator->IsTypedArrayType($type);
</span><span class="cx"> return 1 if $type->name eq "Date";
</span><del>- return 1 if $type->name eq "IDBKey";
</del><span class="cx"> return 1 if $type->name eq "JSON";
</span><span class="cx"> return 1 if $type->name eq "SerializedScriptValue";
</span><span class="cx"> return 1 if $type->name eq "XPathNSResolver";
</span><span class="lines">@@ -5344,8 +5357,19 @@
</span><span class="cx">
</span><span class="cx"> sub NativeToJSValueDOMConvertNeedsGlobalObject
</span><span class="cx"> {
</span><del>- my ($type) = @_;
</del><ins>+ my ($type, $context) = @_;
</ins><span class="cx">
</span><ins>+ # FIXME: We need a more robost way to specify this requirement so as not
+ # to require specializing each type. Perhaps just requiring all override
+ # types to take both state and the global object would work?
+ if ($context->extendedAttributes->{OverrideIDLType}) {
+ my $overrideTypeName = $context->extendedAttributes->{OverrideIDLType};
+ return 1 if $overrideTypeName eq "IDLIDBKey";
+ return 1 if $overrideTypeName eq "IDLWebGLAny";
+
+ return 0;
+ }
+
</ins><span class="cx"> # FIXME: This should actually check if all the sub-objects of the union need the global object.
</span><span class="cx"> return 1 if $type->isUnion;
</span><span class="cx"> return 1 if $codeGenerator->IsSequenceOrFrozenArrayType($type);
</span><span class="lines">@@ -5353,7 +5377,6 @@
</span><span class="cx"> return 1 if $codeGenerator->IsDictionaryType($type);
</span><span class="cx"> return 1 if $codeGenerator->IsInterfaceType($type);
</span><span class="cx"> return 1 if $codeGenerator->IsTypedArrayType($type);
</span><del>- return 1 if $type->name eq "IDBKey";
</del><span class="cx"> return 1 if $type->name eq "SerializedScriptValue";
</span><span class="cx"> return 1 if $type->name eq "XPathNSResolver";
</span><span class="cx">
</span><span class="lines">@@ -5410,11 +5433,11 @@
</span><span class="cx">
</span><span class="cx"> $value = "BindingSecurity::checkSecurityForNode($stateReference, $value)" if $context->extendedAttributes->{CheckSecurityForNode};
</span><span class="cx">
</span><del>- my $IDLType = GetIDLType($interface, $type);
</del><ins>+ my $IDLType = GetIDLType($interface, $type, $context);
</ins><span class="cx">
</span><span class="cx"> my @conversionArguments = ();
</span><del>- push(@conversionArguments, $stateReference) if NativeToJSValueDOMConvertNeedsState($type) || $mayThrowException;
- push(@conversionArguments, $globalObjectReference) if NativeToJSValueDOMConvertNeedsGlobalObject($type);
</del><ins>+ push(@conversionArguments, $stateReference) if NativeToJSValueDOMConvertNeedsState($type, $context) || $mayThrowException;
+ push(@conversionArguments, $globalObjectReference) if NativeToJSValueDOMConvertNeedsGlobalObject($type, $context);
</ins><span class="cx"> push(@conversionArguments, "throwScope") if $mayThrowException;
</span><span class="cx"> push(@conversionArguments, $value);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsIDLAttributestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -99,6 +99,7 @@
</span><span class="cx"> NoInterfaceObject
</span><span class="cx"> NotEnumerable
</span><span class="cx"> OverrideBuiltins
</span><ins>+OverrideIDLType=*
</ins><span class="cx"> PassContext
</span><span class="cx"> PrimaryGlobal
</span><span class="cx"> PrivateIdentifier
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGL2RenderingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -1087,8 +1087,11 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Vector<String> WebGL2RenderingContext::getSupportedExtensions()
</del><ins>+std::optional<Vector<String>> WebGL2RenderingContext::getSupportedExtensions()
</ins><span class="cx"> {
</span><ins>+ if (isContextLost())
+ return std::nullopt;
+
</ins><span class="cx"> Vector<String> result;
</span><span class="cx">
</span><span class="cx"> if (m_isPendingPolicyResolution)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGL2RenderingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -173,7 +173,7 @@
</span><span class="cx">
</span><span class="cx"> // Extensions
</span><span class="cx"> WebGLExtension* getExtension(const String&) final;
</span><del>- Vector<String> getSupportedExtensions() final;
</del><ins>+ std::optional<Vector<String>> getSupportedExtensions() final;
</ins><span class="cx"> WebGLAny getParameter(GC3Denum pname) final;
</span><span class="cx">
</span><span class="cx"> void renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height) final;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGL2RenderingContextidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.idl (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.idl        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.idl        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -354,7 +354,7 @@
</span><span class="cx"> /* Framebuffer objects */
</span><span class="cx"> void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
</span><span class="cx"> void framebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
</span><del>- [Custom] any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname);
</del><ins>+ [OverrideIDLType=IDLWebGLAny] any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname);
</ins><span class="cx"> void invalidateFramebuffer(GLenum target, sequence<GLenum> attachments);
</span><span class="cx"> void invalidateSubFramebuffer(GLenum target, sequence<GLenum> attachments, GLint x, GLint y, GLsizei width, GLsizei height);
</span><span class="cx"> void readBuffer(GLenum src);
</span><span class="lines">@@ -418,7 +418,7 @@
</span><span class="cx"> void beginQuery(GLenum target, WebGLQuery? query);
</span><span class="cx"> void endQuery(GLenum target);
</span><span class="cx"> WebGLQuery getQuery(GLenum target, GLenum pname);
</span><del>- [Custom] any getQueryParameter(WebGLQuery? query, GLenum pname);
</del><ins>+ [OverrideIDLType=IDLWebGLAny] any getQueryParameter(WebGLQuery? query, GLenum pname);
</ins><span class="cx">
</span><span class="cx"> /* Sampler Objects */
</span><span class="cx"> WebGLSampler createSampler();
</span><span class="lines">@@ -427,7 +427,7 @@
</span><span class="cx"> void bindSampler(GLuint unit, WebGLSampler? sampler);
</span><span class="cx"> void samplerParameteri(WebGLSampler? sampler, GLenum pname, GLint param);
</span><span class="cx"> void samplerParameterf(WebGLSampler? sampler, GLenum pname, GLfloat param);
</span><del>- [Custom] any getSamplerParameter(WebGLSampler? sampler, GLenum pname);
</del><ins>+ [OverrideIDLType=IDLWebGLAny] any getSamplerParameter(WebGLSampler? sampler, GLenum pname);
</ins><span class="cx">
</span><span class="cx"> /* Sync objects */
</span><span class="cx"> WebGLSync fenceSync(GLenum condition, GLbitfield flags);
</span><span class="lines">@@ -435,7 +435,7 @@
</span><span class="cx"> void deleteSync(WebGLSync? sync);
</span><span class="cx"> GLenum clientWaitSync(WebGLSync? sync, GLbitfield flags, GLuint64 timeout);
</span><span class="cx"> void waitSync(WebGLSync? sync, GLbitfield flags, GLuint64 timeout);
</span><del>- [Custom] any getSyncParameter(WebGLSync? sync, GLenum pname);
</del><ins>+ [OverrideIDLType=IDLWebGLAny] any getSyncParameter(WebGLSync? sync, GLenum pname);
</ins><span class="cx">
</span><span class="cx"> /* Transform Feedback */
</span><span class="cx"> WebGLTransformFeedback createTransformFeedback();
</span><span class="lines">@@ -452,12 +452,12 @@
</span><span class="cx"> /* Uniform Buffer Objects and Transform Feedback Buffers */
</span><span class="cx"> void bindBufferBase(GLenum target, GLuint index, WebGLBuffer? buffer);
</span><span class="cx"> void bindBufferRange(GLenum target, GLuint index, WebGLBuffer? buffer, GLintptr offset, GLsizeiptr size);
</span><del>- [Custom] any getIndexedParameter(GLenum target, GLuint index);
</del><ins>+ [OverrideIDLType=IDLWebGLAny] any getIndexedParameter(GLenum target, GLuint index);
</ins><span class="cx"> Uint32Array getUniformIndices(WebGLProgram? program, sequence<DOMString> uniformNames);
</span><span class="cx"> Int32Array getActiveUniforms(WebGLProgram? program, Uint32Array? uniformIndices, GLenum pname);
</span><span class="cx"> GLuint getUniformBlockIndex(WebGLProgram? program, DOMString uniformBlockName);
</span><del>- [Custom] any getActiveUniformBlockParameter(WebGLProgram? program, GLuint uniformBlockIndex, GLenum pname);
- [Custom] any getActiveUniformBlockName(WebGLProgram? program, GLuint uniformBlockIndex);
</del><ins>+ [OverrideIDLType=IDLWebGLAny] any getActiveUniformBlockParameter(WebGLProgram? program, GLuint uniformBlockIndex, GLenum pname);
+ [OverrideIDLType=IDLWebGLAny] any getActiveUniformBlockName(WebGLProgram? program, GLuint uniformBlockIndex);
</ins><span class="cx"> void uniformBlockBinding(WebGLProgram? program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
</span><span class="cx">
</span><span class="cx"> /* Vertex Array Objects */
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLAnycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLAny.cpp (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLAny.cpp        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/html/canvas/WebGLAny.cpp        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -45,8 +45,8 @@
</span><span class="cx">
</span><span class="cx"> using namespace JSC;
</span><span class="cx">
</span><del>-// FIXME: This likely can be autogenerated with a bit of work.
-JSValue toJS(ExecState& state, JSDOMGlobalObject& globalObject, const WebGLAny& any)
</del><ins>+// FIXME: This should use the IDLUnion JSConverter.
+JSValue convertToJSValue(ExecState& state, JSDOMGlobalObject& globalObject, const WebGLAny& any)
</ins><span class="cx"> {
</span><span class="cx"> return WTF::switchOn(any,
</span><span class="cx"> [] (std::nullptr_t) {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLAnyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLAny.h (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLAny.h        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/html/canvas/WebGLAny.h        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -27,21 +27,11 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(WEBGL)
</span><span class="cx">
</span><del>-#include "WebGLBuffer.h"
-#include "WebGLFramebuffer.h"
-#include "WebGLProgram.h"
-#include "WebGLRenderbuffer.h"
-#include "WebGLTexture.h"
-#include "WebGLVertexArrayObjectOES.h"
</del><span class="cx"> #include <runtime/Float32Array.h>
</span><span class="cx"> #include <runtime/Int32Array.h>
</span><span class="cx"> #include <runtime/Uint32Array.h>
</span><span class="cx"> #include <runtime/Uint8Array.h>
</span><span class="cx">
</span><del>-#if ENABLE(WEBGL2)
-#include "WebGLVertexArrayObject.h"
-#endif
-
</del><span class="cx"> namespace JSC {
</span><span class="cx"> class ExecState;
</span><span class="cx"> class JSValue;
</span><span class="lines">@@ -50,8 +40,23 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class JSDOMGlobalObject;
</span><ins>+class WebGLBuffer;
+class WebGLFramebuffer;
+class WebGLProgram;
+class WebGLRenderbuffer;
+class WebGLTexture;
+class WebGLVertexArrayObject;
+class WebGLVertexArrayObjectOES;
</ins><span class="cx">
</span><del>-using WebGLAny = Variant<std::nullptr_t, bool, int, unsigned, long long, float, String, Vector<bool>,
</del><ins>+using WebGLAny = Variant<
+ std::nullptr_t,
+ bool,
+ int,
+ unsigned,
+ long long,
+ float,
+ String,
+ Vector<bool>,
</ins><span class="cx"> RefPtr<Float32Array>,
</span><span class="cx"> RefPtr<Int32Array>,
</span><span class="cx"> RefPtr<Uint32Array>,
</span><span class="lines">@@ -67,7 +72,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> >;
</span><span class="cx">
</span><del>-JSC::JSValue toJS(JSC::ExecState&, JSDOMGlobalObject&, const WebGLAny&);
</del><ins>+JSC::JSValue convertToJSValue(JSC::ExecState&, JSDOMGlobalObject&, const WebGLAny&);
</ins><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -249,8 +249,11 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Vector<String> WebGLRenderingContext::getSupportedExtensions()
</del><ins>+std::optional<Vector<String>> WebGLRenderingContext::getSupportedExtensions()
</ins><span class="cx"> {
</span><ins>+ if (isContextLost())
+ return std::nullopt;
+
</ins><span class="cx"> Vector<String> result;
</span><span class="cx">
</span><span class="cx"> if (m_isPendingPolicyResolution)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">
</span><span class="cx"> WebGLExtension* getExtension(const String&) final;
</span><span class="cx"> WebGLAny getParameter(GC3Denum pname) final;
</span><del>- Vector<String> getSupportedExtensions() final;
</del><ins>+ std::optional<Vector<String>> getSupportedExtensions() final;
</ins><span class="cx">
</span><span class="cx"> WebGLAny getFramebufferAttachmentParameter(GC3Denum target, GC3Denum attachment, GC3Denum pname) final;
</span><span class="cx"> void renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height) final;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -2135,22 +2135,22 @@
</span><span class="cx"> return WebGLActiveInfo::create(info.name, info.type, info.size);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program, Vector<RefPtr<WebGLShader>>& shaderObjects)
</del><ins>+std::optional<Vector<RefPtr<WebGLShader>>> WebGLRenderingContextBase::getAttachedShaders(WebGLProgram* program)
</ins><span class="cx"> {
</span><del>- shaderObjects.clear();
</del><span class="cx"> if (isContextLostOrPending() || !validateWebGLObject("getAttachedShaders", program))
</span><del>- return false;
</del><ins>+ return std::nullopt;
</ins><span class="cx">
</span><del>- const GC3Denum shaderType[] = {
</del><ins>+ const GC3Denum shaderTypes[] = {
</ins><span class="cx"> GraphicsContext3D::VERTEX_SHADER,
</span><span class="cx"> GraphicsContext3D::FRAGMENT_SHADER
</span><span class="cx"> };
</span><del>- for (unsigned i = 0; i < sizeof(shaderType) / sizeof(GC3Denum); ++i) {
- WebGLShader* shader = program->getAttachedShader(shaderType[i]);
</del><ins>+ Vector<RefPtr<WebGLShader>> shaderObjects;
+ for (auto shaderType : shaderTypes) {
+ WebGLShader* shader = program->getAttachedShader(shaderType);
</ins><span class="cx"> if (shader)
</span><span class="cx"> shaderObjects.append(shader);
</span><span class="cx"> }
</span><del>- return true;
</del><ins>+ return shaderObjects;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GC3Dint WebGLRenderingContextBase::getAttribLocation(WebGLProgram* program, const String& name)
</span><span class="lines">@@ -4173,102 +4173,63 @@
</span><span class="cx"> m_context->uniform1f(location->location(), x);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location, Float32Array& v)
</del><ins>+void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !validateUniformParameters("uniform1fv", location, v, 1))
</del><ins>+ if (isContextLostOrPending() || !location)
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- m_context->uniform1fv(location->location(), v.length(), v.data());
-}
-
-void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size)
-{
- if (isContextLostOrPending() || !validateUniformParameters("uniform1fv", location, v, size, 1))
</del><ins>+ if (location->program() != m_currentProgram) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform2f", "location not for current program");
</ins><span class="cx"> return;
</span><ins>+ }
</ins><span class="cx">
</span><del>- m_context->uniform1fv(location->location(), size, v);
</del><ins>+ m_context->uniform2f(location->location(), x, y);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location, GC3Dint x)
</del><ins>+void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z)
</ins><span class="cx"> {
</span><span class="cx"> if (isContextLostOrPending() || !location)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->program() != m_currentProgram) {
</span><del>- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform1i", "location not for current program");
</del><ins>+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform3f", "location not for current program");
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ((location->type() == GraphicsContext3D::SAMPLER_2D || location->type() == GraphicsContext3D::SAMPLER_CUBE) && x >= (int)m_textureUnits.size()) {
- synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "uniform1i", "invalid texture unit");
- return;
- }
-
- m_context->uniform1i(location->location(), x);
</del><ins>+ m_context->uniform3f(location->location(), x, y, z);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location, Int32Array& v)
</del><ins>+void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !validateUniformParameters("uniform1iv", location, v, 1))
</del><ins>+ if (isContextLostOrPending() || !location)
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- if (location->type() == GraphicsContext3D::SAMPLER_2D || location->type() == GraphicsContext3D::SAMPLER_CUBE)
- for (unsigned i = 0; i < v.length(); ++i) {
- if (v.data()[i] >= static_cast<int>(m_textureUnits.size())) {
- LOG(WebGL, "Texture unit size=%zu, v[%d]=%d. Location type = %04X.", m_textureUnits.size(), i, v.data()[i], location->type());
- synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "uniform1iv", "invalid texture unit");
- return;
- }
- }
-
- m_context->uniform1iv(location->location(), v.length(), v.data());
-}
-
-void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size)
-{
- if (isContextLostOrPending() || !validateUniformParameters("uniform1iv", location, v, size, 1))
</del><ins>+ if (location->program() != m_currentProgram) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform4f", "location not for current program");
</ins><span class="cx"> return;
</span><ins>+ }
</ins><span class="cx">
</span><del>- if (location->type() == GraphicsContext3D::SAMPLER_2D || location->type() == GraphicsContext3D::SAMPLER_CUBE)
- for (unsigned i = 0; i < static_cast<unsigned>(size); ++i) {
- if (((GC3Dint*)v)[i] >= static_cast<int>(m_textureUnits.size())) {
- synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "uniform1iv", "invalid texture unit");
- return;
- }
- }
-
- m_context->uniform1iv(location->location(), size, v);
</del><ins>+ m_context->uniform4f(location->location(), x, y, z, w);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform2f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y)
</del><ins>+void WebGLRenderingContextBase::uniform1i(const WebGLUniformLocation* location, GC3Dint x)
</ins><span class="cx"> {
</span><span class="cx"> if (isContextLostOrPending() || !location)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->program() != m_currentProgram) {
</span><del>- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform2f", "location not for current program");
</del><ins>+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform1i", "location not for current program");
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- m_context->uniform2f(location->location(), x, y);
-}
-
-void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location, Float32Array& v)
-{
- if (isContextLostOrPending() || !validateUniformParameters("uniform2fv", location, v, 2))
</del><ins>+ if ((location->type() == GraphicsContext3D::SAMPLER_2D || location->type() == GraphicsContext3D::SAMPLER_CUBE) && x >= (int)m_textureUnits.size()) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "uniform1i", "invalid texture unit");
</ins><span class="cx"> return;
</span><ins>+ }
</ins><span class="cx">
</span><del>- m_context->uniform2fv(location->location(), v.length() / 2, v.data());
</del><ins>+ m_context->uniform1i(location->location(), x);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size)
-{
- if (isContextLostOrPending() || !validateUniformParameters("uniform2fv", location, v, size, 2))
- return;
-
- m_context->uniform2fv(location->location(), size / 2, v);
-}
-
</del><span class="cx"> void WebGLRenderingContextBase::uniform2i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y)
</span><span class="cx"> {
</span><span class="cx"> if (isContextLostOrPending() || !location)
</span><span class="lines">@@ -4282,124 +4243,103 @@
</span><span class="cx"> m_context->uniform2i(location->location(), x, y);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, Int32Array& v)
</del><ins>+void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !validateUniformParameters("uniform2iv", location, v, 2))
</del><ins>+ if (isContextLostOrPending() || !location)
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- m_context->uniform2iv(location->location(), v.length() / 2, v.data());
-}
-
-void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size)
-{
- if (isContextLostOrPending() || !validateUniformParameters("uniform2iv", location, v, size, 2))
</del><ins>+ if (location->program() != m_currentProgram) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform3i", "location not for current program");
</ins><span class="cx"> return;
</span><ins>+ }
</ins><span class="cx">
</span><del>- m_context->uniform2iv(location->location(), size / 2, v);
</del><ins>+ m_context->uniform3i(location->location(), x, y, z);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform3f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z)
</del><ins>+void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w)
</ins><span class="cx"> {
</span><span class="cx"> if (isContextLostOrPending() || !location)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (location->program() != m_currentProgram) {
</span><del>- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform3f", "location not for current program");
</del><ins>+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform4i", "location not for current program");
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- m_context->uniform3f(location->location(), x, y, z);
</del><ins>+ m_context->uniform4i(location->location(), x, y, z, w);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location, Float32Array& v)
</del><ins>+void WebGLRenderingContextBase::uniform1fv(const WebGLUniformLocation* location, Float32List&& v)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !validateUniformParameters("uniform3fv", location, v, 3))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform1fv", location, v, 1))
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- m_context->uniform3fv(location->location(), v.length() / 3, v.data());
</del><ins>+ m_context->uniform1fv(location->location(), v.length(), v.data());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size)
</del><ins>+void WebGLRenderingContextBase::uniform2fv(const WebGLUniformLocation* location, Float32List&& v)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !validateUniformParameters("uniform3fv", location, v, size, 3))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform2fv", location, v, 2))
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- m_context->uniform3fv(location->location(), size / 3, v);
</del><ins>+ m_context->uniform2fv(location->location(), v.length() / 2, v.data());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform3i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z)
</del><ins>+void WebGLRenderingContextBase::uniform3fv(const WebGLUniformLocation* location, Float32List&& v)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !location)
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform3fv", location, v, 3))
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- if (location->program() != m_currentProgram) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform3i", "location not for current program");
- return;
- }
-
- m_context->uniform3i(location->location(), x, y, z);
</del><ins>+ m_context->uniform3fv(location->location(), v.length() / 3, v.data());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, Int32Array& v)
</del><ins>+void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location, Float32List&& v)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !validateUniformParameters("uniform3iv", location, v, 3))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform4fv", location, v, 4))
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- m_context->uniform3iv(location->location(), v.length() / 3, v.data());
</del><ins>+ m_context->uniform4fv(location->location(), v.length() / 4, v.data());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size)
</del><ins>+void WebGLRenderingContextBase::uniform1iv(const WebGLUniformLocation* location, Int32List&& v)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !validateUniformParameters("uniform3iv", location, v, size, 3))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform1iv", location, v, 1))
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- m_context->uniform3iv(location->location(), size / 3, v);
-}
</del><ins>+ auto data = v.data();
+ auto length = v.length();
</ins><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w)
-{
- if (isContextLostOrPending() || !location)
- return;
-
- if (location->program() != m_currentProgram) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform4f", "location not for current program");
- return;
</del><ins>+ if (location->type() == GraphicsContext3D::SAMPLER_2D || location->type() == GraphicsContext3D::SAMPLER_CUBE) {
+ for (auto i = 0; i < length; ++i) {
+ if (data[i] >= static_cast<int>(m_textureUnits.size())) {
+ LOG(WebGL, "Texture unit size=%zu, v[%d]=%d. Location type = %04X.", m_textureUnits.size(), i, data[i], location->type());
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "uniform1iv", "invalid texture unit");
+ return;
+ }
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- m_context->uniform4f(location->location(), x, y, z, w);
</del><ins>+ m_context->uniform1iv(location->location(), length, data);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location, Float32Array& v)
</del><ins>+void WebGLRenderingContextBase::uniform2iv(const WebGLUniformLocation* location, Int32List&& v)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !validateUniformParameters("uniform4fv", location, v, 4))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform2iv", location, v, 2))
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- m_context->uniform4fv(location->location(), v.length() / 4, v.data());
</del><ins>+ m_context->uniform2iv(location->location(), v.length() / 2, v.data());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform4fv(const WebGLUniformLocation* location, GC3Dfloat* v, GC3Dsizei size)
</del><ins>+void WebGLRenderingContextBase::uniform3iv(const WebGLUniformLocation* location, Int32List&& v)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !validateUniformParameters("uniform4fv", location, v, size, 4))
</del><ins>+ if (isContextLostOrPending() || !validateUniformParameters("uniform3iv", location, v, 3))
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- m_context->uniform4fv(location->location(), size / 4, v);
</del><ins>+ m_context->uniform3iv(location->location(), v.length() / 3, v.data());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform4i(const WebGLUniformLocation* location, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w)
</del><ins>+void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, Int32List&& v)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !location)
- return;
-
- if (location->program() != m_currentProgram) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "uniform4i", "location not for current program");
- return;
- }
-
- m_context->uniform4i(location->location(), x, y, z, w);
-}
-
-void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, Int32Array& v)
-{
</del><span class="cx"> if (isContextLostOrPending() || !validateUniformParameters("uniform4iv", location, v, 4))
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -4406,56 +4346,27 @@
</span><span class="cx"> m_context->uniform4iv(location->location(), v.length() / 4, v.data());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniform4iv(const WebGLUniformLocation* location, GC3Dint* v, GC3Dsizei size)
</del><ins>+void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32List&& v)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !validateUniformParameters("uniform4iv", location, v, size, 4))
- return;
-
- m_context->uniform4iv(location->location(), size / 4, v);
-}
-
-void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array& v)
-{
</del><span class="cx"> if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, 4))
</span><span class="cx"> return;
</span><span class="cx"> m_context->uniformMatrix2fv(location->location(), v.length() / 4, transpose, v.data());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniformMatrix2fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size)
</del><ins>+void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32List&& v)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix2fv", location, transpose, v, size, 4))
- return;
- m_context->uniformMatrix2fv(location->location(), size / 4, transpose, v);
-}
-
-void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array& v)
-{
</del><span class="cx"> if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, 9))
</span><span class="cx"> return;
</span><span class="cx"> m_context->uniformMatrix3fv(location->location(), v.length() / 9, transpose, v.data());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniformMatrix3fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size)
</del><ins>+void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32List&& v)
</ins><span class="cx"> {
</span><del>- if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix3fv", location, transpose, v, size, 9))
- return;
- m_context->uniformMatrix3fv(location->location(), size / 9, transpose, v);
-}
-
-void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array& v)
-{
</del><span class="cx"> if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, 16))
</span><span class="cx"> return;
</span><span class="cx"> m_context->uniformMatrix4fv(location->location(), v.length() / 16, transpose, v.data());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::uniformMatrix4fv(const WebGLUniformLocation* location, GC3Dboolean transpose, GC3Dfloat* v, GC3Dsizei size)
-{
- if (isContextLostOrPending() || !validateUniformMatrixParameters("uniformMatrix4fv", location, transpose, v, size, 16))
- return;
- m_context->uniformMatrix4fv(location->location(), size / 16, transpose, v);
-}
-
</del><span class="cx"> void WebGLRenderingContextBase::useProgram(WebGLProgram* program)
</span><span class="cx"> {
</span><span class="cx"> bool deleted;
</span><span class="lines">@@ -4489,59 +4400,39 @@
</span><span class="cx"> vertexAttribfImpl("vertexAttrib1f", index, 1, v0, 0.0f, 0.0f, 1.0f);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::vertexAttrib1fv(GC3Duint index, Float32Array& v)
-{
- vertexAttribfvImpl("vertexAttrib1fv", index, v, 1);
-}
-
-void WebGLRenderingContextBase::vertexAttrib1fv(GC3Duint index, GC3Dfloat* v, GC3Dsizei size)
-{
- vertexAttribfvImpl("vertexAttrib1fv", index, v, size, 1);
-}
-
</del><span class="cx"> void WebGLRenderingContextBase::vertexAttrib2f(GC3Duint index, GC3Dfloat v0, GC3Dfloat v1)
</span><span class="cx"> {
</span><span class="cx"> vertexAttribfImpl("vertexAttrib2f", index, 2, v0, v1, 0.0f, 1.0f);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::vertexAttrib2fv(GC3Duint index, Float32Array& v)
-{
- vertexAttribfvImpl("vertexAttrib2fv", index, v, 2);
-}
-
-void WebGLRenderingContextBase::vertexAttrib2fv(GC3Duint index, GC3Dfloat* v, GC3Dsizei size)
-{
- vertexAttribfvImpl("vertexAttrib2fv", index, v, size, 2);
-}
-
</del><span class="cx"> void WebGLRenderingContextBase::vertexAttrib3f(GC3Duint index, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2)
</span><span class="cx"> {
</span><span class="cx"> vertexAttribfImpl("vertexAttrib3f", index, 3, v0, v1, v2, 1.0f);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::vertexAttrib3fv(GC3Duint index, Float32Array& v)
</del><ins>+void WebGLRenderingContextBase::vertexAttrib4f(GC3Duint index, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2, GC3Dfloat v3)
</ins><span class="cx"> {
</span><del>- vertexAttribfvImpl("vertexAttrib3fv", index, v, 3);
</del><ins>+ vertexAttribfImpl("vertexAttrib4f", index, 4, v0, v1, v2, v3);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::vertexAttrib3fv(GC3Duint index, GC3Dfloat* v, GC3Dsizei size)
</del><ins>+void WebGLRenderingContextBase::vertexAttrib1fv(GC3Duint index, Float32List&& v)
</ins><span class="cx"> {
</span><del>- vertexAttribfvImpl("vertexAttrib3fv", index, v, size, 3);
</del><ins>+ vertexAttribfvImpl("vertexAttrib1fv", index, WTFMove(v), 1);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::vertexAttrib4f(GC3Duint index, GC3Dfloat v0, GC3Dfloat v1, GC3Dfloat v2, GC3Dfloat v3)
</del><ins>+void WebGLRenderingContextBase::vertexAttrib2fv(GC3Duint index, Float32List&& v)
</ins><span class="cx"> {
</span><del>- vertexAttribfImpl("vertexAttrib4f", index, 4, v0, v1, v2, v3);
</del><ins>+ vertexAttribfvImpl("vertexAttrib2fv", index, WTFMove(v), 2);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::vertexAttrib4fv(GC3Duint index, Float32Array& v)
</del><ins>+void WebGLRenderingContextBase::vertexAttrib3fv(GC3Duint index, Float32List&& v)
</ins><span class="cx"> {
</span><del>- vertexAttribfvImpl("vertexAttrib4fv", index, v, 4);
</del><ins>+ vertexAttribfvImpl("vertexAttrib3fv", index, WTFMove(v), 3);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::vertexAttrib4fv(GC3Duint index, GC3Dfloat* v, GC3Dsizei size)
</del><ins>+void WebGLRenderingContextBase::vertexAttrib4fv(GC3Duint index, Float32List&& v)
</ins><span class="cx"> {
</span><del>- vertexAttribfvImpl("vertexAttrib4fv", index, v, size, 4);
</del><ins>+ vertexAttribfvImpl("vertexAttrib4fv", index, WTFMove(v), 4);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContextBase::vertexAttribPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dboolean normalized, GC3Dsizei stride, long long offset)
</span><span class="lines">@@ -5265,12 +5156,12 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, Float32Array& v, GC3Dsizei requiredMinSize)
</del><ins>+bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const Float32List& v, GC3Dsizei requiredMinSize)
</ins><span class="cx"> {
</span><span class="cx"> return validateUniformMatrixParameters(functionName, location, false, v.data(), v.length(), requiredMinSize);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, Int32Array& v, GC3Dsizei requiredMinSize)
</del><ins>+bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const Int32List& v, GC3Dsizei requiredMinSize)
</ins><span class="cx"> {
</span><span class="cx"> return validateUniformMatrixParameters(functionName, location, false, v.data(), v.length(), requiredMinSize);
</span><span class="cx"> }
</span><span class="lines">@@ -5280,7 +5171,7 @@
</span><span class="cx"> return validateUniformMatrixParameters(functionName, location, false, v, size, requiredMinSize);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GC3Dboolean transpose, Float32Array& v, GC3Dsizei requiredMinSize)
</del><ins>+bool WebGLRenderingContextBase::validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation* location, GC3Dboolean transpose, const Float32List& v, GC3Dsizei requiredMinSize)
</ins><span class="cx"> {
</span><span class="cx"> return validateUniformMatrixParameters(functionName, location, transpose, v.data(), v.length(), requiredMinSize);
</span><span class="cx"> }
</span><span class="lines">@@ -5430,21 +5321,18 @@
</span><span class="cx"> attribValue.value[3] = v3;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::vertexAttribfvImpl(const char* functionName, GC3Duint index, Float32Array& v, GC3Dsizei expectedSize)
</del><ins>+void WebGLRenderingContextBase::vertexAttribfvImpl(const char* functionName, GC3Duint index, Float32List&& list, GC3Dsizei expectedSize)
</ins><span class="cx"> {
</span><span class="cx"> if (isContextLostOrPending())
</span><span class="cx"> return;
</span><del>- vertexAttribfvImpl(functionName, index, v.data(), v.length(), expectedSize);
-}
-
-void WebGLRenderingContextBase::vertexAttribfvImpl(const char* functionName, GC3Duint index, GC3Dfloat* v, GC3Dsizei size, GC3Dsizei expectedSize)
-{
- if (isContextLostOrPending())
- return;
- if (!v) {
</del><ins>+
+ auto data = list.data();
+ if (!data) {
</ins><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no array");
</span><span class="cx"> return;
</span><span class="cx"> }
</span><ins>+
+ int size = list.length();
</ins><span class="cx"> if (size < expectedSize) {
</span><span class="cx"> synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "invalid size");
</span><span class="cx"> return;
</span><span class="lines">@@ -5457,16 +5345,16 @@
</span><span class="cx"> if (index || isGLES2Compliant()) {
</span><span class="cx"> switch (expectedSize) {
</span><span class="cx"> case 1:
</span><del>- m_context->vertexAttrib1fv(index, v);
</del><ins>+ m_context->vertexAttrib1fv(index, data);
</ins><span class="cx"> break;
</span><span class="cx"> case 2:
</span><del>- m_context->vertexAttrib2fv(index, v);
</del><ins>+ m_context->vertexAttrib2fv(index, data);
</ins><span class="cx"> break;
</span><span class="cx"> case 3:
</span><del>- m_context->vertexAttrib3fv(index, v);
</del><ins>+ m_context->vertexAttrib3fv(index, data);
</ins><span class="cx"> break;
</span><span class="cx"> case 4:
</span><del>- m_context->vertexAttrib4fv(index, v);
</del><ins>+ m_context->vertexAttrib4fv(index, data);
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -5473,7 +5361,7 @@
</span><span class="cx"> VertexAttribValue& attribValue = m_vertexAttribValue[index];
</span><span class="cx"> attribValue.initValue();
</span><span class="cx"> for (int ii = 0; ii < expectedSize; ++ii)
</span><del>- attribValue.value[ii] = v[ii];
</del><ins>+ attribValue.value[ii] = data[ii];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGLRenderingContextBase::initVertexAttrib0()
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -31,10 +31,19 @@
</span><span class="cx"> #include "ImageBuffer.h"
</span><span class="cx"> #include "Timer.h"
</span><span class="cx"> #include "WebGLAny.h"
</span><ins>+#include "WebGLBuffer.h"
</ins><span class="cx"> #include "WebGLContextAttributes.h"
</span><ins>+#include "WebGLFramebuffer.h"
+#include "WebGLProgram.h"
+#include "WebGLRenderbuffer.h"
</ins><span class="cx"> #include "WebGLTexture.h"
</span><ins>+#include "WebGLVertexArrayObjectOES.h"
</ins><span class="cx"> #include <memory>
</span><span class="cx">
</span><ins>+#if ENABLE(WEBGL2)
+#include "WebGLVertexArrayObject.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class ANGLEInstancedArrays;
</span><span class="lines">@@ -55,7 +64,6 @@
</span><span class="cx"> class OESVertexArrayObject;
</span><span class="cx"> class OESElementIndexUint;
</span><span class="cx"> class WebGLActiveInfo;
</span><del>-class WebGLBuffer;
</del><span class="cx"> class WebGLContextGroup;
</span><span class="cx"> class WebGLContextObject;
</span><span class="cx"> class WebGLCompressedTextureATC;
</span><span class="lines">@@ -66,16 +74,12 @@
</span><span class="cx"> class WebGLDepthTexture;
</span><span class="cx"> class WebGLDrawBuffers;
</span><span class="cx"> class WebGLExtension;
</span><del>-class WebGLFramebuffer;
</del><span class="cx"> class WebGLLoseContext;
</span><span class="cx"> class WebGLObject;
</span><del>-class WebGLProgram;
-class WebGLRenderbuffer;
</del><span class="cx"> class WebGLShader;
</span><span class="cx"> class WebGLSharedObject;
</span><span class="cx"> class WebGLShaderPrecisionFormat;
</span><span class="cx"> class WebGLUniformLocation;
</span><del>-class WebGLVertexArrayObjectOES;
</del><span class="cx">
</span><span class="cx"> inline void clip1D(GC3Dint start, GC3Dsizei range, GC3Dsizei sourceRange, GC3Dint* clippedStart, GC3Dsizei* clippedRange)
</span><span class="cx"> {
</span><span class="lines">@@ -185,7 +189,7 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<WebGLActiveInfo> getActiveAttrib(WebGLProgram*, GC3Duint index);
</span><span class="cx"> RefPtr<WebGLActiveInfo> getActiveUniform(WebGLProgram*, GC3Duint index);
</span><del>- bool getAttachedShaders(WebGLProgram*, Vector<RefPtr<WebGLShader>>&);
</del><ins>+ std::optional<Vector<RefPtr<WebGLShader>>> getAttachedShaders(WebGLProgram*);
</ins><span class="cx"> GC3Dint getAttribLocation(WebGLProgram*, const String& name);
</span><span class="cx"> WebGLAny getBufferParameter(GC3Denum target, GC3Denum pname);
</span><span class="cx"> std::optional<WebGLContextAttributes> getContextAttributes();
</span><span class="lines">@@ -200,7 +204,7 @@
</span><span class="cx"> String getShaderInfoLog(WebGLShader*);
</span><span class="cx"> RefPtr<WebGLShaderPrecisionFormat> getShaderPrecisionFormat(GC3Denum shaderType, GC3Denum precisionType);
</span><span class="cx"> String getShaderSource(WebGLShader*);
</span><del>- virtual Vector<String> getSupportedExtensions() = 0;
</del><ins>+ virtual std::optional<Vector<String>> getSupportedExtensions() = 0;
</ins><span class="cx"> WebGLAny getTexParameter(GC3Denum target, GC3Denum pname);
</span><span class="cx"> WebGLAny getUniform(WebGLProgram*, const WebGLUniformLocation*);
</span><span class="cx"> RefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const String&);
</span><span class="lines">@@ -245,52 +249,76 @@
</span><span class="cx"> void texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, RefPtr<ArrayBufferView>&&);
</span><span class="cx"> ExceptionOr<void> texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, std::optional<TexImageSource>&&);
</span><span class="cx">
</span><ins>+ template <class TypedArray, class DataType>
+ class TypedList {
+ public:
+ using VariantType = Variant<RefPtr<TypedArray>, Vector<DataType>>;
+
+ TypedList(VariantType&& variant)
+ : m_variant(WTFMove(variant))
+ {
+ }
+
+ DataType* data() const
+ {
+ return WTF::switchOn(m_variant,
+ [] (const RefPtr<TypedArray>& typedArray) -> DataType* { return typedArray->data(); },
+ [] (const Vector<DataType>& vector) -> DataType* { return const_cast<Vector<DataType>&>(vector).data(); }
+ );
+ }
+
+ GC3Dsizei length() const
+ {
+ return WTF::switchOn(m_variant,
+ [] (const RefPtr<TypedArray>& typedArray) -> GC3Dsizei { return typedArray->length(); },
+ [] (const Vector<DataType>& vector) -> GC3Dsizei { return vector.size(); }
+ );
+ }
+
+ private:
+ VariantType m_variant;
+ };
+
+ using Float32List = TypedList<Float32Array, float>;
+ using Int32List = TypedList<Int32Array, int>;
+
</ins><span class="cx"> void uniform1f(const WebGLUniformLocation*, GC3Dfloat x);
</span><del>- void uniform1fv(const WebGLUniformLocation*, Float32Array& v);
- void uniform1fv(const WebGLUniformLocation*, GC3Dfloat* v, GC3Dsizei);
</del><ins>+ void uniform2f(const WebGLUniformLocation*, GC3Dfloat x, GC3Dfloat y);
+ void uniform3f(const WebGLUniformLocation*, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z);
+ void uniform4f(const WebGLUniformLocation*, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w);
+
</ins><span class="cx"> void uniform1i(const WebGLUniformLocation*, GC3Dint x);
</span><del>- void uniform1iv(const WebGLUniformLocation*, Int32Array& v);
- void uniform1iv(const WebGLUniformLocation*, GC3Dint* v, GC3Dsizei);
- void uniform2f(const WebGLUniformLocation*, GC3Dfloat x, GC3Dfloat y);
- void uniform2fv(const WebGLUniformLocation*, Float32Array& v);
- void uniform2fv(const WebGLUniformLocation*, GC3Dfloat* v, GC3Dsizei);
</del><span class="cx"> void uniform2i(const WebGLUniformLocation*, GC3Dint x, GC3Dint y);
</span><del>- void uniform2iv(const WebGLUniformLocation*, Int32Array& v);
- void uniform2iv(const WebGLUniformLocation*, GC3Dint* v, GC3Dsizei);
- void uniform3f(const WebGLUniformLocation*, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z);
- void uniform3fv(const WebGLUniformLocation*, Float32Array& v);
- void uniform3fv(const WebGLUniformLocation*, GC3Dfloat* v, GC3Dsizei);
</del><span class="cx"> void uniform3i(const WebGLUniformLocation*, GC3Dint x, GC3Dint y, GC3Dint z);
</span><del>- void uniform3iv(const WebGLUniformLocation*, Int32Array& v);
- void uniform3iv(const WebGLUniformLocation*, GC3Dint* v, GC3Dsizei);
- void uniform4f(const WebGLUniformLocation*, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w);
- void uniform4fv(const WebGLUniformLocation*, Float32Array& v);
- void uniform4fv(const WebGLUniformLocation*, GC3Dfloat* v, GC3Dsizei);
</del><span class="cx"> void uniform4i(const WebGLUniformLocation*, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w);
</span><del>- void uniform4iv(const WebGLUniformLocation*, Int32Array& v);
- void uniform4iv(const WebGLUniformLocation*, GC3Dint* v, GC3Dsizei);
- void uniformMatrix2fv(const WebGLUniformLocation*, GC3Dboolean transpose, Float32Array& value);
- void uniformMatrix2fv(const WebGLUniformLocation*, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei);
- void uniformMatrix3fv(const WebGLUniformLocation*, GC3Dboolean transpose, Float32Array& value);
- void uniformMatrix3fv(const WebGLUniformLocation*, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei);
- void uniformMatrix4fv(const WebGLUniformLocation*, GC3Dboolean transpose, Float32Array& value);
- void uniformMatrix4fv(const WebGLUniformLocation*, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei);
</del><span class="cx">
</span><ins>+ void uniform1fv(const WebGLUniformLocation*, Float32List&&);
+ void uniform2fv(const WebGLUniformLocation*, Float32List&&);
+ void uniform3fv(const WebGLUniformLocation*, Float32List&&);
+ void uniform4fv(const WebGLUniformLocation*, Float32List&&);
+
+ void uniform1iv(const WebGLUniformLocation*, Int32List&&);
+ void uniform2iv(const WebGLUniformLocation*, Int32List&&);
+ void uniform3iv(const WebGLUniformLocation*, Int32List&&);
+ void uniform4iv(const WebGLUniformLocation*, Int32List&&);
+
+ void uniformMatrix2fv(const WebGLUniformLocation*, GC3Dboolean transpose, Float32List&&);
+ void uniformMatrix3fv(const WebGLUniformLocation*, GC3Dboolean transpose, Float32List&&);
+ void uniformMatrix4fv(const WebGLUniformLocation*, GC3Dboolean transpose, Float32List&&);
+
</ins><span class="cx"> void useProgram(WebGLProgram*);
</span><span class="cx"> void validateProgram(WebGLProgram*);
</span><span class="cx">
</span><span class="cx"> void vertexAttrib1f(GC3Duint index, GC3Dfloat x);
</span><del>- void vertexAttrib1fv(GC3Duint index, Float32Array& values);
- void vertexAttrib1fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei size);
</del><span class="cx"> void vertexAttrib2f(GC3Duint index, GC3Dfloat x, GC3Dfloat y);
</span><del>- void vertexAttrib2fv(GC3Duint index, Float32Array& values);
- void vertexAttrib2fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei size);
</del><span class="cx"> void vertexAttrib3f(GC3Duint index, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z);
</span><del>- void vertexAttrib3fv(GC3Duint index, Float32Array& values);
- void vertexAttrib3fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei size);
</del><span class="cx"> void vertexAttrib4f(GC3Duint index, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w);
</span><del>- void vertexAttrib4fv(GC3Duint index, Float32Array& values);
- void vertexAttrib4fv(GC3Duint index, GC3Dfloat* values, GC3Dsizei size);
</del><ins>+
+ void vertexAttrib1fv(GC3Duint index, Float32List&&);
+ void vertexAttrib2fv(GC3Duint index, Float32List&&);
+ void vertexAttrib3fv(GC3Duint index, Float32List&&);
+ void vertexAttrib4fv(GC3Duint index, Float32List&&);
+
</ins><span class="cx"> void vertexAttribPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dboolean normalized,
</span><span class="cx"> GC3Dsizei stride, long long offset);
</span><span class="cx">
</span><span class="lines">@@ -729,10 +757,10 @@
</span><span class="cx"> virtual bool validateCapability(const char* functionName, GC3Denum) = 0;
</span><span class="cx">
</span><span class="cx"> // Helper function to validate input parameters for uniform functions.
</span><del>- bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, Float32Array&, GC3Dsizei mod);
- bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, Int32Array&, GC3Dsizei mod);
</del><ins>+ bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, const Float32List&, GC3Dsizei mod);
+ bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, const Int32List&, GC3Dsizei mod);
</ins><span class="cx"> bool validateUniformParameters(const char* functionName, const WebGLUniformLocation*, void*, GC3Dsizei, GC3Dsizei mod);
</span><del>- bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GC3Dboolean transpose, Float32Array&, GC3Dsizei mod);
</del><ins>+ bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GC3Dboolean transpose, const Float32List&, GC3Dsizei mod);
</ins><span class="cx"> bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GC3Dboolean transpose, void*, GC3Dsizei, GC3Dsizei mod);
</span><span class="cx">
</span><span class="cx"> // Helper function to validate parameters for bufferData.
</span><span class="lines">@@ -748,8 +776,7 @@
</span><span class="cx">
</span><span class="cx"> // Helper functions for vertexAttribNf{v}.
</span><span class="cx"> void vertexAttribfImpl(const char* functionName, GC3Duint index, GC3Dsizei expectedSize, GC3Dfloat, GC3Dfloat, GC3Dfloat, GC3Dfloat);
</span><del>- void vertexAttribfvImpl(const char* functionName, GC3Duint index, Float32Array&, GC3Dsizei expectedSize);
- void vertexAttribfvImpl(const char* functionName, GC3Duint index, GC3Dfloat*, GC3Dsizei, GC3Dsizei expectedSize);
</del><ins>+ void vertexAttribfvImpl(const char* functionName, GC3Duint index, Float32List&&, GC3Dsizei expectedSize);
</ins><span class="cx">
</span><span class="cx"> // Helper function for delete* (deleteBuffer, deleteProgram, etc) functions.
</span><span class="cx"> // Return false if caller should return without further processing.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl (210566 => 210567)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl        2017-01-10 23:45:22 UTC (rev 210566)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.idl        2017-01-11 01:02:34 UTC (rev 210567)
</span><span class="lines">@@ -38,6 +38,8 @@
</span><span class="cx"> typedef unrestricted float GLfloat;
</span><span class="cx"> typedef unrestricted float GLclampf;
</span><span class="cx"> typedef (ArrayBuffer or ArrayBufferView) BufferDataSource;
</span><ins>+typedef (Float32Array or sequence<GLfloat>) Float32List;
+typedef (Int32Array or sequence<GLint>) Int32List;
</ins><span class="cx">
</span><span class="cx"> // FIXME: Should allow ImageBitmap too.
</span><span class="cx"> typedef (ImageData or HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) TexImageSource;
</span><span class="lines">@@ -545,25 +547,26 @@
</span><span class="cx"> WebGLActiveInfo getActiveAttrib(WebGLProgram? program, GLuint index);
</span><span class="cx"> WebGLActiveInfo getActiveUniform(WebGLProgram? program, GLuint index);
</span><span class="cx">
</span><del>- [Custom] void getAttachedShaders(WebGLProgram? program);
</del><ins>+ // FIXME: The spec says this should not take a nullable WebGLProgram.
+ sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program);
</ins><span class="cx">
</span><span class="cx"> GLint getAttribLocation(WebGLProgram? program, DOMString name);
</span><span class="cx">
</span><del>- [Custom] any getBufferParameter(GLenum target, GLenum pname);
</del><ins>+ [OverrideIDLType=IDLWebGLAny] any getBufferParameter(GLenum target, GLenum pname);
</ins><span class="cx">
</span><span class="cx"> WebGLContextAttributes? getContextAttributes();
</span><span class="cx">
</span><span class="cx"> GLenum getError();
</span><span class="cx">
</span><del>- // object getExtension(DOMString name);
- [Custom] any getExtension(DOMString name);
</del><ins>+ sequence<DOMString>? getSupportedExtensions();
+ [Custom] object? getExtension(DOMString name);
</ins><span class="cx">
</span><del>- [Custom] any getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname);
- [Custom] any getParameter(GLenum pname);
- [Custom] any getProgramParameter(WebGLProgram? program, GLenum pname);
</del><ins>+ [OverrideIDLType=IDLWebGLAny] any getFramebufferAttachmentParameter(GLenum target, GLenum attachment, GLenum pname);
+ [OverrideIDLType=IDLWebGLAny] any getParameter(GLenum pname);
+ [OverrideIDLType=IDLWebGLAny] any getProgramParameter(WebGLProgram? program, GLenum pname);
</ins><span class="cx"> DOMString? getProgramInfoLog(WebGLProgram? program);
</span><del>- [Custom] any getRenderbufferParameter(GLenum target, GLenum pname);
- [Custom] any getShaderParameter(WebGLShader? shader, GLenum pname);
</del><ins>+ [OverrideIDLType=IDLWebGLAny] any getRenderbufferParameter(GLenum target, GLenum pname);
+ [OverrideIDLType=IDLWebGLAny] any getShaderParameter(WebGLShader? shader, GLenum pname);
</ins><span class="cx">
</span><span class="cx"> DOMString? getShaderInfoLog(WebGLShader? shader);
</span><span class="cx">
</span><span class="lines">@@ -571,15 +574,13 @@
</span><span class="cx">
</span><span class="cx"> DOMString? getShaderSource(WebGLShader? shader);
</span><span class="cx">
</span><del>- [Custom] sequence<DOMString> getSupportedExtensions();
</del><ins>+ [OverrideIDLType=IDLWebGLAny] any getTexParameter(GLenum target, GLenum pname);
</ins><span class="cx">
</span><del>- [Custom] any getTexParameter(GLenum target, GLenum pname);
</del><ins>+ [OverrideIDLType=IDLWebGLAny] any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
</ins><span class="cx">
</span><del>- [Custom] any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
-
</del><span class="cx"> WebGLUniformLocation getUniformLocation(WebGLProgram? program, DOMString name);
</span><span class="cx">
</span><del>- [Custom] any getVertexAttrib(GLuint index, GLenum pname);
</del><ins>+ [OverrideIDLType=IDLWebGLAny] any getVertexAttrib(GLuint index, GLenum pname);
</ins><span class="cx">
</span><span class="cx"> GLsizeiptr getVertexAttribOffset(GLuint index, GLenum pname);
</span><span class="cx">
</span><span class="lines">@@ -622,37 +623,42 @@
</span><span class="cx"> [MayThrowException] void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, TexImageSource? source);
</span><span class="cx">
</span><span class="cx"> void uniform1f(WebGLUniformLocation? location, GLfloat x);
</span><del>- [Custom] void uniform1fv(WebGLUniformLocation? location, Float32Array v);
</del><ins>+ void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
+ void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
+ void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+
</ins><span class="cx"> void uniform1i(WebGLUniformLocation? location, GLint x);
</span><del>- [Custom] void uniform1iv(WebGLUniformLocation? location, Int32Array v);
- void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
- [Custom] void uniform2fv(WebGLUniformLocation? location, Float32Array v);
</del><span class="cx"> void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
</span><del>- [Custom] void uniform2iv(WebGLUniformLocation? location, Int32Array v);
- void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
- [Custom] void uniform3fv(WebGLUniformLocation? location, Float32Array v);
</del><span class="cx"> void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
</span><del>- [Custom] void uniform3iv(WebGLUniformLocation? location, Int32Array v);
- void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- [Custom] void uniform4fv(WebGLUniformLocation? location, Float32Array v);
</del><span class="cx"> void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
</span><del>- [Custom] void uniform4iv(WebGLUniformLocation? location, Int32Array v);
</del><span class="cx">
</span><del>- [Custom] void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array array);
- [Custom] void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array array);
- [Custom] void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array array);
</del><ins>+ void uniform1fv(WebGLUniformLocation? location, Float32List v);
+ void uniform2fv(WebGLUniformLocation? location, Float32List v);
+ void uniform3fv(WebGLUniformLocation? location, Float32List v);
+ void uniform4fv(WebGLUniformLocation? location, Float32List v);
</ins><span class="cx">
</span><ins>+ void uniform1iv(WebGLUniformLocation? location, Int32List v);
+ void uniform2iv(WebGLUniformLocation? location, Int32List v);
+ void uniform3iv(WebGLUniformLocation? location, Int32List v);
+ void uniform4iv(WebGLUniformLocation? location, Int32List v);
+
+ void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List array);
+ void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List array);
+ void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List array);
+
</ins><span class="cx"> void useProgram(WebGLProgram? program);
</span><span class="cx"> void validateProgram(WebGLProgram? program);
</span><span class="cx">
</span><del>- void vertexAttrib1f(GLuint indx, GLfloat x);
- [Custom] void vertexAttrib1fv(GLuint indx, Float32Array values);
- void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
- [Custom] void vertexAttrib2fv(GLuint indx, Float32Array values);
- void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
- [Custom] void vertexAttrib3fv(GLuint indx, Float32Array values);
- void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- [Custom] void vertexAttrib4fv(GLuint indx, Float32Array values);
</del><ins>+ void vertexAttrib1f(GLuint index, GLfloat x);
+ void vertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
+ void vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
+ void vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+
+ void vertexAttrib1fv(GLuint index, Float32List values);
+ void vertexAttrib2fv(GLuint index, Float32List values);
+ void vertexAttrib3fv(GLuint index, Float32List values);
+ void vertexAttrib4fv(GLuint index, Float32List values);
+
</ins><span class="cx"> void vertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);
</span><span class="cx">
</span><span class="cx"> void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
</span></span></pre>
</div>
</div>
</body>
</html>