Title: [199976] trunk/Source/WebCore
Revision
199976
Author
cdu...@apple.com
Date
2016-04-24 22:59:04 -0700 (Sun, 24 Apr 2016)

Log Message

[Web IDL] Specify default values for boolean parameters
https://bugs.webkit.org/show_bug.cgi?id=156964

Reviewed by Darin Adler.

Specify default values for boolean parameters in our IDL files and
let the bindings generator use WTF::Optional<> for the ones without
a default value.

* CMakeLists.txt:
* Modules/indexeddb/IDBKeyRange.cpp:
* Modules/indexeddb/IDBKeyRange.h:
* Modules/indexeddb/IDBKeyRange.idl:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:

* bindings/js/JSDOMTokenListCustom.cpp: Removed.
We no longer need these custom bindings as the bindings generator
will now provide the implementation with an Optional<bool>, given
that the parameter has no default value.

* bindings/scripts/CodeGeneratorJS.pm:
(CanUseWTFOptionalForParameterType): Deleted.
* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
(webkit_dom_test_obj_method_with_optional_boolean):
(webkit_dom_test_obj_method_with_optional_boolean_is_false):
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBoolean):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse):
* bindings/scripts/test/ObjC/DOMTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
(-[DOMTestObj methodWithOptionalBoolean:]):
(-[DOMTestObj methodWithOptionalBooleanIsFalse:]):
* bindings/scripts/test/TestObj.idl:
* dom/Document.h:
* dom/Document.idl:
* dom/Element.idl:
* dom/EventTarget.idl:
* html/DOMTokenList.idl:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (199975 => 199976)


--- trunk/Source/WebCore/CMakeLists.txt	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/CMakeLists.txt	2016-04-25 05:59:04 UTC (rev 199976)
@@ -1123,7 +1123,6 @@
     bindings/js/JSDOMPromise.cpp
     bindings/js/JSDOMStringListCustom.cpp
     bindings/js/JSDOMStringMapCustom.cpp
-    bindings/js/JSDOMTokenListCustom.cpp
     bindings/js/JSDOMWindowBase.cpp
     bindings/js/JSDOMWindowCustom.cpp
     bindings/js/JSDOMWindowShell.cpp

Modified: trunk/Source/WebCore/ChangeLog (199975 => 199976)


--- trunk/Source/WebCore/ChangeLog	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/ChangeLog	2016-04-25 05:59:04 UTC (rev 199976)
@@ -1,5 +1,48 @@
 2016-04-24  Chris Dumez  <cdu...@apple.com>
 
+        [Web IDL] Specify default values for boolean parameters
+        https://bugs.webkit.org/show_bug.cgi?id=156964
+
+        Reviewed by Darin Adler.
+
+        Specify default values for boolean parameters in our IDL files and
+        let the bindings generator use WTF::Optional<> for the ones without
+        a default value.
+
+        * CMakeLists.txt:
+        * Modules/indexeddb/IDBKeyRange.cpp:
+        * Modules/indexeddb/IDBKeyRange.h:
+        * Modules/indexeddb/IDBKeyRange.idl:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSBindingsAllInOne.cpp:
+
+        * bindings/js/JSDOMTokenListCustom.cpp: Removed.
+        We no longer need these custom bindings as the bindings generator
+        will now provide the implementation with an Optional<bool>, given
+        that the parameter has no default value.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (CanUseWTFOptionalForParameterType): Deleted.
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+        (webkit_dom_test_obj_method_with_optional_boolean):
+        (webkit_dom_test_obj_method_with_optional_boolean_is_false):
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBoolean):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse):
+        * bindings/scripts/test/ObjC/DOMTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.mm:
+        (-[DOMTestObj methodWithOptionalBoolean:]):
+        (-[DOMTestObj methodWithOptionalBooleanIsFalse:]):
+        * bindings/scripts/test/TestObj.idl:
+        * dom/Document.h:
+        * dom/Document.idl:
+        * dom/Element.idl:
+        * dom/EventTarget.idl:
+        * html/DOMTokenList.idl:
+
+2016-04-24  Chris Dumez  <cdu...@apple.com>
+
         Autogenerated IDBFactory.open() does the wrong thing if you pass an explicit 'undefined' as the second argument
         https://bugs.webkit.org/show_bug.cgi?id=156939
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp (199975 => 199976)


--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp	2016-04-25 05:59:04 UTC (rev 199976)
@@ -129,26 +129,6 @@
     return m_lower && m_upper && !m_isLowerOpen && !m_isUpperOpen && m_lower->isEqual(m_upper.get());
 }
 
-RefPtr<IDBKeyRange> IDBKeyRange::lowerBound(ExecState& state, JSValue bound, ExceptionCode& ec)
-{
-    return lowerBound(state, bound, false, ec);
-}
-
-RefPtr<IDBKeyRange> IDBKeyRange::upperBound(ExecState& state, JSValue bound, ExceptionCode& ec)
-{
-    return upperBound(state, bound, false, ec);
-}
-
-RefPtr<IDBKeyRange> IDBKeyRange::bound(ExecState& state, JSValue lower, JSValue upper, ExceptionCode& ec)
-{
-    return bound(state, lower, upper, false, false, ec);
-}
-
-RefPtr<IDBKeyRange> IDBKeyRange::bound(ExecState& state, JSValue lower, JSValue upper, bool lowerOpen, ExceptionCode& ec)
-{
-    return bound(state, lower, upper, lowerOpen, false, ec);
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(INDEXED_DATABASE)

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h (199975 => 199976)


--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.h	2016-04-25 05:59:04 UTC (rev 199976)
@@ -57,14 +57,9 @@
     static RefPtr<IDBKeyRange> only(RefPtr<IDBKey>&& value, ExceptionCode&);
     static RefPtr<IDBKeyRange> only(JSC::ExecState&, JSC::JSValue key, ExceptionCode&);
 
-    static RefPtr<IDBKeyRange> lowerBound(JSC::ExecState&, JSC::JSValue bound, ExceptionCode&);
     static RefPtr<IDBKeyRange> lowerBound(JSC::ExecState&, JSC::JSValue bound, bool open, ExceptionCode&);
-
-    static RefPtr<IDBKeyRange> upperBound(JSC::ExecState&, JSC::JSValue bound, ExceptionCode&);
     static RefPtr<IDBKeyRange> upperBound(JSC::ExecState&, JSC::JSValue bound, bool open, ExceptionCode&);
 
-    static RefPtr<IDBKeyRange> bound(JSC::ExecState&, JSC::JSValue lower, JSC::JSValue upper, ExceptionCode&);
-    static RefPtr<IDBKeyRange> bound(JSC::ExecState&, JSC::JSValue lower, JSC::JSValue upper, bool lowerOpen, ExceptionCode&);
     static RefPtr<IDBKeyRange> bound(JSC::ExecState&, JSC::JSValue lower, JSC::JSValue upper, bool lowerOpen, bool upperOpen, ExceptionCode&);
 
     // FIXME: Eventually should probably change all callers to call the ExecState version.

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl (199975 => 199976)


--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.idl	2016-04-25 05:59:04 UTC (rev 199976)
@@ -34,7 +34,7 @@
     readonly attribute boolean upperOpen;
 
     [CallWith=ScriptState, RaisesException] static IDBKeyRange only(any value);
-    [CallWith=ScriptState, RaisesException] static IDBKeyRange lowerBound(any lower, optional boolean open);
-    [CallWith=ScriptState, RaisesException] static IDBKeyRange upperBound(any upper, optional boolean open);
-    [CallWith=ScriptState, RaisesException] static IDBKeyRange bound(any lower, any upper, optional boolean lowerOpen, optional boolean upperOpen);
+    [CallWith=ScriptState, RaisesException] static IDBKeyRange lowerBound(any lower, optional boolean open = false);
+    [CallWith=ScriptState, RaisesException] static IDBKeyRange upperBound(any upper, optional boolean open = false);
+    [CallWith=ScriptState, RaisesException] static IDBKeyRange bound(any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false);
 };

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (199975 => 199976)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-04-25 05:59:04 UTC (rev 199976)
@@ -2880,7 +2880,6 @@
 		836CB1F91BD1E41800AF1591 /* JSHTMLTableDataCellElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836CB1F51BD1E41800AF1591 /* JSHTMLTableDataCellElement.cpp */; };
 		836FBCEA178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */; };
 		836FBCEC178C117F00B21A15 /* SVGAnimatedProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */; };
-		837131781BAB7A720009363B /* JSDOMTokenListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 837131771BAB7A720009363B /* JSDOMTokenListCustom.cpp */; };
 		8372DB311A6780A800C697C5 /* DiagnosticLoggingResultType.h in Headers */ = {isa = PBXBuildFile; fileRef = 8372DB301A6780A800C697C5 /* DiagnosticLoggingResultType.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		8386A96D19F61B2E00E1EC4A /* StyleBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8386A96C19F61B2E00E1EC4A /* StyleBuilder.h */; };
 		8386A97019F61E4F00E1EC4A /* StyleBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */; };
@@ -10544,7 +10543,6 @@
 		836CB1F51BD1E41800AF1591 /* JSHTMLTableDataCellElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTableDataCellElement.cpp; sourceTree = "<group>"; };
 		836FBCE9178C113200B21A15 /* SVGAnimatedTypeAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedTypeAnimator.cpp; sourceTree = "<group>"; };
 		836FBCEB178C117F00B21A15 /* SVGAnimatedProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedProperty.cpp; sourceTree = "<group>"; };
-		837131771BAB7A720009363B /* JSDOMTokenListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMTokenListCustom.cpp; sourceTree = "<group>"; };
 		8372DB301A6780A800C697C5 /* DiagnosticLoggingResultType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiagnosticLoggingResultType.h; sourceTree = "<group>"; };
 		8386A96C19F61B2E00E1EC4A /* StyleBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilder.h; sourceTree = "<group>"; };
 		8386A96E19F61E4F00E1EC4A /* StyleBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleBuilder.cpp; sourceTree = "<group>"; };
@@ -22296,7 +22294,6 @@
 				46F2768E1B85297F005C2556 /* JSDOMNamedFlowCollectionCustom.cpp */,
 				E172AF8D1811BC3700FBADB9 /* JSDOMPromise.cpp */,
 				E172AF8E1811BC3700FBADB9 /* JSDOMPromise.h */,
-				837131771BAB7A720009363B /* JSDOMTokenListCustom.cpp */,
 				BC6932710D7E293900AE44D1 /* JSDOMWindowBase.cpp */,
 				BC6932720D7E293900AE44D1 /* JSDOMWindowBase.h */,
 				BCBFB53A0DCD29CF0019B3E5 /* JSDOMWindowShell.cpp */,
@@ -30265,7 +30262,6 @@
 				BC64649711D82349006455B0 /* JSDOMStringMap.cpp in Sources */,
 				BC64649C11D8238C006455B0 /* JSDOMStringMapCustom.cpp in Sources */,
 				7694563C1214D97C0007CBAE /* JSDOMTokenList.cpp in Sources */,
-				837131781BAB7A720009363B /* JSDOMTokenListCustom.cpp in Sources */,
 				2E37E00512DBC5A400A6B233 /* JSDOMURL.cpp in Sources */,
 				1403BA0C09EB18C700797C7F /* JSDOMWindow.cpp in Sources */,
 				BC6932730D7E293900AE44D1 /* JSDOMWindowBase.cpp in Sources */,

Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (199975 => 199976)


--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp	2016-04-25 05:59:04 UTC (rev 199976)
@@ -59,7 +59,6 @@
 #include "JSDOMPromise.cpp"
 #include "JSDOMStringListCustom.cpp"
 #include "JSDOMStringMapCustom.cpp"
-#include "JSDOMTokenListCustom.cpp"
 #include "JSDOMWindowBase.cpp"
 #include "JSDOMWindowCustom.cpp"
 #include "JSDOMWindowShell.cpp"

Deleted: trunk/Source/WebCore/bindings/js/JSDOMTokenListCustom.cpp (199975 => 199976)


--- trunk/Source/WebCore/bindings/js/JSDOMTokenListCustom.cpp	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/bindings/js/JSDOMTokenListCustom.cpp	2016-04-25 05:59:04 UTC (rev 199976)
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JSDOMTokenList.h"
-
-#include "JSDOMBinding.h"
-#include <runtime/Error.h>
-#include <wtf/Optional.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSValue JSDOMTokenList::toggle(ExecState& state)
-{
-    if (UNLIKELY(state.argumentCount() < 1))
-        return state.vm().throwException(&state, createNotEnoughArgumentsError(&state));
-
-    ExceptionCode ec = 0;
-    String token = state.argument(0).toString(&state)->value(&state);
-    if (UNLIKELY(state.hadException()))
-        return jsUndefined();
-
-    // toggle() needs to be able to distinguish undefined/missing from the false value for the 'force' parameter.
-    Optional<bool> force = state.argument(1).isUndefined() ? Nullopt : Optional<bool>(state.uncheckedArgument(1).toBoolean(&state));
-    if (UNLIKELY(state.hadException()))
-        return jsUndefined();
-    JSValue result = jsBoolean(wrapped().toggle(token, force, ec));
-
-    setDOMException(&state, ec);
-    return result;
-}
-
-
-}

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (199975 => 199976)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-04-25 05:59:04 UTC (rev 199976)
@@ -3382,7 +3382,6 @@
     return 0 if $type eq "DOMString";
     return 0 if $type eq "Dictionary";
     return 0 if $type eq "any";
-    return 0 if $type eq "boolean";
     return 0 if $type eq "float";
     return 0 if $type eq "long";
     return 0 if $type eq "unrestricted float";

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


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp	2016-04-25 05:59:04 UTC (rev 199976)
@@ -1700,6 +1700,22 @@
     item->methodWithOptionalArrayIsEmpty(convertedArray);
 }
 
+void webkit_dom_test_obj_method_with_optional_boolean(WebKitDOMTestObj* self, gboolean b)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+    WebCore::TestObj* item = WebKit::core(self);
+    item->methodWithOptionalBoolean(b);
+}
+
+void webkit_dom_test_obj_method_with_optional_boolean_is_false(WebKitDOMTestObj* self, gboolean b)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+    WebCore::TestObj* item = WebKit::core(self);
+    item->methodWithOptionalBooleanIsFalse(b);
+}
+
 gchar* webkit_dom_test_obj_conditional_method1(WebKitDOMTestObj* self)
 {
 #if ENABLE(Condition1)

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


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h	2016-04-25 05:59:04 UTC (rev 199976)
@@ -669,6 +669,26 @@
 webkit_dom_test_obj_method_with_optional_array_is_empty(WebKitDOMTestObj* self, const gchar* array);
 
 /**
+ * webkit_dom_test_obj_method_with_optional_boolean:
+ * @self: A #WebKitDOMTestObj
+ * @b: A #gboolean
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_boolean(WebKitDOMTestObj* self, gboolean b);
+
+/**
+ * webkit_dom_test_obj_method_with_optional_boolean_is_false:
+ * @self: A #WebKitDOMTestObj
+ * @b: A #gboolean
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_boolean_is_false(WebKitDOMTestObj* self, gboolean b);
+
+/**
  * webkit_dom_test_obj_conditional_method1:
  * @self: A #WebKitDOMTestObj
  *

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


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-04-25 05:59:04 UTC (rev 199976)
@@ -154,6 +154,8 @@
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZero(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArray(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArrayIsEmpty(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalBoolean(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse(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*);
@@ -719,6 +721,8 @@
     { "methodWithOptionalUnsignedLongLongIsZero", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZero), (intptr_t) (0) } },
     { "methodWithOptionalArray", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArray), (intptr_t) (0) } },
     { "methodWithOptionalArrayIsEmpty", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArrayIsEmpty), (intptr_t) (0) } },
+    { "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) } },
     { "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) } },
@@ -4343,6 +4347,36 @@
     return JSValue::encode(jsUndefined());
 }
 
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalBoolean(ExecState* state)
+{
+    JSValue thisValue = state->thisValue();
+    auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, "TestObj", "methodWithOptionalBoolean");
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto& impl = castedThis->wrapped();
+    Optional<bool> b = state->argument(0).isUndefined() ? Optional<bool>() : state->uncheckedArgument(0).toBoolean(state);
+    if (UNLIKELY(state->hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.methodWithOptionalBoolean(b);
+    return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse(ExecState* state)
+{
+    JSValue thisValue = state->thisValue();
+    auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, "TestObj", "methodWithOptionalBooleanIsFalse");
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto& impl = castedThis->wrapped();
+    bool b = state->argument(0).isUndefined() ? false : state->uncheckedArgument(0).toBoolean(state);
+    if (UNLIKELY(state->hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.methodWithOptionalBooleanIsFalse(b);
+    return JSValue::encode(jsUndefined());
+}
+
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(ExecState* state)
 {
     JSValue thisValue = state->thisValue();

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


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2016-04-25 05:59:04 UTC (rev 199976)
@@ -188,6 +188,8 @@
 - (void)methodWithOptionalLongLongIsZero:(long long)number;
 - (void)methodWithOptionalUnsignedLongLong:(unsigned long long)number;
 - (void)methodWithOptionalUnsignedLongLongIsZero:(unsigned long long)number;
+- (void)methodWithOptionalBoolean:(BOOL)b;
+- (void)methodWithOptionalBooleanIsFalse:(BOOL)b;
 - (void)classMethod;
 - (int)classMethodWithOptional:(int)arg;
 - (void)classMethod2:(int)arg;

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


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm	2016-04-25 05:59:04 UTC (rev 199976)
@@ -1340,7 +1340,19 @@
     IMPL->methodWithOptionalUnsignedLongLongIsZero(number);
 }
 
+- (void)methodWithOptionalBoolean:(BOOL)b
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL->methodWithOptionalBoolean(b);
+}
 
+- (void)methodWithOptionalBooleanIsFalse:(BOOL)b
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL->methodWithOptionalBooleanIsFalse(b);
+}
+
+
 #if ENABLE(Condition1)
 - (NSString *)conditionalMethod1
 {

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


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2016-04-25 05:59:04 UTC (rev 199976)
@@ -146,8 +146,8 @@
     // Private extended attribute
     [Private] DOMString privateMethod(DOMString argument);
 
-    void addEventListener(DOMString type, EventListener listener, optional boolean useCapture);
-    void removeEventListener(DOMString type, EventListener listener, optional boolean useCapture);
+    void addEventListener(DOMString type, EventListener listener, optional boolean useCapture = false);
+    void removeEventListener(DOMString type, EventListener listener, optional boolean useCapture = false);
     attribute EventHandler onfoo;
     [ImplementedAs=onfoo] attribute EventHandler onwebkitfoo;
 
@@ -195,6 +195,8 @@
     void    methodWithOptionalUnsignedLongLongIsZero(optional unsigned long long number = 0);
     void    methodWithOptionalArray(optional DOMString[] array);
     void    methodWithOptionalArrayIsEmpty(optional DOMString[] array = []);
+    void    methodWithOptionalBoolean(optional boolean b);
+    void    methodWithOptionalBooleanIsFalse(optional boolean b = false);
 
 #if defined(TESTING_JS)
     // Callback interface parameters.

Modified: trunk/Source/WebCore/dom/Document.h (199975 => 199976)


--- trunk/Source/WebCore/dom/Document.h	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/dom/Document.h	2016-04-25 05:59:04 UTC (rev 199976)
@@ -388,7 +388,6 @@
     RefPtr<Attr> createAttribute(const String& name, ExceptionCode&);
     RefPtr<Attr> createAttributeNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&, bool shouldIgnoreNamespaceChecks = false);
     RefPtr<EntityReference> createEntityReference(const String& name, ExceptionCode&);
-    RefPtr<Node> importNode(Node& nodeToImport, ExceptionCode& ec) { return importNode(nodeToImport, false, ec); }
     RefPtr<Node> importNode(Node& nodeToImport, bool deep, ExceptionCode&);
     WEBCORE_EXPORT RefPtr<Element> createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode&);
     WEBCORE_EXPORT Ref<Element> createElement(const QualifiedName&, bool createdByParser);

Modified: trunk/Source/WebCore/dom/Document.idl (199975 => 199976)


--- trunk/Source/WebCore/dom/Document.idl	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/dom/Document.idl	2016-04-25 05:59:04 UTC (rev 199976)
@@ -56,7 +56,7 @@
 
     // Introduced in DOM Level 2:
 
-    [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Node importNode(Node importedNode, optional boolean deep);
+    [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Node importNode(Node importedNode, optional boolean deep = false);
 
     // FIXME: 'qualifiedName' should not have [TreatNullAs=EmptyString].
     // FIXME: Using "undefined" as default parameter value is wrong.

Modified: trunk/Source/WebCore/dom/Element.idl (199975 => 199976)


--- trunk/Source/WebCore/dom/Element.idl	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/dom/Element.idl	2016-04-25 05:59:04 UTC (rev 199976)
@@ -123,11 +123,11 @@
     void blur();
 #endif
 
-    void scrollIntoView(optional boolean alignWithTop);
+    void scrollIntoView(optional boolean alignWithTop = true);
 
     // WebKit extensions
 
-    void scrollIntoViewIfNeeded(optional boolean centerIfNeeded);
+    void scrollIntoViewIfNeeded(optional boolean centerIfNeeded = true);
     void scrollByLines(optional long lines = 0);
     void scrollByPages(optional long pages = 0);
 

Modified: trunk/Source/WebCore/dom/EventTarget.idl (199975 => 199976)


--- trunk/Source/WebCore/dom/EventTarget.idl	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/dom/EventTarget.idl	2016-04-25 05:59:04 UTC (rev 199976)
@@ -26,7 +26,7 @@
     JSCustomHeader,
     ObjCProtocol,
 ] interface EventTarget {
-    [ObjCLegacyUnnamedParameters] void addEventListener(DOMString type, EventListener listener, optional boolean useCapture);
-    [ObjCLegacyUnnamedParameters] void removeEventListener(DOMString type, EventListener listener, optional boolean useCapture);
+    [ObjCLegacyUnnamedParameters] void addEventListener(DOMString type, EventListener listener, optional boolean useCapture = false);
+    [ObjCLegacyUnnamedParameters] void removeEventListener(DOMString type, EventListener listener, optional boolean useCapture = false);
     [ImplementedAs=dispatchEventForBindings, RaisesException] boolean dispatchEvent(Event event);
 };

Modified: trunk/Source/WebCore/html/DOMTokenList.idl (199975 => 199976)


--- trunk/Source/WebCore/html/DOMTokenList.idl	2016-04-25 05:56:09 UTC (rev 199975)
+++ trunk/Source/WebCore/html/DOMTokenList.idl	2016-04-25 05:59:04 UTC (rev 199976)
@@ -32,7 +32,7 @@
     boolean contains(DOMString token);
     [RaisesException] void add(DOMString... tokens);
     [RaisesException] void remove(DOMString... tokens);
-    [RaisesException, Custom] boolean toggle(DOMString token, optional boolean force);
+    [RaisesException] boolean toggle(DOMString token, optional boolean force);
 
     attribute DOMString value;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to