Title: [200246] trunk
Revision
200246
Author
[email protected]
Date
2016-04-29 09:51:58 -0700 (Fri, 29 Apr 2016)

Log Message

[Web IDL] Specify default values for optional parameters of wrapper types
https://bugs.webkit.org/show_bug.cgi?id=157161

Reviewed by Darin Adler.

Source/WebCore:

Specify default values for optional parameters of wrapper types.

* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::count): Deleted.
* Modules/indexeddb/IDBIndex.h:
* Modules/indexeddb/IDBIndex.idl:
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::count): Deleted.
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBObjectStore.idl:
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::createDataChannel): Deleted.
* Modules/mediastream/RTCPeerConnection.h:
* Modules/mediastream/RTCPeerConnection.idl:

* bindings/scripts/CodeGeneratorJS.pm:
(WillConvertUndefinedToDefaultParameterValue):
Optimization to avoid generating a ternary if the default
value of a wrapper type parameter is null, since undefined
will already convert to null for those.

(GenerateParametersCheck):
Use null as implicit default value for nullable parameters, given that Web IDL
converts undefined to null for such parameters:
http://heycam.github.io/webidl/#es-nullable-type

(CanUseWTFOptionalForParameter):
Drop the check for wrapper types.

* bindings/scripts/test/*:
Improve bindings tests coverage / rebaseline.

* css/MediaQueryList.idl:
* css/MediaQueryListListener.idl:
* dom/Document.idl:

* html/canvas/DOMPath.idl:
The previous syntax was working because the bindings was generating an early
return if addPath() was called with only one parameter, calling the
implementation method with only 1 parameter. However, since we no longer
generate early returns for optional parameters, we now have to use a slightly
different syntax to maintain the previous behavior. This is only temporary,
I just did not want to deal with SVG tear off types in this patch since they
are very special in the bindings generator.

* page/DOMSelection.idl:
The node parameter to extend() was confusingly marked as optional. However,
when omitted, it would get translated into null, which would throw an
exception since the type is not nullable. Since the specification says 'node'
should not be optional, and since there is no behavior change, I dropped
the 'optional'. The only web-exposed difference is the message provided with
the TypeError that is thrown when called without enough parameters. The new
message is more accurate (see rebaselined layout test).

* svg/SVGMarkerElement.idl:
The parameter for setOrientToAngle() was confusingly marked as optional and
having a default value of null. However, the bindings would throw a TypeError
if called with no parameters or when calling it with null. This is because
this is an SVG Tear off type and the bindings always throw when passing null
for an SVG Tear off type. I therefore updated the IDL to reflect the actual
behavior (no actual behavior change). The new IDL also now matches the spec:
http://www.w3.org/TR/SVG2/painting.html#InterfaceSVGMarkerElement

* svg/SVGSVGElement.idl:
Same comments as for SVGMarkerElement. The new IDL matches the actual
behavior and is closer to the specification. I added FIXME comments for when
it does not match the specification:
http://www.w3.org/TR/SVG2/struct.html#InterfaceSVGSVGElement
I did not change web-exposed behavior in this patch.

* svg/SVGTextContentElement.idl:
Same as above. No actual behavior change.

* testing/Internals.cpp:
* testing/Internals.h:
* testing/Internals.idl:
* xml/XPathEvaluator.idl:

LayoutTests:

Rebaseline as a different exception message is now given when calling
Selection.extend() without enough parameters.

* editing/selection/extend-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (200245 => 200246)


--- trunk/LayoutTests/ChangeLog	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/LayoutTests/ChangeLog	2016-04-29 16:51:58 UTC (rev 200246)
@@ -1,3 +1,15 @@
+2016-04-29  Chris Dumez  <[email protected]>
+
+        [Web IDL] Specify default values for optional parameters of wrapper types
+        https://bugs.webkit.org/show_bug.cgi?id=157161
+
+        Reviewed by Darin Adler.
+
+        Rebaseline as a different exception message is now given when calling
+        Selection.extend() without enough parameters.
+
+        * editing/selection/extend-expected.txt:
+
 2016-04-29  Joanmarie Diggs  <[email protected]>
 
         [ATK] Expose the value of aria-roledescription via an AtkObject attribute

Modified: trunk/LayoutTests/editing/selection/extend-expected.txt (200245 => 200246)


--- trunk/LayoutTests/editing/selection/extend-expected.txt	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/LayoutTests/editing/selection/extend-expected.txt	2016-04-29 16:51:58 UTC (rev 200246)
@@ -4,5 +4,5 @@
 Success: s.extend(span2.firstChild, -1) raised Error: IndexSizeError: DOM Exception 1.
 Success: window.getSelection() is b.
 Success: window.getSelection() is arbaz.
-Success: s.extend() raised TypeError: Type error.
+Success: s.extend() raised TypeError: Not enough arguments.
 Success: s.extend(null, 0) raised TypeError: Type error.

Modified: trunk/Source/WebCore/ChangeLog (200245 => 200246)


--- trunk/Source/WebCore/ChangeLog	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/ChangeLog	2016-04-29 16:51:58 UTC (rev 200246)
@@ -1,3 +1,88 @@
+2016-04-29  Chris Dumez  <[email protected]>
+
+        [Web IDL] Specify default values for optional parameters of wrapper types
+        https://bugs.webkit.org/show_bug.cgi?id=157161
+
+        Reviewed by Darin Adler.
+
+        Specify default values for optional parameters of wrapper types.
+
+        * Modules/indexeddb/IDBIndex.cpp:
+        (WebCore::IDBIndex::count): Deleted.
+        * Modules/indexeddb/IDBIndex.h:
+        * Modules/indexeddb/IDBIndex.idl:
+        * Modules/indexeddb/IDBObjectStore.cpp:
+        (WebCore::IDBObjectStore::count): Deleted.
+        * Modules/indexeddb/IDBObjectStore.h:
+        * Modules/indexeddb/IDBObjectStore.idl:
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        (WebCore::RTCPeerConnection::createDataChannel): Deleted.
+        * Modules/mediastream/RTCPeerConnection.h:
+        * Modules/mediastream/RTCPeerConnection.idl:
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (WillConvertUndefinedToDefaultParameterValue):
+        Optimization to avoid generating a ternary if the default
+        value of a wrapper type parameter is null, since undefined
+        will already convert to null for those.
+
+        (GenerateParametersCheck):
+        Use null as implicit default value for nullable parameters, given that Web IDL
+        converts undefined to null for such parameters:
+        http://heycam.github.io/webidl/#es-nullable-type
+
+        (CanUseWTFOptionalForParameter):
+        Drop the check for wrapper types.
+
+        * bindings/scripts/test/*:
+        Improve bindings tests coverage / rebaseline.
+
+        * css/MediaQueryList.idl:
+        * css/MediaQueryListListener.idl:
+        * dom/Document.idl:
+
+        * html/canvas/DOMPath.idl:
+        The previous syntax was working because the bindings was generating an early
+        return if addPath() was called with only one parameter, calling the
+        implementation method with only 1 parameter. However, since we no longer
+        generate early returns for optional parameters, we now have to use a slightly
+        different syntax to maintain the previous behavior. This is only temporary,
+        I just did not want to deal with SVG tear off types in this patch since they
+        are very special in the bindings generator.
+
+        * page/DOMSelection.idl:
+        The node parameter to extend() was confusingly marked as optional. However,
+        when omitted, it would get translated into null, which would throw an
+        exception since the type is not nullable. Since the specification says 'node'
+        should not be optional, and since there is no behavior change, I dropped
+        the 'optional'. The only web-exposed difference is the message provided with
+        the TypeError that is thrown when called without enough parameters. The new
+        message is more accurate (see rebaselined layout test).
+
+        * svg/SVGMarkerElement.idl:
+        The parameter for setOrientToAngle() was confusingly marked as optional and
+        having a default value of null. However, the bindings would throw a TypeError
+        if called with no parameters or when calling it with null. This is because
+        this is an SVG Tear off type and the bindings always throw when passing null
+        for an SVG Tear off type. I therefore updated the IDL to reflect the actual
+        behavior (no actual behavior change). The new IDL also now matches the spec:
+        http://www.w3.org/TR/SVG2/painting.html#InterfaceSVGMarkerElement
+
+        * svg/SVGSVGElement.idl:
+        Same comments as for SVGMarkerElement. The new IDL matches the actual
+        behavior and is closer to the specification. I added FIXME comments for when
+        it does not match the specification:
+        http://www.w3.org/TR/SVG2/struct.html#InterfaceSVGSVGElement
+        I did not change web-exposed behavior in this patch.
+
+        * svg/SVGTextContentElement.idl:
+        Same as above. No actual behavior change.
+
+        * testing/Internals.cpp:
+        * testing/Internals.h:
+        * testing/Internals.idl:
+        * xml/XPathEvaluator.idl:
+
 2016-04-29  Joanmarie Diggs  <[email protected]>
 
         [ATK] Expose the value of aria-roledescription via an AtkObject attribute

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp (200245 => 200246)


--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp	2016-04-29 16:51:58 UTC (rev 200246)
@@ -137,13 +137,6 @@
     return openCursor(context, keyRange.get(), direction, ec);
 }
 
-RefPtr<IDBRequest> IDBIndex::count(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec)
-{
-    LOG(IndexedDB, "IDBIndex::count");
-
-    return doCount(context, IDBKeyRangeData::allKeys(), ec);
-}
-
 RefPtr<IDBRequest> IDBIndex::count(ScriptExecutionContext& context, IDBKeyRange* range, ExceptionCodeWithMessage& ec)
 {
     LOG(IndexedDB, "IDBIndex::count");

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h (200245 => 200246)


--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h	2016-04-29 16:51:58 UTC (rev 200246)
@@ -52,7 +52,6 @@
     RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, IDBKeyRange*, const String& direction, ExceptionCodeWithMessage&);
     RefPtr<IDBRequest> openCursor(ScriptExecutionContext&, JSC::JSValue key, const String& direction, ExceptionCodeWithMessage&);
 
-    RefPtr<IDBRequest> count(ScriptExecutionContext&, ExceptionCodeWithMessage&);
     RefPtr<IDBRequest> count(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&);
     RefPtr<IDBRequest> count(ScriptExecutionContext&, JSC::JSValue key, ExceptionCodeWithMessage&);
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl (200245 => 200246)


--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -46,7 +46,7 @@
     [CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBRequest get(any key);
     [CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBRequest getKey(IDBKeyRange? key);
     [CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBRequest getKey(any key);
-    [CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBRequest count(optional IDBKeyRange? range);
+    [CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBRequest count(optional IDBKeyRange? range = null);
     [CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBRequest count(any key);
 };
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (200245 => 200246)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2016-04-29 16:51:58 UTC (rev 200246)
@@ -562,13 +562,6 @@
     m_transaction->deleteIndex(m_info.identifier(), name);
 }
 
-RefPtr<IDBRequest> IDBObjectStore::count(ScriptExecutionContext& context, ExceptionCodeWithMessage& ec)
-{
-    LOG(IndexedDB, "IDBObjectStore::count");
-
-    return doCount(context, IDBKeyRangeData::allKeys(), ec);
-}
-
 RefPtr<IDBRequest> IDBObjectStore::count(ScriptExecutionContext& context, JSValue key, ExceptionCodeWithMessage& ec)
 {
     LOG(IndexedDB, "IDBObjectStore::count");

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (200245 => 200246)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2016-04-29 16:51:58 UTC (rev 200246)
@@ -74,7 +74,6 @@
     RefPtr<IDBIndex> createIndex(ScriptExecutionContext&, const String& name, const IDBKeyPath&, bool unique, bool multiEntry, ExceptionCodeWithMessage&);
     RefPtr<IDBIndex> index(const String& name, ExceptionCodeWithMessage&);
     void deleteIndex(const String& name, ExceptionCodeWithMessage&);
-    RefPtr<IDBRequest> count(ScriptExecutionContext&, ExceptionCodeWithMessage&);
     RefPtr<IDBRequest> count(ScriptExecutionContext&, IDBKeyRange*, ExceptionCodeWithMessage&);
     RefPtr<IDBRequest> count(ScriptExecutionContext&, JSC::JSValue key, ExceptionCodeWithMessage&);
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl (200245 => 200246)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -49,6 +49,6 @@
     [CallWith=ScriptExecutionContext, Custom, RaisesExceptionWithMessage] IDBIndex createIndex(DOMString name, DOMString keyPath, optional Dictionary options);
     [RaisesExceptionWithMessage] IDBIndex index(DOMString name);
     [RaisesExceptionWithMessage] void deleteIndex(DOMString name);
-    [CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBRequest count(optional IDBKeyRange? range);
+    [CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBRequest count(optional IDBKeyRange? range = null);
     [CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBRequest count(any key);
 };

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (200245 => 200246)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp	2016-04-29 16:51:58 UTC (rev 200246)
@@ -328,16 +328,11 @@
     m_backend->setConfiguration(*m_configuration);
 }
 
-void RTCPeerConnection::privateGetStats(MediaStreamTrack& selector, PeerConnection::StatsPromise&& promise)
+void RTCPeerConnection::privateGetStats(MediaStreamTrack* selector, PeerConnection::StatsPromise&& promise)
 {
-    m_backend->getStats(&selector, WTFMove(promise));
+    m_backend->getStats(selector, WTFMove(promise));
 }
 
-void RTCPeerConnection::privateGetStats(PeerConnection::StatsPromise&& promise)
-{
-    m_backend->getStats(nullptr, WTFMove(promise));
-}
-
 RefPtr<RTCDataChannel> RTCPeerConnection::createDataChannel(String, const Dictionary&, ExceptionCode& ec)
 {
     if (m_signalingState == SignalingState::Closed) {

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h (200245 => 200246)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.h	2016-04-29 16:51:58 UTC (rev 200246)
@@ -93,8 +93,7 @@
     RTCConfiguration* getConfiguration() const;
     void setConfiguration(const Dictionary& configuration, ExceptionCode&);
 
-    void privateGetStats(MediaStreamTrack&, PeerConnection::StatsPromise&&);
-    void privateGetStats(PeerConnection::StatsPromise&&);
+    void privateGetStats(MediaStreamTrack*, PeerConnection::StatsPromise&&);
 
     RefPtr<RTCDataChannel> createDataChannel(String label, const Dictionary& dataChannelDict, ExceptionCode&);
 

Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl (200245 => 200246)


--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -46,7 +46,7 @@
     [Private] Promise queuedSetRemoteDescription(RTCSessionDescription description);
     [Private] Promise queuedAddIceCandidate(RTCIceCandidate candidate);
 
-    [Private] Promise privateGetStats(optional MediaStreamTrack selector);
+    [Private] Promise privateGetStats(optional MediaStreamTrack? selector = null);
 
     [JSBuiltin] Promise createOffer(optional Dictionary offerOptions);
     // Legacy signature: void createOffer(RTCSessionDescriptionCallback successCallback

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200245 => 200246)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-04-29 16:51:58 UTC (rev 200246)
@@ -3380,7 +3380,6 @@
     return 0 if $parameter->isVariadic;
     return 0 if $codeGenerator->IsCallbackInterface($type);
     return 0 if $codeGenerator->IsEnumType($type);
-    return 0 if $codeGenerator->IsWrapperType($type);
 
     return 1;
 }
@@ -3420,6 +3419,8 @@
         return 1 if $parameterType eq "float" or $parameterType eq "unrestricted float";
     }
 
+    return 1 if $codeGenerator->IsWrapperType($parameterType) and $defaultValue eq "null";
+
     return 0;
 }
 
@@ -3469,15 +3470,23 @@
         my $argType = $parameter->type;
         my $optional = $parameter->isOptional;
 
-        # As per Web IDL, optional dictionary parameters are always considered to have a default value of an empty dictionary, unless otherwise specified.
-        $parameter->default("[]") if ($optional && !defined($parameter->default) && $argType eq "Dictionary");
+        die "Optional parameters of non-nullable wrapper types are not supported" if $optional && !$parameter->isNullable && $codeGenerator->IsWrapperType($argType) && !$codeGenerator->IsCallbackInterface($argType);
 
-        # We use the null string as default value for non-nullable parameters of type DOMString unless specified otherwise.
-        $parameter->default("null") if ($optional && !defined($parameter->default) && $argType eq "DOMString" && !$parameter->isNullable);
+        if ($optional && !defined($parameter->default)) {
+            # As per Web IDL, optional dictionary parameters are always considered to have a default value of an empty dictionary, unless otherwise specified.
+            $parameter->default("[]") if $argType eq "Dictionary";
+            
+            # We use undefined as default value for optional parameters of type 'any' unless specified otherwise.
+            $parameter->default("undefined") if $argType eq "any";
 
-        # We use undefined as default value for optional parameters of type 'any' unless specified otherwise.
-        $parameter->default("undefined") if ($optional && !defined($parameter->default) && $argType eq "any");
+            # We use the null string as default value for parameters of type DOMString unless specified otherwise.
+            $parameter->default("null") if $argType eq "DOMString";
 
+            # As per Web IDL, passing undefined for a nullable parameter is treated as null. Therefore, use null as
+            # default value for nullable parameters unless otherwise specified.
+            $parameter->default("null") if $parameter->isNullable;
+        }
+
         # FIXME: We should eventually stop generating any early calls, and instead use either default parameter values or WTF::Optional<>.
         if ($optional && !defined($parameter->default) && !CanUseWTFOptionalForParameter($parameter) && !$codeGenerator->IsCallbackInterface($argType)) {
             # Generate early call if there are enough parameters.

Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (200245 => 200246)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2016-04-29 16:51:58 UTC (rev 200246)
@@ -1770,6 +1770,26 @@
     item->methodWithOptionalAny(convertedA);
 }
 
+void webkit_dom_test_obj_method_with_optional_nullable_wrapper(WebKitDOMTestObj* self, WebKitDOMTestObj* obj)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(obj));
+    WebCore::TestObj* item = WebKit::core(self);
+    WebCore::TestObj* convertedObj = WebKit::core(obj);
+    item->methodWithOptionalNullableWrapper(convertedObj);
+}
+
+void webkit_dom_test_obj_method_with_optional_nullable_wrapper_is_null(WebKitDOMTestObj* self, WebKitDOMTestObj* obj)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(obj));
+    WebCore::TestObj* item = WebKit::core(self);
+    WebCore::TestObj* convertedObj = WebKit::core(obj);
+    item->methodWithOptionalNullableWrapperIsNull(convertedObj);
+}
+
 gchar* webkit_dom_test_obj_conditional_method1(WebKitDOMTestObj* self)
 {
 #if ENABLE(Condition1)

Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (200245 => 200246)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2016-04-29 16:51:58 UTC (rev 200246)
@@ -709,6 +709,26 @@
 webkit_dom_test_obj_method_with_optional_any(WebKitDOMTestObj* self, WebKitDOMany* a);
 
 /**
+ * webkit_dom_test_obj_method_with_optional_nullable_wrapper:
+ * @self: A #WebKitDOMTestObj
+ * @obj: A #WebKitDOMTestObj
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_nullable_wrapper(WebKitDOMTestObj* self, WebKitDOMTestObj* obj);
+
+/**
+ * webkit_dom_test_obj_method_with_optional_nullable_wrapper_is_null:
+ * @self: A #WebKitDOMTestObj
+ * @obj: A #WebKitDOMTestObj
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_nullable_wrapper_is_null(WebKitDOMTestObj* self, WebKitDOMTestObj* obj);
+
+/**
  * webkit_dom_test_obj_conditional_method1:
  * @self: A #WebKitDOMTestObj
  *

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200245 => 200246)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-04-29 16:51:58 UTC (rev 200246)
@@ -158,6 +158,8 @@
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalBoolean(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAny(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapper(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNull(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(JSC::ExecState*);
@@ -734,6 +736,8 @@
     { "methodWithOptionalBoolean", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalBoolean), (intptr_t) (0) } },
     { "methodWithOptionalBooleanIsFalse", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse), (intptr_t) (0) } },
     { "methodWithOptionalAny", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalAny), (intptr_t) (0) } },
+    { "methodWithOptionalNullableWrapper", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapper), (intptr_t) (0) } },
+    { "methodWithOptionalNullableWrapperIsNull", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNull), (intptr_t) (0) } },
     { "methodWithCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackArg), (intptr_t) (1) } },
     { "methodWithNonCallbackArgAndCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg), (intptr_t) (2) } },
     { "methodWithCallbackAndOptionalArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg), (intptr_t) (0) } },
@@ -4443,6 +4447,36 @@
     return JSValue::encode(jsUndefined());
 }
 
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapper(ExecState* state)
+{
+    JSValue thisValue = state->thisValue();
+    auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, "TestObj", "methodWithOptionalNullableWrapper");
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto& impl = castedThis->wrapped();
+    TestObj* obj = JSTestObj::toWrapped(state->argument(0));
+    if (UNLIKELY(state->hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.methodWithOptionalNullableWrapper(obj);
+    return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNull(ExecState* state)
+{
+    JSValue thisValue = state->thisValue();
+    auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, "TestObj", "methodWithOptionalNullableWrapperIsNull");
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto& impl = castedThis->wrapped();
+    TestObj* obj = JSTestObj::toWrapped(state->argument(0));
+    if (UNLIKELY(state->hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.methodWithOptionalNullableWrapperIsNull(obj);
+    return JSValue::encode(jsUndefined());
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(ExecState* state)
 {
     JSValue thisValue = state->thisValue();
@@ -4881,13 +4915,6 @@
     TestObj* objArg1 = JSTestObj::toWrapped(state->argument(0));
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
-
-    size_t argsCount = state->argumentCount();
-    if (argsCount <= 1) {
-        impl.overloadedMethodWithOptionalParameter(objArg1);
-        return JSValue::encode(jsUndefined());
-    }
-
     TestObj* objArg2 = JSTestObj::toWrapped(state->argument(1));
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());

Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (200245 => 200246)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2016-04-29 16:51:58 UTC (rev 200246)
@@ -194,6 +194,8 @@
 - (void)methodWithOptionalBoolean:(BOOL)b;
 - (void)methodWithOptionalBooleanIsFalse:(BOOL)b;
 - (void)methodWithOptionalAny:(DOMany *)a;
+- (void)methodWithOptionalNullableWrapper:(DOMTestObj *)obj;
+- (void)methodWithOptionalNullableWrapperIsNull:(DOMTestObj *)obj;
 - (void)classMethod;
 - (int)classMethodWithOptional:(int)arg;
 - (void)classMethod2:(int)arg;

Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (200245 => 200246)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm	2016-04-29 16:51:58 UTC (rev 200246)
@@ -1388,7 +1388,19 @@
     IMPL->methodWithOptionalAny(core(a));
 }
 
+- (void)methodWithOptionalNullableWrapper:(DOMTestObj *)obj
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL->methodWithOptionalNullableWrapper(core(obj));
+}
 
+- (void)methodWithOptionalNullableWrapperIsNull:(DOMTestObj *)obj
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL->methodWithOptionalNullableWrapperIsNull(core(obj));
+}
+
+
 #if ENABLE(Condition1)
 - (NSString *)conditionalMethod1
 {

Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (200245 => 200246)


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -201,6 +201,8 @@
     void    methodWithOptionalBoolean(optional boolean b);
     void    methodWithOptionalBooleanIsFalse(optional boolean b = false);
     void    methodWithOptionalAny(optional any a);
+    void    methodWithOptionalNullableWrapper(optional TestObj? obj);
+    void    methodWithOptionalNullableWrapperIsNull(optional TestObj? obj = null);
 
 #if defined(TESTING_JS)
     // Callback interface parameters.
@@ -258,7 +260,7 @@
     // FIXME: Implement support for overloaded functions with variadic arguments.
     void    overloadedMethod(Blob... blobArgs);
 
-    void overloadedMethodWithOptionalParameter(TestObj? objArg1, optional TestObj? objArg2);
+    void overloadedMethodWithOptionalParameter(TestObj? objArg1, optional TestObj? objArg2 = null);
     void overloadedMethodWithOptionalParameter(TestObj? objArg, optional long longArg);
 #endif
 

Modified: trunk/Source/WebCore/css/MediaQueryList.idl (200245 => 200246)


--- trunk/Source/WebCore/css/MediaQueryList.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/css/MediaQueryList.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -22,6 +22,8 @@
 ] interface MediaQueryList {
     readonly attribute DOMString media;
     readonly attribute boolean matches;
-    void addListener(optional MediaQueryListListener listener);
-    void removeListener(optional MediaQueryListListener listener);
+
+    // FIXME: The listener parameter should not be optional.
+    void addListener(optional MediaQueryListListener? listener = null);
+    void removeListener(optional MediaQueryListListener? listener = null);
 };

Modified: trunk/Source/WebCore/css/MediaQueryListListener.idl (200245 => 200246)


--- trunk/Source/WebCore/css/MediaQueryListListener.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/css/MediaQueryListListener.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -21,5 +21,5 @@
     CallbackNeedsOperatorEqual,
     Callback=FunctionOnly,
 ] callback interface MediaQueryListListener {
-    boolean queryChanged(optional MediaQueryList list = null);
+    boolean queryChanged(optional MediaQueryList? list = null);
 };

Modified: trunk/Source/WebCore/dom/Document.idl (200245 => 200246)


--- trunk/Source/WebCore/dom/Document.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/dom/Document.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -118,10 +118,10 @@
 #else
     [NewObject] NodeIterator createNodeIterator(Node root,
         optional unsigned long whatToShow = 0xFFFFFFFF,
-        optional NodeFilter? filter);
+        optional NodeFilter? filter = null);
     [NewObject] TreeWalker createTreeWalker(Node root,
         optional unsigned long whatToShow = 0xFFFFFFFF,
-        optional NodeFilter? filter);
+        optional NodeFilter? filter = null);
 #endif
 
     // DOM Level 2 Abstract Views (DocumentView interface)

Modified: trunk/Source/WebCore/html/canvas/DOMPath.idl (200245 => 200246)


--- trunk/Source/WebCore/html/canvas/DOMPath.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/html/canvas/DOMPath.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -33,8 +33,10 @@
     ExportMacro=WEBCORE_EXPORT,
     InterfaceName=Path2D,
 ] interface DOMPath {
-    // FIXME: The parameters should not be nullable.
-    [Conditional=CANVAS_PATH] void addPath(DOMPath? path, optional SVGMatrix? transform);
+    // FIXME: This should be:
+    // [Conditional=CANVAS_PATH] void addPath(DOMPath path, optional SVGMatrix transform);
+    [Conditional=CANVAS_PATH] void addPath(DOMPath? path);
+    [Conditional=CANVAS_PATH] void addPath(DOMPath? path, SVGMatrix transform);
 
     // FIXME: These methods should be shared with CanvasRenderingContext2D in the CanvasPathMethods interface.
     void closePath();

Modified: trunk/Source/WebCore/page/DOMSelection.idl (200245 => 200246)


--- trunk/Source/WebCore/page/DOMSelection.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/page/DOMSelection.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -49,7 +49,7 @@
     boolean containsNode(optional Node? node = null, optional boolean allowPartial = false);
     [RaisesException] void selectAllChildren(optional Node? node = null);
 
-    [RaisesException] void extend(optional Node node = null, optional long offset = 0);
+    [RaisesException] void extend(Node node, optional long offset = 0);
 
     [RaisesException] Range getRangeAt(optional long index = 0);
     void removeAllRanges();

Modified: trunk/Source/WebCore/svg/SVGMarkerElement.idl (200245 => 200246)


--- trunk/Source/WebCore/svg/SVGMarkerElement.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/svg/SVGMarkerElement.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -43,7 +43,7 @@
     readonly attribute SVGAnimatedAngle       orientAngle;
 
     void setOrientToAuto();
-    void setOrientToAngle(optional SVGAngle angle = null);
+    void setOrientToAngle(SVGAngle angle);
 };
 
 SVGMarkerElement implements SVGExternalResourcesRequired;

Modified: trunk/Source/WebCore/svg/SVGSVGElement.idl (200245 => 200246)


--- trunk/Source/WebCore/svg/SVGSVGElement.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/svg/SVGSVGElement.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -50,10 +50,16 @@
     boolean animationsPaused();
     unrestricted float getCurrentTime();
     void setCurrentTime(optional unrestricted float seconds = NaN);
-    NodeList getIntersectionList(optional SVGRect rect = null, optional SVGElement? referenceElement = null);
-    NodeList getEnclosureList(optional SVGRect rect = null, optional SVGElement? referenceElement = null);
-    boolean checkIntersection(optional SVGElement? element = null, optional SVGRect rect = null);
-    boolean checkEnclosure(optional SVGElement? element = null, optional SVGRect rect = null);
+
+    // FIXME: referenceElement should not be optional.
+    NodeList getIntersectionList(SVGRect rect, optional SVGElement? referenceElement = null);
+
+    // FIXME: referenceElement should not be optional.
+    NodeList getEnclosureList(SVGRect rect, optional SVGElement? referenceElement = null);
+
+    boolean checkIntersection(SVGElement? element, SVGRect rect); // element should not be nullable.
+    boolean checkEnclosure(SVGElement? element, SVGRect rect); // element should not be nullable.
+
     void deselectAll();
 
     SVGNumber createSVGNumber();
@@ -63,7 +69,7 @@
     SVGMatrix createSVGMatrix();
     SVGRect createSVGRect();
     SVGTransform createSVGTransform();
-    SVGTransform createSVGTransformFromMatrix(optional SVGMatrix matrix = null);
+    SVGTransform createSVGTransformFromMatrix(SVGMatrix matrix);
 
     // FIXME: Using "undefined" as default parameter value is wrong.
     Element getElementById([RequiresExistingAtomicString] optional DOMString elementId = "undefined");

Modified: trunk/Source/WebCore/svg/SVGTextContentElement.idl (200245 => 200246)


--- trunk/Source/WebCore/svg/SVGTextContentElement.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/svg/SVGTextContentElement.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -40,7 +40,7 @@
     [RaisesException] SVGPoint getEndPositionOfChar(optional unsigned long offset = 0);
     [RaisesException] SVGRect getExtentOfChar(optional unsigned long offset = 0);
     [RaisesException] unrestricted float getRotationOfChar(optional unsigned long offset = 0);
-    long getCharNumAtPosition(optional SVGPoint point = null);
+    long getCharNumAtPosition(SVGPoint point);
     [RaisesException] void selectSubString(optional unsigned long offset = 0, optional unsigned long length = 0);
 };
 

Modified: trunk/Source/WebCore/testing/Internals.cpp (200245 => 200246)


--- trunk/Source/WebCore/testing/Internals.cpp	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/testing/Internals.cpp	2016-04-29 16:51:58 UTC (rev 200246)
@@ -2384,11 +2384,6 @@
     return document->renderView()->compositor().compositingUpdateCount();
 }
 
-void Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(ExceptionCode& ec)
-{
-    updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(nullptr, ec);
-}
-
 void Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node* node, ExceptionCode& ec)
 {
     Document* document;

Modified: trunk/Source/WebCore/testing/Internals.h (200245 => 200246)


--- trunk/Source/WebCore/testing/Internals.h	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/testing/Internals.h	2016-04-29 16:51:58 UTC (rev 200246)
@@ -326,7 +326,6 @@
     void startTrackingCompositingUpdates(ExceptionCode&);
     unsigned compositingUpdateCount(ExceptionCode&);
 
-    void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(ExceptionCode&);
     void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*, ExceptionCode&);
     unsigned layoutCount() const;
 

Modified: trunk/Source/WebCore/testing/Internals.idl (200245 => 200246)


--- trunk/Source/WebCore/testing/Internals.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/testing/Internals.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -332,7 +332,7 @@
     // |node| should be Document, HTMLIFrameElement, or unspecified.
     // If |node| is an HTMLIFrameElement, it assumes node.contentDocument is
     // specified without security checks. Unspecified or null means this document.
-    [RaisesException] void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(optional Node? node);
+    [RaisesException] void updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(optional Node? node = null);
 
     readonly attribute unsigned long layoutCount;
 

Modified: trunk/Source/WebCore/xml/XPathEvaluator.idl (200245 => 200246)


--- trunk/Source/WebCore/xml/XPathEvaluator.idl	2016-04-29 16:44:30 UTC (rev 200245)
+++ trunk/Source/WebCore/xml/XPathEvaluator.idl	2016-04-29 16:51:58 UTC (rev 200246)
@@ -23,7 +23,7 @@
 ] interface XPathEvaluator {
     // FIXME: Using "undefined" as default parameter value is wrong.
     [RaisesException] XPathExpression createExpression(optional DOMString _expression_ = "undefined",
-                                     optional XPathNSResolver resolver = null);
+                                     optional XPathNSResolver? resolver = null);
 
     XPathNSResolver createNSResolver(optional Node? nodeResolver = null);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to