From 8c7d8ccf45fa9dee315b2ca36e45f0d60f2b27d4 Mon Sep 17 00:00:00 2001 From: Chris Dumez Date: Sun, 24 Apr 2016 17:23:41 +0000 Subject: [PATCH] [WebIDL] Drop [Default] WebKit-IDL extended attribute https://bugs.webkit.org/show_bug.cgi?id=156955 Reviewed by Darin Adler. LayoutTests/imported/w3c: Rebaseline some tests now that a different exception type is thrown for some of our APIs when passing null. * web-platform-tests/dom/interfaces-expected.txt: * web-platform-tests/html/dom/interfaces-expected.txt: Source/WebCore: Drop [Default] WebKit-IDL extended attribute in favor of the standard WebIDL syntax for parameters' default value. Here is what it looks like: [Default=NullString] optional DOMString a -> optional DOMString a = null [Default=NullString] optional DOMString? a -> optional DOMString? a = null [Default=Undefined] optional DOMString a -> optional DOMString a = "undefined" [Default=Undefined] optional DOMString? a -> optional DOMString? a = null [Default=Undefined] optional long a -> optional long a = 0 [Default=Undefined] optional bool a -> optional bool a = false [Default=Undefined] optional unrestricted double a -> optional unrestricted double a = NaN [Default=Undefined] optional unrestricted float a -> optional unrestricted float a = NaN [Default=Undefined] optional sequence a -> optional sequence a = [] These do not cause any Web-Exposed behavior change. However, when getting rid of [Default] started passing more parameters by derefence instead of pointer (as is expected for parameters not marked as nullable). As a result, I had to mark a few parameters as nullable in the IDL to maintain the previous behavior. In some cases, the implementation was already throwing when passing null. In such cases, I have not marked the type as nullable so that the generated bindings now throw the exception instead of our implementation code. In some cases, the exception being thrown is now different. This is why some of the layout tests had to be rebaselined. No new tests, existing tests have been rebaselined. No significant Web exposed behavior change is expected from this patch, beside exceptions type sometimes being different. * Modules/encryptedmedia/MediaKeys.idl: * Modules/fetch/FetchRequest.idl: * Modules/gamepad/deprecated/GamepadList.idl: * Modules/indexeddb/IDBDatabase.idl: * Modules/mediastream/RTCStatsResponse.idl: * Modules/notifications/Notification.idl: * Modules/speech/SpeechSynthesisUtterance.idl: * Modules/webaudio/AudioNode.idl: * Modules/websockets/WebSocket.idl: * bindings/scripts/CodeGeneratorJS.pm: (GenerateParametersCheck): * bindings/scripts/IDLAttributes.txt: * bindings/scripts/IDLParser.pm: (parseDefault): (parseDefaultValue): * bindings/scripts/test/TestInterface.idl: * bindings/scripts/test/TestNamedConstructor.idl: * bindings/scripts/test/TestObj.idl: * bindings/scripts/test/TestOverrideBuiltins.idl: * css/CSSKeyframesRule.idl: * css/CSSMediaRule.idl: * css/CSSPrimitiveValue.idl: * css/CSSRuleList.idl: * css/CSSStyleDeclaration.idl: * css/CSSStyleSheet.idl: * css/CSSSupportsRule.idl: * css/CSSValueList.idl: * css/MediaList.idl: * css/MediaQueryList.idl: * css/MediaQueryListListener.idl: * css/StyleMedia.idl: * css/StyleSheetList.idl: * css/WebKitCSSFilterValue.idl: * css/WebKitCSSMatrix.idl: * css/WebKitCSSTransformValue.idl: * dom/ClientRectList.idl: * dom/Comment.idl: * dom/CompositionEvent.idl: * dom/CustomEvent.h: * dom/CustomEvent.idl: * dom/DOMImplementation.idl: * dom/DOMStringList.idl: * dom/DataTransferItem.idl: * dom/DataTransferItemList.idl: * dom/DeviceMotionEvent.idl: * dom/DeviceOrientationEvent.idl: * dom/Document.cpp: (WebCore::Document::adoptNode): * dom/Document.idl: * dom/Element.cpp: (WebCore::Element::setAttributeNode): (WebCore::Element::setAttributeNodeNS): (WebCore::Element::removeAttributeNode): (WebCore::Element::parseAttributeName): Deleted. * dom/Element.h: * dom/Element.idl: * dom/Event.idl: * dom/HashChangeEvent.idl: * dom/KeyboardEvent.idl: * dom/MessageEvent.idl: * dom/MouseEvent.idl: * dom/MutationEvent.idl: * dom/NamedNodeMap.cpp: (WebCore::NamedNodeMap::setNamedItem): (WebCore::NamedNodeMap::setNamedItemNS): (WebCore::NamedNodeMap::item): Deleted. * dom/NamedNodeMap.h: * dom/NamedNodeMap.idl: * dom/Node.idl: * dom/NodeFilter.idl: * dom/NonElementParentNode.idl: * dom/OverflowEvent.idl: * dom/Range.idl: * dom/Text.idl: * dom/TextEvent.idl: * dom/TouchEvent.idl: * dom/UIEvent.idl: * dom/WheelEvent.idl: * html/DOMFormData.idl: * html/HTMLAllCollection.idl: * html/HTMLAudioElement.idl: * html/HTMLCanvasElement.idl: * html/HTMLCollection.idl: * html/HTMLDocument.idl: * html/HTMLElement.cpp: (WebCore::HTMLElement::insertAdjacentElement): (WebCore::contextElementForInsertion): Deleted. * html/HTMLElement.h: * html/HTMLElement.idl: * html/HTMLFormControlsCollection.idl: * html/HTMLInputElement.idl: * html/HTMLMediaElement.idl: * html/HTMLOptionElement.idl: * html/HTMLOptionsCollection.idl: * html/HTMLSelectElement.idl: * html/HTMLTableElement.idl: * html/HTMLTableRowElement.idl: * html/HTMLTableSectionElement.idl: * html/HTMLTextAreaElement.idl: * html/ImageData.idl: * html/canvas/CanvasGradient.idl: * html/canvas/CanvasRenderingContext2D.idl: * html/canvas/DOMPath.idl: * html/canvas/OESVertexArrayObject.idl: * page/DOMSelection.cpp: (WebCore::DOMSelection::extend): (WebCore::DOMSelection::getRangeAt): Deleted. * page/DOMSelection.h: * page/DOMSelection.idl: * page/DOMWindow.idl: * page/History.idl: * page/Performance.idl: * page/WindowTimers.idl: * plugins/DOMMimeTypeArray.idl: * plugins/DOMPlugin.idl: * plugins/DOMPluginArray.idl: * storage/StorageEvent.idl: * svg/SVGAnimationElement.idl: * svg/SVGDocument.idl: * svg/SVGElement.idl: * svg/SVGFEDropShadowElement.idl: * svg/SVGFEGaussianBlurElement.idl: * svg/SVGFEMorphologyElement.idl: * svg/SVGFilterElement.idl: * svg/SVGGraphicsElement.idl: * svg/SVGMarkerElement.idl: * svg/SVGPathElement.idl: * svg/SVGSVGElement.idl: * svg/SVGTests.idl: * svg/SVGTextContentElement.idl: * xml/DOMParser.idl: * xml/XMLSerializer.cpp: (WebCore::XMLSerializer::serializeToString): * xml/XMLSerializer.h: * xml/XMLSerializer.idl: * xml/XPathEvaluator.idl: * xml/XPathExpression.idl: * xml/XPathNSResolver.idl: * xml/XPathResult.idl: * xml/XSLTProcessor.idl: Tools: * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: LayoutTests: Rebaseline some tests now that a different exception type is thrown for some of our APIs when passing null. * editing/selection/extend-expected.txt: * fast/dom/Element/attr-param-typechecking-expected.txt: * fast/dom/NamedNodeMap-setNamedItem-crash-expected.txt: * fast/dynamic/insertAdjacentElement-expected.txt: Canonical link: https://commits.webkit.org/175071@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199969 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 15 ++ .../editing/selection/extend-expected.txt | 4 +- .../attr-param-typechecking-expected.txt | 24 +-- ...medNodeMap-setNamedItem-crash-expected.txt | 2 +- .../insertAdjacentElement-expected.txt | 2 +- LayoutTests/imported/w3c/ChangeLog | 13 ++ .../dom/interfaces-expected.txt | 22 +-- .../html/dom/interfaces-expected.txt | 12 +- .../html/dom/interfaces-expected.txt | 12 +- Source/WebCore/ChangeLog | 176 ++++++++++++++++++ .../Modules/encryptedmedia/MediaKeys.idl | 5 +- Source/WebCore/Modules/fetch/FetchRequest.idl | 4 +- .../gamepad/deprecated/GamepadList.idl | 2 +- .../WebCore/Modules/indexeddb/IDBDatabase.idl | 4 +- .../Modules/mediastream/RTCStatsResponse.idl | 3 +- .../Modules/notifications/Notification.idl | 2 +- .../speech/SpeechSynthesisUtterance.idl | 2 +- Source/WebCore/Modules/webaudio/AudioNode.idl | 6 +- .../WebCore/Modules/websockets/WebSocket.idl | 2 +- .../WebCore/bindings/scripts/CodeGenerator.pm | 1 - .../bindings/scripts/CodeGeneratorJS.pm | 30 ++- .../bindings/scripts/IDLAttributes.txt | 1 - Source/WebCore/bindings/scripts/IDLParser.pm | 6 + .../scripts/test/GObject/WebKitDOMTestObj.cpp | 64 ++++++- .../scripts/test/GObject/WebKitDOMTestObj.h | 68 ++++++- .../scripts/test/JS/JSTestInterface.cpp | 2 +- .../test/JS/JSTestNamedConstructor.cpp | 2 +- .../bindings/scripts/test/JS/JSTestObj.cpp | 163 +++++++++++++--- .../test/JS/JSTestOverrideBuiltins.cpp | 2 +- .../bindings/scripts/test/ObjC/DOMTestObj.h | 10 +- .../bindings/scripts/test/ObjC/DOMTestObj.mm | 44 ++++- .../bindings/scripts/test/TestInterface.idl | 2 +- .../scripts/test/TestNamedConstructor.idl | 2 +- .../WebCore/bindings/scripts/test/TestObj.idl | 11 +- .../scripts/test/TestOverrideBuiltins.idl | 2 +- Source/WebCore/css/CSSKeyframesRule.idl | 9 +- Source/WebCore/css/CSSMediaRule.idl | 6 +- Source/WebCore/css/CSSPrimitiveValue.idl | 12 +- Source/WebCore/css/CSSRuleList.idl | 2 +- Source/WebCore/css/CSSStyleDeclaration.idl | 24 ++- Source/WebCore/css/CSSStyleSheet.idl | 14 +- Source/WebCore/css/CSSSupportsRule.idl | 7 +- Source/WebCore/css/CSSValueList.idl | 2 +- Source/WebCore/css/MediaList.idl | 8 +- Source/WebCore/css/MediaQueryList.idl | 4 +- Source/WebCore/css/MediaQueryListListener.idl | 2 +- Source/WebCore/css/StyleMedia.idl | 4 +- Source/WebCore/css/StyleSheetList.idl | 2 +- Source/WebCore/css/WebKitCSSFilterValue.idl | 2 +- Source/WebCore/css/WebKitCSSMatrix.idl | 39 ++-- .../WebCore/css/WebKitCSSTransformValue.idl | 2 +- Source/WebCore/dom/ClientRectList.idl | 2 +- Source/WebCore/dom/Comment.idl | 2 +- Source/WebCore/dom/CompositionEvent.idl | 11 +- Source/WebCore/dom/CustomEvent.h | 2 +- Source/WebCore/dom/CustomEvent.idl | 3 +- Source/WebCore/dom/DOMImplementation.idl | 15 +- Source/WebCore/dom/DOMStringList.idl | 6 +- Source/WebCore/dom/DataTransferItem.idl | 2 +- Source/WebCore/dom/DataTransferItemList.idl | 7 +- Source/WebCore/dom/DeviceMotionEvent.idl | 15 +- Source/WebCore/dom/DeviceOrientationEvent.idl | 30 +-- Source/WebCore/dom/Document.cpp | 2 +- Source/WebCore/dom/Document.idl | 112 ++++++----- Source/WebCore/dom/Element.cpp | 84 ++++----- Source/WebCore/dom/Element.h | 6 +- Source/WebCore/dom/Element.idl | 52 ++++-- Source/WebCore/dom/Event.idl | 8 +- Source/WebCore/dom/HashChangeEvent.idl | 11 +- Source/WebCore/dom/KeyboardEvent.idl | 88 ++++----- Source/WebCore/dom/MessageEvent.idl | 49 ++--- Source/WebCore/dom/MouseEvent.idl | 31 +-- Source/WebCore/dom/MutationEvent.idl | 17 +- Source/WebCore/dom/NamedNodeMap.cpp | 11 +- Source/WebCore/dom/NamedNodeMap.h | 4 +- Source/WebCore/dom/NamedNodeMap.idl | 16 +- Source/WebCore/dom/Node.idl | 17 +- Source/WebCore/dom/NodeFilter.idl | 4 +- Source/WebCore/dom/NonElementParentNode.idl | 3 +- Source/WebCore/dom/OverflowEvent.idl | 6 +- Source/WebCore/dom/Range.idl | 20 +- Source/WebCore/dom/Text.idl | 6 +- Source/WebCore/dom/TextEvent.idl | 11 +- Source/WebCore/dom/TouchEvent.idl | 27 +-- Source/WebCore/dom/UIEvent.idl | 11 +- Source/WebCore/dom/WheelEvent.idl | 44 ++--- Source/WebCore/html/DOMFormData.idl | 6 +- Source/WebCore/html/HTMLAllCollection.idl | 2 +- Source/WebCore/html/HTMLAudioElement.idl | 2 +- Source/WebCore/html/HTMLCanvasElement.idl | 4 +- Source/WebCore/html/HTMLCollection.idl | 12 +- Source/WebCore/html/HTMLDocument.idl | 4 +- Source/WebCore/html/HTMLElement.cpp | 10 +- Source/WebCore/html/HTMLElement.h | 2 +- Source/WebCore/html/HTMLElement.idl | 10 +- .../html/HTMLFormControlsCollection.idl | 4 +- Source/WebCore/html/HTMLInputElement.idl | 6 +- Source/WebCore/html/HTMLMediaElement.idl | 10 +- Source/WebCore/html/HTMLOptionElement.idl | 2 +- Source/WebCore/html/HTMLOptionsCollection.idl | 11 +- Source/WebCore/html/HTMLSelectElement.idl | 10 +- Source/WebCore/html/HTMLTableElement.idl | 2 +- Source/WebCore/html/HTMLTableRowElement.idl | 2 +- .../WebCore/html/HTMLTableSectionElement.idl | 2 +- Source/WebCore/html/HTMLTextAreaElement.idl | 6 +- Source/WebCore/html/ImageData.idl | 5 +- Source/WebCore/html/canvas/CanvasGradient.idl | 6 +- .../html/canvas/CanvasRenderingContext2D.idl | 21 ++- Source/WebCore/html/canvas/DOMPath.idl | 60 +++--- .../html/canvas/OESVertexArrayObject.idl | 6 +- Source/WebCore/page/DOMSelection.cpp | 13 +- Source/WebCore/page/DOMSelection.h | 2 +- Source/WebCore/page/DOMSelection.idl | 19 +- Source/WebCore/page/DOMWindow.idl | 50 ++--- Source/WebCore/page/History.idl | 2 +- Source/WebCore/page/Performance.idl | 8 +- Source/WebCore/page/WindowTimers.idl | 8 +- Source/WebCore/plugins/DOMMimeTypeArray.idl | 6 +- Source/WebCore/plugins/DOMPlugin.idl | 6 +- Source/WebCore/plugins/DOMPluginArray.idl | 9 +- Source/WebCore/storage/StorageEvent.idl | 19 +- Source/WebCore/svg/SVGAnimationElement.idl | 4 +- Source/WebCore/svg/SVGDocument.idl | 3 +- Source/WebCore/svg/SVGElement.idl | 3 +- Source/WebCore/svg/SVGFEDropShadowElement.idl | 4 +- .../WebCore/svg/SVGFEGaussianBlurElement.idl | 4 +- Source/WebCore/svg/SVGFEMorphologyElement.idl | 4 +- Source/WebCore/svg/SVGFilterElement.idl | 4 +- Source/WebCore/svg/SVGGraphicsElement.idl | 2 +- Source/WebCore/svg/SVGMarkerElement.idl | 2 +- Source/WebCore/svg/SVGPathElement.idl | 120 ++++++------ Source/WebCore/svg/SVGSVGElement.idl | 19 +- Source/WebCore/svg/SVGTests.idl | 3 +- Source/WebCore/svg/SVGTextContentElement.idl | 17 +- Source/WebCore/xml/DOMParser.idl | 4 +- Source/WebCore/xml/XMLSerializer.cpp | 8 +- Source/WebCore/xml/XMLSerializer.h | 2 +- Source/WebCore/xml/XMLSerializer.idl | 2 +- Source/WebCore/xml/XPathEvaluator.idl | 18 +- Source/WebCore/xml/XPathExpression.idl | 2 +- Source/WebCore/xml/XPathNSResolver.idl | 3 +- Source/WebCore/xml/XPathResult.idl | 2 +- Source/WebCore/xml/XSLTProcessor.idl | 6 +- Tools/ChangeLog | 9 + .../InjectedBundle/Bindings/TestRunner.idl | 2 +- 145 files changed, 1367 insertions(+), 823 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 1c389e81ac2b..c0772d1aa9c4 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,18 @@ +2016-04-23 Chris Dumez + + [WebIDL] Drop [Default] WebKit-IDL extended attribute + https://bugs.webkit.org/show_bug.cgi?id=156955 + + Reviewed by Darin Adler. + + Rebaseline some tests now that a different exception type is thrown + for some of our APIs when passing null. + + * editing/selection/extend-expected.txt: + * fast/dom/Element/attr-param-typechecking-expected.txt: + * fast/dom/NamedNodeMap-setNamedItem-crash-expected.txt: + * fast/dynamic/insertAdjacentElement-expected.txt: + 2016-04-24 Filip Pizlo and Andy VanWagoner [INTL] Implement String.prototype.localeCompare in ECMA-402 diff --git a/LayoutTests/editing/selection/extend-expected.txt b/LayoutTests/editing/selection/extend-expected.txt index 558f7c4e3e73..32f538d8e54d 100644 --- a/LayoutTests/editing/selection/extend-expected.txt +++ b/LayoutTests/editing/selection/extend-expected.txt @@ -4,5 +4,5 @@ Success: s.extend(span2.firstChild, 4) raised Error: IndexSizeError: DOM Excepti 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 Error: TypeMismatchError: DOM Exception 17. -Success: s.extend(null, 0) raised Error: TypeMismatchError: DOM Exception 17. +Success: s.extend() raised TypeError: Type error. +Success: s.extend(null, 0) raised TypeError: Type error. diff --git a/LayoutTests/fast/dom/Element/attr-param-typechecking-expected.txt b/LayoutTests/fast/dom/Element/attr-param-typechecking-expected.txt index 77908cfd5131..54515538b6ce 100644 --- a/LayoutTests/fast/dom/Element/attr-param-typechecking-expected.txt +++ b/LayoutTests/fast/dom/Element/attr-param-typechecking-expected.txt @@ -3,18 +3,18 @@ This test checks whether passing wrong types to setAttributeNode causes a crash. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". -PASS element.setAttributeNode("style"); threw exception Error: TypeMismatchError: DOM Exception 17. -PASS element.setAttributeNode(null); threw exception Error: TypeMismatchError: DOM Exception 17. -PASS element.setAttributeNode(undefined); threw exception Error: TypeMismatchError: DOM Exception 17. -PASS element.setAttributeNode(new Object); threw exception Error: TypeMismatchError: DOM Exception 17. -PASS element.removeAttributeNode("style"); threw exception Error: TypeMismatchError: DOM Exception 17. -PASS element.removeAttributeNode(null); threw exception Error: TypeMismatchError: DOM Exception 17. -PASS element.removeAttributeNode(undefined); threw exception Error: TypeMismatchError: DOM Exception 17. -PASS element.removeAttributeNode(new Object); threw exception Error: TypeMismatchError: DOM Exception 17. -PASS element.setAttributeNodeNS("style"); threw exception Error: TypeMismatchError: DOM Exception 17. -PASS element.setAttributeNodeNS(null); threw exception Error: TypeMismatchError: DOM Exception 17. -PASS element.setAttributeNodeNS(undefined); threw exception Error: TypeMismatchError: DOM Exception 17. -PASS element.setAttributeNodeNS(new Object); threw exception Error: TypeMismatchError: DOM Exception 17. +PASS element.setAttributeNode("style"); threw exception TypeError: Type error. +PASS element.setAttributeNode(null); threw exception TypeError: Type error. +PASS element.setAttributeNode(undefined); threw exception TypeError: Type error. +PASS element.setAttributeNode(new Object); threw exception TypeError: Type error. +PASS element.removeAttributeNode("style"); threw exception TypeError: Type error. +PASS element.removeAttributeNode(null); threw exception TypeError: Type error. +PASS element.removeAttributeNode(undefined); threw exception TypeError: Type error. +PASS element.removeAttributeNode(new Object); threw exception TypeError: Type error. +PASS element.setAttributeNodeNS("style"); threw exception TypeError: Type error. +PASS element.setAttributeNodeNS(null); threw exception TypeError: Type error. +PASS element.setAttributeNodeNS(undefined); threw exception TypeError: Type error. +PASS element.setAttributeNodeNS(new Object); threw exception TypeError: Type error. PASS successfullyParsed is true TEST COMPLETE diff --git a/LayoutTests/fast/dom/NamedNodeMap-setNamedItem-crash-expected.txt b/LayoutTests/fast/dom/NamedNodeMap-setNamedItem-crash-expected.txt index 7b3c00994b50..038056b57293 100644 --- a/LayoutTests/fast/dom/NamedNodeMap-setNamedItem-crash-expected.txt +++ b/LayoutTests/fast/dom/NamedNodeMap-setNamedItem-crash-expected.txt @@ -1,2 +1,2 @@ -CONSOLE MESSAGE: line 7: NotFoundError: DOM Exception 8: An attempt was made to reference a Node in a context where it does not exist. +CONSOLE MESSAGE: line 7: TypeError: Type error This passes if it does not crash. (see https://bugs.webkit.org/show_bug.cgi?id=18958) diff --git a/LayoutTests/fast/dynamic/insertAdjacentElement-expected.txt b/LayoutTests/fast/dynamic/insertAdjacentElement-expected.txt index ea7055391669..33818ada3f62 100644 --- a/LayoutTests/fast/dynamic/insertAdjacentElement-expected.txt +++ b/LayoutTests/fast/dynamic/insertAdjacentElement-expected.txt @@ -1,5 +1,5 @@ Caught expected exception: Error: NotSupportedError: DOM Exception 9 -Caught expected exception: Error: TypeMismatchError: DOM Exception 17 +Caught expected exception: TypeError: Type error 1 (black) 2 (green) 3 (green) 4 (black) PASS diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog index ff256944d481..b514c343ea1b 100644 --- a/LayoutTests/imported/w3c/ChangeLog +++ b/LayoutTests/imported/w3c/ChangeLog @@ -1,3 +1,16 @@ +2016-04-23 Chris Dumez + + [WebIDL] Drop [Default] WebKit-IDL extended attribute + https://bugs.webkit.org/show_bug.cgi?id=156955 + + Reviewed by Darin Adler. + + Rebaseline some tests now that a different exception type is thrown + for some of our APIs when passing null. + + * web-platform-tests/dom/interfaces-expected.txt: + * web-platform-tests/html/dom/interfaces-expected.txt: + 2016-04-21 Chris Dumez Drop [UsePointersEvenForNonNullableObjectArguments] from Document diff --git a/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt index 0e9d1c120624..47e64da33346 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/dom/interfaces-expected.txt @@ -716,9 +716,9 @@ PASS Element interface: operation hasAttribute(DOMString) FAIL Element interface: operation hasAttributeNS(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0 FAIL Element interface: operation getAttributeNode(DOMString) assert_equals: property has wrong .length expected 1 but got 0 FAIL Element interface: operation getAttributeNodeNS(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0 -FAIL Element interface: operation setAttributeNode(Attr) assert_equals: property has wrong .length expected 1 but got 0 -FAIL Element interface: operation setAttributeNodeNS(Attr) assert_equals: property has wrong .length expected 1 but got 0 -FAIL Element interface: operation removeAttributeNode(Attr) assert_equals: property has wrong .length expected 1 but got 0 +PASS Element interface: operation setAttributeNode(Attr) +PASS Element interface: operation setAttributeNodeNS(Attr) +PASS Element interface: operation removeAttributeNode(Attr) PASS Element interface: operation closest(DOMString) PASS Element interface: operation matches(DOMString) FAIL Element interface: operation getElementsByTagName(DOMString) assert_equals: property has wrong .length expected 1 but got 0 @@ -788,17 +788,11 @@ FAIL Element interface: calling getAttributeNodeNS(DOMString,DOMString) on eleme fn.apply(obj, args); }" did not throw PASS Element interface: element must inherit property "setAttributeNode" with the proper type (19) -FAIL Element interface: calling setAttributeNode(Attr) on element with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () { - fn.apply(obj, args); - }" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError") +PASS Element interface: calling setAttributeNode(Attr) on element with too few arguments must throw TypeError PASS Element interface: element must inherit property "setAttributeNodeNS" with the proper type (20) -FAIL Element interface: calling setAttributeNodeNS(Attr) on element with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () { - fn.apply(obj, args); - }" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError") +PASS Element interface: calling setAttributeNodeNS(Attr) on element with too few arguments must throw TypeError PASS Element interface: element must inherit property "removeAttributeNode" with the proper type (21) -FAIL Element interface: calling removeAttributeNode(Attr) on element with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () { - fn.apply(obj, args); - }" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError") +PASS Element interface: calling removeAttributeNode(Attr) on element with too few arguments must throw TypeError PASS Element interface: element must inherit property "closest" with the proper type (22) PASS Element interface: calling closest(DOMString) on element with too few arguments must throw TypeError PASS Element interface: element must inherit property "matches" with the proper type (23) @@ -928,8 +922,8 @@ PASS NamedNodeMap interface: attribute length FAIL NamedNodeMap interface: operation item(unsigned long) assert_equals: property has wrong .length expected 1 but got 0 FAIL NamedNodeMap interface: operation getNamedItem(DOMString) assert_equals: property has wrong .length expected 1 but got 0 FAIL NamedNodeMap interface: operation getNamedItemNS(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0 -FAIL NamedNodeMap interface: operation setNamedItem(Attr) assert_equals: property has wrong .length expected 1 but got 0 -FAIL NamedNodeMap interface: operation setNamedItemNS(Attr) assert_equals: property has wrong .length expected 1 but got 0 +PASS NamedNodeMap interface: operation setNamedItem(Attr) +PASS NamedNodeMap interface: operation setNamedItemNS(Attr) FAIL NamedNodeMap interface: operation removeNamedItem(DOMString) assert_equals: property has wrong .length expected 1 but got 0 FAIL NamedNodeMap interface: operation removeNamedItemNS(DOMString,DOMString) assert_equals: property has wrong .length expected 2 but got 0 FAIL Attr interface: existence and properties of interface object assert_equals: prototype of self's property "Attr" is not Function.prototype expected function "function () { diff --git a/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt index 562021d96d1b..3cfdc9d0e433 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt @@ -1084,17 +1084,11 @@ FAIL Element interface: calling getAttributeNodeNS(DOMString,DOMString) on docum fn.apply(obj, args); }" did not throw PASS Element interface: document.createElement("noscript") must inherit property "setAttributeNode" with the proper type (19) -FAIL Element interface: calling setAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () { - fn.apply(obj, args); - }" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError") +PASS Element interface: calling setAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError PASS Element interface: document.createElement("noscript") must inherit property "setAttributeNodeNS" with the proper type (20) -FAIL Element interface: calling setAttributeNodeNS(Attr) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () { - fn.apply(obj, args); - }" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError") +PASS Element interface: calling setAttributeNodeNS(Attr) on document.createElement("noscript") with too few arguments must throw TypeError PASS Element interface: document.createElement("noscript") must inherit property "removeAttributeNode" with the proper type (21) -FAIL Element interface: calling removeAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () { - fn.apply(obj, args); - }" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError") +PASS Element interface: calling removeAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError PASS Element interface: document.createElement("noscript") must inherit property "closest" with the proper type (22) PASS Element interface: calling closest(DOMString) on document.createElement("noscript") with too few arguments must throw TypeError PASS Element interface: document.createElement("noscript") must inherit property "matches" with the proper type (23) diff --git a/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt b/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt index b63b82427abb..ee065c06e22d 100644 --- a/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt +++ b/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt @@ -1084,17 +1084,11 @@ FAIL Element interface: calling getAttributeNodeNS(DOMString,DOMString) on docum fn.apply(obj, args); }" did not throw PASS Element interface: document.createElement("noscript") must inherit property "setAttributeNode" with the proper type (19) -FAIL Element interface: calling setAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () { - fn.apply(obj, args); - }" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError") +PASS Element interface: calling setAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError PASS Element interface: document.createElement("noscript") must inherit property "setAttributeNodeNS" with the proper type (20) -FAIL Element interface: calling setAttributeNodeNS(Attr) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () { - fn.apply(obj, args); - }" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError") +PASS Element interface: calling setAttributeNodeNS(Attr) on document.createElement("noscript") with too few arguments must throw TypeError PASS Element interface: document.createElement("noscript") must inherit property "removeAttributeNode" with the proper type (21) -FAIL Element interface: calling removeAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () { - fn.apply(obj, args); - }" threw object "Error: TypeMismatchError: DOM Exception 17" ("TypeMismatchError") expected object "TypeError" ("TypeError") +PASS Element interface: calling removeAttributeNode(Attr) on document.createElement("noscript") with too few arguments must throw TypeError PASS Element interface: document.createElement("noscript") must inherit property "closest" with the proper type (22) PASS Element interface: calling closest(DOMString) on document.createElement("noscript") with too few arguments must throw TypeError PASS Element interface: document.createElement("noscript") must inherit property "matches" with the proper type (23) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index af68c118773f..374ed14a040a 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,179 @@ +2016-04-23 Chris Dumez + + [WebIDL] Drop [Default] WebKit-IDL extended attribute + https://bugs.webkit.org/show_bug.cgi?id=156955 + + Reviewed by Darin Adler. + + Drop [Default] WebKit-IDL extended attribute in favor of the standard + WebIDL syntax for parameters' default value. + + Here is what it looks like: + [Default=NullString] optional DOMString a -> optional DOMString a = null + [Default=NullString] optional DOMString? a -> optional DOMString? a = null + [Default=Undefined] optional DOMString a -> optional DOMString a = "undefined" + [Default=Undefined] optional DOMString? a -> optional DOMString? a = null + [Default=Undefined] optional long a -> optional long a = 0 + [Default=Undefined] optional bool a -> optional bool a = false + [Default=Undefined] optional unrestricted double a -> optional unrestricted double a = NaN + [Default=Undefined] optional unrestricted float a -> optional unrestricted float a = NaN + [Default=Undefined] optional sequence a -> optional sequence a = [] + + These do not cause any Web-Exposed behavior change. However, when getting + rid of [Default] started passing more parameters by derefence instead of + pointer (as is expected for parameters not marked as nullable). As a result, + I had to mark a few parameters as nullable in the IDL to maintain the + previous behavior. In some cases, the implementation was already throwing + when passing null. In such cases, I have not marked the type as nullable + so that the generated bindings now throw the exception instead of our + implementation code. In some cases, the exception being thrown is now + different. This is why some of the layout tests had to be rebaselined. + + No new tests, existing tests have been rebaselined. No significant Web + exposed behavior change is expected from this patch, beside exceptions + type sometimes being different. + + * Modules/encryptedmedia/MediaKeys.idl: + * Modules/fetch/FetchRequest.idl: + * Modules/gamepad/deprecated/GamepadList.idl: + * Modules/indexeddb/IDBDatabase.idl: + * Modules/mediastream/RTCStatsResponse.idl: + * Modules/notifications/Notification.idl: + * Modules/speech/SpeechSynthesisUtterance.idl: + * Modules/webaudio/AudioNode.idl: + * Modules/websockets/WebSocket.idl: + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateParametersCheck): + * bindings/scripts/IDLAttributes.txt: + * bindings/scripts/IDLParser.pm: + (parseDefault): + (parseDefaultValue): + * bindings/scripts/test/TestInterface.idl: + * bindings/scripts/test/TestNamedConstructor.idl: + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/TestOverrideBuiltins.idl: + * css/CSSKeyframesRule.idl: + * css/CSSMediaRule.idl: + * css/CSSPrimitiveValue.idl: + * css/CSSRuleList.idl: + * css/CSSStyleDeclaration.idl: + * css/CSSStyleSheet.idl: + * css/CSSSupportsRule.idl: + * css/CSSValueList.idl: + * css/MediaList.idl: + * css/MediaQueryList.idl: + * css/MediaQueryListListener.idl: + * css/StyleMedia.idl: + * css/StyleSheetList.idl: + * css/WebKitCSSFilterValue.idl: + * css/WebKitCSSMatrix.idl: + * css/WebKitCSSTransformValue.idl: + * dom/ClientRectList.idl: + * dom/Comment.idl: + * dom/CompositionEvent.idl: + * dom/CustomEvent.h: + * dom/CustomEvent.idl: + * dom/DOMImplementation.idl: + * dom/DOMStringList.idl: + * dom/DataTransferItem.idl: + * dom/DataTransferItemList.idl: + * dom/DeviceMotionEvent.idl: + * dom/DeviceOrientationEvent.idl: + * dom/Document.cpp: + (WebCore::Document::adoptNode): + * dom/Document.idl: + * dom/Element.cpp: + (WebCore::Element::setAttributeNode): + (WebCore::Element::setAttributeNodeNS): + (WebCore::Element::removeAttributeNode): + (WebCore::Element::parseAttributeName): Deleted. + * dom/Element.h: + * dom/Element.idl: + * dom/Event.idl: + * dom/HashChangeEvent.idl: + * dom/KeyboardEvent.idl: + * dom/MessageEvent.idl: + * dom/MouseEvent.idl: + * dom/MutationEvent.idl: + * dom/NamedNodeMap.cpp: + (WebCore::NamedNodeMap::setNamedItem): + (WebCore::NamedNodeMap::setNamedItemNS): + (WebCore::NamedNodeMap::item): Deleted. + * dom/NamedNodeMap.h: + * dom/NamedNodeMap.idl: + * dom/Node.idl: + * dom/NodeFilter.idl: + * dom/NonElementParentNode.idl: + * dom/OverflowEvent.idl: + * dom/Range.idl: + * dom/Text.idl: + * dom/TextEvent.idl: + * dom/TouchEvent.idl: + * dom/UIEvent.idl: + * dom/WheelEvent.idl: + * html/DOMFormData.idl: + * html/HTMLAllCollection.idl: + * html/HTMLAudioElement.idl: + * html/HTMLCanvasElement.idl: + * html/HTMLCollection.idl: + * html/HTMLDocument.idl: + * html/HTMLElement.cpp: + (WebCore::HTMLElement::insertAdjacentElement): + (WebCore::contextElementForInsertion): Deleted. + * html/HTMLElement.h: + * html/HTMLElement.idl: + * html/HTMLFormControlsCollection.idl: + * html/HTMLInputElement.idl: + * html/HTMLMediaElement.idl: + * html/HTMLOptionElement.idl: + * html/HTMLOptionsCollection.idl: + * html/HTMLSelectElement.idl: + * html/HTMLTableElement.idl: + * html/HTMLTableRowElement.idl: + * html/HTMLTableSectionElement.idl: + * html/HTMLTextAreaElement.idl: + * html/ImageData.idl: + * html/canvas/CanvasGradient.idl: + * html/canvas/CanvasRenderingContext2D.idl: + * html/canvas/DOMPath.idl: + * html/canvas/OESVertexArrayObject.idl: + * page/DOMSelection.cpp: + (WebCore::DOMSelection::extend): + (WebCore::DOMSelection::getRangeAt): Deleted. + * page/DOMSelection.h: + * page/DOMSelection.idl: + * page/DOMWindow.idl: + * page/History.idl: + * page/Performance.idl: + * page/WindowTimers.idl: + * plugins/DOMMimeTypeArray.idl: + * plugins/DOMPlugin.idl: + * plugins/DOMPluginArray.idl: + * storage/StorageEvent.idl: + * svg/SVGAnimationElement.idl: + * svg/SVGDocument.idl: + * svg/SVGElement.idl: + * svg/SVGFEDropShadowElement.idl: + * svg/SVGFEGaussianBlurElement.idl: + * svg/SVGFEMorphologyElement.idl: + * svg/SVGFilterElement.idl: + * svg/SVGGraphicsElement.idl: + * svg/SVGMarkerElement.idl: + * svg/SVGPathElement.idl: + * svg/SVGSVGElement.idl: + * svg/SVGTests.idl: + * svg/SVGTextContentElement.idl: + * xml/DOMParser.idl: + * xml/XMLSerializer.cpp: + (WebCore::XMLSerializer::serializeToString): + * xml/XMLSerializer.h: + * xml/XMLSerializer.idl: + * xml/XPathEvaluator.idl: + * xml/XPathExpression.idl: + * xml/XPathNSResolver.idl: + * xml/XPathResult.idl: + * xml/XSLTProcessor.idl: + 2016-04-24 Antti Koivisto RenderStyle should not be reference counted diff --git a/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl b/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl index bf9078a3d961..c84939f97d41 100644 --- a/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl +++ b/Source/WebCore/Modules/encryptedmedia/MediaKeys.idl @@ -29,7 +29,8 @@ ConstructorRaisesException, InterfaceName=WebKitMediaKeys, ] interface MediaKeys { - [CallWith=ScriptExecutionContext, RaisesException] MediaKeySession createSession([Default=Undefined] optional DOMString type, [Default=Undefined] optional Uint8Array initData); - static boolean isTypeSupported(DOMString keySystem, [Default=NullString] optional DOMString type); + // FIXME: The default value for the 'type' parameter is wrong. + [CallWith=ScriptExecutionContext, RaisesException] MediaKeySession createSession(optional DOMString type = "undefined", optional Uint8Array initData = null); + static boolean isTypeSupported(DOMString keySystem, optional DOMString type = null); readonly attribute DOMString keySystem; }; diff --git a/Source/WebCore/Modules/fetch/FetchRequest.idl b/Source/WebCore/Modules/fetch/FetchRequest.idl index 73eaa44ae32b..de479e7a406d 100644 --- a/Source/WebCore/Modules/fetch/FetchRequest.idl +++ b/Source/WebCore/Modules/fetch/FetchRequest.idl @@ -40,8 +40,8 @@ enum ReferrerPolicy { "", "no-referrer", "no-referrer-when-downgrade", "origin- EnabledAtRuntime=FetchAPI, ConstructorCallWith=ScriptExecutionContext, ConstructorRaisesException, - Constructor(FetchRequest input, [Default=Undefined] optional Dictionary init), - Constructor(DOMString input, [Default=Undefined] optional Dictionary init), + Constructor(FetchRequest input, optional Dictionary init), + Constructor(DOMString input, optional Dictionary init), Exposed=(Window,Worker), InterfaceName=Request ] diff --git a/Source/WebCore/Modules/gamepad/deprecated/GamepadList.idl b/Source/WebCore/Modules/gamepad/deprecated/GamepadList.idl index 8d58346f92fb..97a83e7f8b20 100644 --- a/Source/WebCore/Modules/gamepad/deprecated/GamepadList.idl +++ b/Source/WebCore/Modules/gamepad/deprecated/GamepadList.idl @@ -29,6 +29,6 @@ ImplementationLacksVTable, ] interface GamepadList { readonly attribute unsigned long length; - getter Gamepad item([Default=Undefined] optional unsigned long index); + getter Gamepad item(optional unsigned long index = 0); }; diff --git a/Source/WebCore/Modules/indexeddb/IDBDatabase.idl b/Source/WebCore/Modules/indexeddb/IDBDatabase.idl index c37967c6554a..600dcc8f205b 100644 --- a/Source/WebCore/Modules/indexeddb/IDBDatabase.idl +++ b/Source/WebCore/Modules/indexeddb/IDBDatabase.idl @@ -36,8 +36,8 @@ [Custom, RaisesExceptionWithMessage] IDBObjectStore createObjectStore(DOMString name, optional Dictionary options); [RaisesExceptionWithMessage] void deleteObjectStore(DOMString name); - [Custom, CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBTransaction transaction(DOMString storeName, [Default=NullString] optional DOMString mode); - [Custom, CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBTransaction transaction(sequence storeNames, [Default=NullString] optional DOMString mode); + [Custom, CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBTransaction transaction(DOMString storeName, optional DOMString mode = null); + [Custom, CallWith=ScriptExecutionContext, RaisesExceptionWithMessage] IDBTransaction transaction(sequence storeNames, optional DOMString mode = null); void close(); attribute EventHandler onabort; diff --git a/Source/WebCore/Modules/mediastream/RTCStatsResponse.idl b/Source/WebCore/Modules/mediastream/RTCStatsResponse.idl index 618b31a4590f..2bceb077419d 100644 --- a/Source/WebCore/Modules/mediastream/RTCStatsResponse.idl +++ b/Source/WebCore/Modules/mediastream/RTCStatsResponse.idl @@ -27,5 +27,6 @@ Conditional=WEB_RTC, ] interface RTCStatsResponse { sequence result(); - getter RTCStatsReport namedItem([Default=Undefined] optional DOMString name); + // FIXME: The default parameter value is wrong. + getter RTCStatsReport namedItem(optional DOMString name = "undefined"); }; diff --git a/Source/WebCore/Modules/notifications/Notification.idl b/Source/WebCore/Modules/notifications/Notification.idl index 514266a60a29..421793f18828 100644 --- a/Source/WebCore/Modules/notifications/Notification.idl +++ b/Source/WebCore/Modules/notifications/Notification.idl @@ -34,7 +34,7 @@ ActiveDOMObject, ExportMacro=WEBCORE_EXPORT, #if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS - Constructor(DOMString title, [Default=Undefined] optional Dictionary options), + Constructor(DOMString title, optional Dictionary options), ConstructorCallWith=Document, #endif ] interface Notification : EventTarget { diff --git a/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.idl b/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.idl index cf4373e6abd1..27c39518ab48 100644 --- a/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.idl +++ b/Source/WebCore/Modules/speech/SpeechSynthesisUtterance.idl @@ -26,7 +26,7 @@ [ Conditional=SPEECH_SYNTHESIS, ConstructorCallWith=ScriptExecutionContext, - Constructor([Default=NullString] optional DOMString text) + Constructor(optional DOMString text = null) ] interface SpeechSynthesisUtterance : EventTarget { attribute DOMString text; attribute DOMString lang; diff --git a/Source/WebCore/Modules/webaudio/AudioNode.idl b/Source/WebCore/Modules/webaudio/AudioNode.idl index ab699d0a86ad..9923a10eed04 100644 --- a/Source/WebCore/Modules/webaudio/AudioNode.idl +++ b/Source/WebCore/Modules/webaudio/AudioNode.idl @@ -34,7 +34,7 @@ [SetterRaisesException] attribute DOMString channelCountMode; [SetterRaisesException] attribute DOMString channelInterpretation; - [RaisesException] void connect(AudioNode? destination, [Default=Undefined] optional unsigned long output, [Default=Undefined] optional unsigned long input); - [RaisesException] void connect(AudioParam? destination, [Default=Undefined] optional unsigned long output); - [RaisesException] void disconnect([Default=Undefined] optional unsigned long output); + [RaisesException] void connect(AudioNode? destination, optional unsigned long output = 0, optional unsigned long input = 0); + [RaisesException] void connect(AudioParam? destination, optional unsigned long output = 0); + [RaisesException] void disconnect(optional unsigned long output = 0); }; diff --git a/Source/WebCore/Modules/websockets/WebSocket.idl b/Source/WebCore/Modules/websockets/WebSocket.idl index 29e6473cb196..92900f6a43c4 100644 --- a/Source/WebCore/Modules/websockets/WebSocket.idl +++ b/Source/WebCore/Modules/websockets/WebSocket.idl @@ -32,7 +32,7 @@ [ ActiveDOMObject, Conditional=WEB_SOCKETS, - Constructor(DOMString url, [Default=Undefined] optional sequence? protocols), + Constructor(DOMString url, optional sequence protocols = []), Constructor(DOMString url, DOMString protocol), ConstructorRaisesException, ConstructorCallWith=ScriptExecutionContext, diff --git a/Source/WebCore/bindings/scripts/CodeGenerator.pm b/Source/WebCore/bindings/scripts/CodeGenerator.pm index 97ba87c2b3c5..248537c866e3 100644 --- a/Source/WebCore/bindings/scripts/CodeGenerator.pm +++ b/Source/WebCore/bindings/scripts/CodeGenerator.pm @@ -894,7 +894,6 @@ sub ShouldPassWrapperByReference return 0 if $parameter->isVariadic; return 0 if $parameter->isNullable; - return 0 if $parameter->isOptional and $parameter->extendedAttributes->{"Default"} and $parameter->extendedAttributes->{"Default"} eq "Undefined"; return 0 if !$object->IsWrapperType($parameter->type) && !$object->IsTypedArrayType($parameter->type); return 0 if $object->IsSVGTypeNeedingTearOff($parameter->type); return 0 if $interface->extendedAttributes->{"UsePointersEvenForNonNullableObjectArguments"}; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index 1f1dab639ff8..cf7f19abc936 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -3419,8 +3419,7 @@ sub GenerateParametersCheck # Optional arguments with [Optional=...] should not generate the early call. # Optional Dictionary arguments always considered to have default of empty dictionary. my $optional = $parameter->isOptional; - my $defaultAttribute = $parameter->extendedAttributes->{"Default"}; - if ($optional && !$defaultAttribute && $argType ne "Dictionary" && !$codeGenerator->IsCallbackInterface($argType)) { + if ($optional && !defined($parameter->default) && $argType ne "Dictionary" && !$codeGenerator->IsCallbackInterface($argType)) { # Generate early call if there are enough parameters. if (!$hasOptionalArguments) { push(@$outputArray, "\n size_t argsCount = state->argumentCount();\n"); @@ -3537,7 +3536,7 @@ sub GenerateParametersCheck }; my $argValue = "state->argument($argsIndex)"; - if ($parameter->isOptional && $parameter->default) { + if ($parameter->isOptional && defined($parameter->default)) { push(@$outputArray, " String $name;\n"); push(@$outputArray, " if (${argValue}.isUndefined())\n"); push(@$outputArray, " $name = ASCIILiteral(" . $parameter->default . ");\n"); @@ -3577,11 +3576,26 @@ sub GenerateParametersCheck } else { my $outer; my $inner; - if ($optional && $defaultAttribute && $defaultAttribute eq "NullString") { - $outer = "state->argument($argsIndex).isUndefined() ? String() : "; - $inner = "state->uncheckedArgument($argsIndex)"; - } elsif ($optional && $parameter->default) { - $outer = "state->argument($argsIndex).isUndefined() ? " . $parameter->default . " : "; + if ($optional && defined($parameter->default)) { + my $defaultValue = $parameter->default; + + # String-related optimizations. + if ($parameter->type eq "DOMString") { + my $useAtomicString = $parameter->extendedAttributes->{"AtomicString"}; + if ($defaultValue eq "null") { + $defaultValue = $useAtomicString ? "nullAtom" : "String()"; + } elsif ($defaultValue eq "\"\"") { + $defaultValue = $useAtomicString ? "emptyAtom" : "emptyString()"; + } else { + $defaultValue = $useAtomicString ? "AtomicString($defaultValue, AtomicString::ConstructFromLiteral)" : "ASCIILiteral($defaultValue)"; + } + } else { + $defaultValue = "nullptr" if $defaultValue eq "null"; + $defaultValue = "PNaN" if $defaultValue eq "NaN"; + $defaultValue = GetNativeTypeFromSignature($parameter) . "()" if $defaultValue eq "[]"; + } + + $outer = "state->argument($argsIndex).isUndefined() ? $defaultValue : "; $inner = "state->uncheckedArgument($argsIndex)"; } else { $outer = ""; diff --git a/Source/WebCore/bindings/scripts/IDLAttributes.txt b/Source/WebCore/bindings/scripts/IDLAttributes.txt index b82708af968f..ff2ebc2d77ef 100644 --- a/Source/WebCore/bindings/scripts/IDLAttributes.txt +++ b/Source/WebCore/bindings/scripts/IDLAttributes.txt @@ -50,7 +50,6 @@ CustomPutFunction CustomReturn CustomSetter CustomToJSObject -Default=NullString|Undefined Deletable DoNotCheckConstants DoNotCheckSecurity diff --git a/Source/WebCore/bindings/scripts/IDLParser.pm b/Source/WebCore/bindings/scripts/IDLParser.pm index a74aaabf3a82..db15f186fcbb 100644 --- a/Source/WebCore/bindings/scripts/IDLParser.pm +++ b/Source/WebCore/bindings/scripts/IDLParser.pm @@ -689,6 +689,7 @@ sub parseDefault $self->assertTokenValue($self->getToken(), "=", __LINE__); return $self->parseDefaultValue(); } + return undef; } sub parseDefaultValue @@ -701,6 +702,11 @@ sub parseDefaultValue if ($next->type() == StringToken) { return $self->getToken()->value(); } + if ($next->value() eq "[") { + $self->assertTokenValue($self->getToken(), "[", __LINE__); + $self->assertTokenValue($self->getToken(), "]", __LINE__); + return "[]"; + } $self->assertUnexpectedToken($next->value(), __LINE__); } diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index 88a2bccf0d79..7119a858286f 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -1562,6 +1562,16 @@ void webkit_dom_test_obj_method_with_optional_string(WebKitDOMTestObj* self, con item->methodWithOptionalString(convertedStr); } +void webkit_dom_test_obj_method_with_optional_atomic_string(WebKitDOMTestObj* self, const gchar* str) +{ + WebCore::JSMainThreadNullState state; + g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); + g_return_if_fail(str); + WebCore::TestObj* item = WebKit::core(self); + WTF::String convertedStr = WTF::String::fromUTF8(str); + item->methodWithOptionalAtomicString(convertedStr); +} + void webkit_dom_test_obj_method_with_optional_string_and_default_value(WebKitDOMTestObj* self, const gchar* str) { WebCore::JSMainThreadNullState state; @@ -1572,24 +1582,70 @@ void webkit_dom_test_obj_method_with_optional_string_and_default_value(WebKitDOM item->methodWithOptionalStringAndDefaultValue(convertedStr); } -void webkit_dom_test_obj_method_with_optional_string_is_undefined(WebKitDOMTestObj* self, const gchar* str) +void webkit_dom_test_obj_method_with_optional_atomic_string_and_default_value(WebKitDOMTestObj* self, const gchar* str) +{ + WebCore::JSMainThreadNullState state; + g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); + g_return_if_fail(str); + WebCore::TestObj* item = WebKit::core(self); + WTF::String convertedStr = WTF::String::fromUTF8(str); + item->methodWithOptionalAtomicStringAndDefaultValue(convertedStr); +} + +void webkit_dom_test_obj_method_with_optional_string_is_null(WebKitDOMTestObj* self, const gchar* str) +{ + WebCore::JSMainThreadNullState state; + g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); + g_return_if_fail(str); + WebCore::TestObj* item = WebKit::core(self); + WTF::String convertedStr = WTF::String::fromUTF8(str); + item->methodWithOptionalStringIsNull(convertedStr); +} + +void webkit_dom_test_obj_method_with_optional_atomic_string_is_null(WebKitDOMTestObj* self, const gchar* str) { WebCore::JSMainThreadNullState state; g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); g_return_if_fail(str); WebCore::TestObj* item = WebKit::core(self); WTF::String convertedStr = WTF::String::fromUTF8(str); - item->methodWithOptionalStringIsUndefined(convertedStr); + item->methodWithOptionalAtomicStringIsNull(convertedStr); } -void webkit_dom_test_obj_method_with_optional_string_is_null_string(WebKitDOMTestObj* self, const gchar* str) +void webkit_dom_test_obj_method_with_optional_string_is_empty_string(WebKitDOMTestObj* self, const gchar* str) { WebCore::JSMainThreadNullState state; g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); g_return_if_fail(str); WebCore::TestObj* item = WebKit::core(self); WTF::String convertedStr = WTF::String::fromUTF8(str); - item->methodWithOptionalStringIsNullString(convertedStr); + item->methodWithOptionalStringIsEmptyString(convertedStr); +} + +void webkit_dom_test_obj_method_with_optional_atomic_string_is_empty_string(WebKitDOMTestObj* self, const gchar* str) +{ + WebCore::JSMainThreadNullState state; + g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); + g_return_if_fail(str); + WebCore::TestObj* item = WebKit::core(self); + WTF::String convertedStr = WTF::String::fromUTF8(str); + item->methodWithOptionalAtomicStringIsEmptyString(convertedStr); +} + +void webkit_dom_test_obj_method_with_optional_double_is_na_n(WebKitDOMTestObj* self, gdouble number) +{ + WebCore::JSMainThreadNullState state; + g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); + WebCore::TestObj* item = WebKit::core(self); + item->methodWithOptionalDoubleIsNaN(number); +} + +void webkit_dom_test_obj_method_with_optional_float_is_na_n(WebKitDOMTestObj* self, gfloat number) +{ + WebCore::JSMainThreadNullState state; + g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); + WebCore::TestObj* item = WebKit::core(self); + item->methodWithOptionalFloatIsNaN(number); } gchar* webkit_dom_test_obj_conditional_method1(WebKitDOMTestObj* self) diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index de91e295b46d..fd407f9d9213 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -518,6 +518,16 @@ webkit_dom_test_obj_method_with_non_optional_arg_and_two_optional_args(WebKitDOM WEBKIT_API void webkit_dom_test_obj_method_with_optional_string(WebKitDOMTestObj* self, const gchar* str); +/** + * webkit_dom_test_obj_method_with_optional_atomic_string: + * @self: A #WebKitDOMTestObj + * @str: A #gchar + * + * Stability: Unstable +**/ +WEBKIT_API void +webkit_dom_test_obj_method_with_optional_atomic_string(WebKitDOMTestObj* self, const gchar* str); + /** * webkit_dom_test_obj_method_with_optional_string_and_default_value: * @self: A #WebKitDOMTestObj @@ -529,24 +539,74 @@ WEBKIT_API void webkit_dom_test_obj_method_with_optional_string_and_default_value(WebKitDOMTestObj* self, const gchar* str); /** - * webkit_dom_test_obj_method_with_optional_string_is_undefined: + * webkit_dom_test_obj_method_with_optional_atomic_string_and_default_value: + * @self: A #WebKitDOMTestObj + * @str: A #gchar + * + * Stability: Unstable +**/ +WEBKIT_API void +webkit_dom_test_obj_method_with_optional_atomic_string_and_default_value(WebKitDOMTestObj* self, const gchar* str); + +/** + * webkit_dom_test_obj_method_with_optional_string_is_null: + * @self: A #WebKitDOMTestObj + * @str: A #gchar + * + * Stability: Unstable +**/ +WEBKIT_API void +webkit_dom_test_obj_method_with_optional_string_is_null(WebKitDOMTestObj* self, const gchar* str); + +/** + * webkit_dom_test_obj_method_with_optional_atomic_string_is_null: + * @self: A #WebKitDOMTestObj + * @str: A #gchar + * + * Stability: Unstable +**/ +WEBKIT_API void +webkit_dom_test_obj_method_with_optional_atomic_string_is_null(WebKitDOMTestObj* self, const gchar* str); + +/** + * webkit_dom_test_obj_method_with_optional_string_is_empty_string: * @self: A #WebKitDOMTestObj * @str: A #gchar * * Stability: Unstable **/ WEBKIT_API void -webkit_dom_test_obj_method_with_optional_string_is_undefined(WebKitDOMTestObj* self, const gchar* str); +webkit_dom_test_obj_method_with_optional_string_is_empty_string(WebKitDOMTestObj* self, const gchar* str); /** - * webkit_dom_test_obj_method_with_optional_string_is_null_string: + * webkit_dom_test_obj_method_with_optional_atomic_string_is_empty_string: * @self: A #WebKitDOMTestObj * @str: A #gchar * * Stability: Unstable **/ WEBKIT_API void -webkit_dom_test_obj_method_with_optional_string_is_null_string(WebKitDOMTestObj* self, const gchar* str); +webkit_dom_test_obj_method_with_optional_atomic_string_is_empty_string(WebKitDOMTestObj* self, const gchar* str); + +/** + * webkit_dom_test_obj_method_with_optional_double_is_na_n: + * @self: A #WebKitDOMTestObj + * @number: A #gdouble + * + * Stability: Unstable +**/ +WEBKIT_API void +webkit_dom_test_obj_method_with_optional_double_is_na_n(WebKitDOMTestObj* self, gdouble number); + +/** + * webkit_dom_test_obj_method_with_optional_float_is_na_n: + * @self: A #WebKitDOMTestObj + * @number: A #gfloat + * + * Stability: Unstable +**/ +WEBKIT_API void +webkit_dom_test_obj_method_with_optional_float_is_na_n(WebKitDOMTestObj* self, gfloat number); /** * webkit_dom_test_obj_conditional_method1: diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index 77bbffba2b8b..89f4d859cb03 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -231,7 +231,7 @@ template<> EncodedJSValue JSC_HOST_CALL JSTestInterfaceConstructor::construct(Ex String str1 = state->argument(0).toString(state)->value(state); if (UNLIKELY(state->hadException())) return JSValue::encode(jsUndefined()); - String str2 = state->argument(1).toString(state)->value(state); + String str2 = state->argument(1).isUndefined() ? ASCIILiteral("defaultString") : state->uncheckedArgument(1).toString(state)->value(state); if (UNLIKELY(state->hadException())) return JSValue::encode(jsUndefined()); ScriptExecutionContext* context = castedThis->scriptExecutionContext(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp index 231587575b23..49bd177cd60b 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp @@ -89,7 +89,7 @@ template<> EncodedJSValue JSC_HOST_CALL JSTestNamedConstructorNamedConstructor:: String str1 = state->argument(0).toString(state)->value(state); if (UNLIKELY(state->hadException())) return JSValue::encode(jsUndefined()); - String str2 = state->argument(1).toString(state)->value(state); + String str2 = state->argument(1).isUndefined() ? ASCIILiteral("defaultString") : state->uncheckedArgument(1).toString(state)->value(state); if (UNLIKELY(state->hadException())) return JSValue::encode(jsUndefined()); String str3 = state->argument(2).isUndefined() ? String() : state->uncheckedArgument(2).toString(state)->value(state); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 2240d92862d9..6b454f5c6579 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -138,9 +138,16 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAr JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalString(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAtomicString(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue(JSC::ExecState*); -JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined(JSC::ExecState*); -JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsNullString(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringAndDefaultValue(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsNull(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsNull(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsEmptyString(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsEmptyString(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalSequence(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*); @@ -690,9 +697,16 @@ static const HashTableValue JSTestObjPrototypeTableValues[] = { "methodWithNonOptionalArgAndOptionalArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t) (1) } }, { "methodWithNonOptionalArgAndTwoOptionalArgs", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t) (1) } }, { "methodWithOptionalString", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalString), (intptr_t) (0) } }, + { "methodWithOptionalAtomicString", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalAtomicString), (intptr_t) (0) } }, { "methodWithOptionalStringAndDefaultValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue), (intptr_t) (0) } }, - { "methodWithOptionalStringIsUndefined", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined), (intptr_t) (0) } }, - { "methodWithOptionalStringIsNullString", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalStringIsNullString), (intptr_t) (0) } }, + { "methodWithOptionalAtomicStringAndDefaultValue", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringAndDefaultValue), (intptr_t) (0) } }, + { "methodWithOptionalStringIsNull", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalStringIsNull), (intptr_t) (0) } }, + { "methodWithOptionalAtomicStringIsNull", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsNull), (intptr_t) (0) } }, + { "methodWithOptionalStringIsEmptyString", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalStringIsEmptyString), (intptr_t) (0) } }, + { "methodWithOptionalAtomicStringIsEmptyString", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsEmptyString), (intptr_t) (0) } }, + { "methodWithOptionalDoubleIsNaN", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN), (intptr_t) (0) } }, + { "methodWithOptionalFloatIsNaN", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN), (intptr_t) (0) } }, + { "methodWithOptionalSequence", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalSequence), (intptr_t) (0) } }, { "methodWithCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithCallbackArg), (intptr_t) (1) } }, { "methodWithNonCallbackArgAndCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg), (intptr_t) (2) } }, { "methodWithCallbackAndOptionalArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg), (intptr_t) (0) } }, @@ -3624,13 +3638,6 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalEnumArg return throwThisTypeError(*state, "TestObj", "methodWithOptionalEnumArgAndDefaultValue"); ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); auto& impl = castedThis->wrapped(); - - size_t argsCount = state->argumentCount(); - if (argsCount <= 0) { - impl.methodWithOptionalEnumArgAndDefaultValue(); - return JSValue::encode(jsUndefined()); - } - String enumArg; if (state->argument(0).isUndefined()) enumArg = ASCIILiteral("EnumValue1"); @@ -3986,13 +3993,6 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArgAndD return throwThisTypeError(*state, "TestObj", "methodWithOptionalArgAndDefaultValue"); ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); auto& impl = castedThis->wrapped(); - - size_t argsCount = state->argumentCount(); - if (argsCount <= 0) { - impl.methodWithOptionalArgAndDefaultValue(); - return JSValue::encode(jsUndefined()); - } - int opt = state->argument(0).isUndefined() ? 666 : toInt32(state, state->uncheckedArgument(0), NormalConversion); if (UNLIKELY(state->hadException())) return JSValue::encode(jsUndefined()); @@ -4084,55 +4084,160 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalString( return JSValue::encode(jsUndefined()); } -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue(ExecState* state) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAtomicString(ExecState* state) { JSValue thisValue = state->thisValue(); auto castedThis = jsDynamicCast(thisValue); if (UNLIKELY(!castedThis)) - return throwThisTypeError(*state, "TestObj", "methodWithOptionalStringAndDefaultValue"); + return throwThisTypeError(*state, "TestObj", "methodWithOptionalAtomicString"); ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); auto& impl = castedThis->wrapped(); size_t argsCount = state->argumentCount(); if (argsCount <= 0) { - impl.methodWithOptionalStringAndDefaultValue(); + impl.methodWithOptionalAtomicString(); return JSValue::encode(jsUndefined()); } - String str = state->argument(0).isUndefined() ? "foo" : state->uncheckedArgument(0).toString(state)->value(state); + String str = state->argument(0).toString(state)->toAtomicString(state); + if (UNLIKELY(state->hadException())) + return JSValue::encode(jsUndefined()); + impl.methodWithOptionalAtomicString(str); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue(ExecState* state) +{ + JSValue thisValue = state->thisValue(); + auto castedThis = jsDynamicCast(thisValue); + if (UNLIKELY(!castedThis)) + return throwThisTypeError(*state, "TestObj", "methodWithOptionalStringAndDefaultValue"); + ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); + auto& impl = castedThis->wrapped(); + String str = state->argument(0).isUndefined() ? ASCIILiteral("foo") : state->uncheckedArgument(0).toString(state)->value(state); if (UNLIKELY(state->hadException())) return JSValue::encode(jsUndefined()); impl.methodWithOptionalStringAndDefaultValue(str); return JSValue::encode(jsUndefined()); } -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined(ExecState* state) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringAndDefaultValue(ExecState* state) { JSValue thisValue = state->thisValue(); auto castedThis = jsDynamicCast(thisValue); if (UNLIKELY(!castedThis)) - return throwThisTypeError(*state, "TestObj", "methodWithOptionalStringIsUndefined"); + return throwThisTypeError(*state, "TestObj", "methodWithOptionalAtomicStringAndDefaultValue"); ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); auto& impl = castedThis->wrapped(); - String str = state->argument(0).toString(state)->value(state); + String str = state->argument(0).isUndefined() ? AtomicString("foo", AtomicString::ConstructFromLiteral) : state->uncheckedArgument(0).toString(state)->toAtomicString(state); if (UNLIKELY(state->hadException())) return JSValue::encode(jsUndefined()); - impl.methodWithOptionalStringIsUndefined(str); + impl.methodWithOptionalAtomicStringAndDefaultValue(str); return JSValue::encode(jsUndefined()); } -EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsNullString(ExecState* state) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsNull(ExecState* state) { JSValue thisValue = state->thisValue(); auto castedThis = jsDynamicCast(thisValue); if (UNLIKELY(!castedThis)) - return throwThisTypeError(*state, "TestObj", "methodWithOptionalStringIsNullString"); + return throwThisTypeError(*state, "TestObj", "methodWithOptionalStringIsNull"); ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); auto& impl = castedThis->wrapped(); String str = state->argument(0).isUndefined() ? String() : state->uncheckedArgument(0).toString(state)->value(state); if (UNLIKELY(state->hadException())) return JSValue::encode(jsUndefined()); - impl.methodWithOptionalStringIsNullString(str); + impl.methodWithOptionalStringIsNull(str); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsNull(ExecState* state) +{ + JSValue thisValue = state->thisValue(); + auto castedThis = jsDynamicCast(thisValue); + if (UNLIKELY(!castedThis)) + return throwThisTypeError(*state, "TestObj", "methodWithOptionalAtomicStringIsNull"); + ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); + auto& impl = castedThis->wrapped(); + String str = state->argument(0).isUndefined() ? nullAtom : state->uncheckedArgument(0).toString(state)->toAtomicString(state); + if (UNLIKELY(state->hadException())) + return JSValue::encode(jsUndefined()); + impl.methodWithOptionalAtomicStringIsNull(str); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsEmptyString(ExecState* state) +{ + JSValue thisValue = state->thisValue(); + auto castedThis = jsDynamicCast(thisValue); + if (UNLIKELY(!castedThis)) + return throwThisTypeError(*state, "TestObj", "methodWithOptionalStringIsEmptyString"); + ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); + auto& impl = castedThis->wrapped(); + String str = state->argument(0).isUndefined() ? emptyString() : state->uncheckedArgument(0).toString(state)->value(state); + if (UNLIKELY(state->hadException())) + return JSValue::encode(jsUndefined()); + impl.methodWithOptionalStringIsEmptyString(str); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAtomicStringIsEmptyString(ExecState* state) +{ + JSValue thisValue = state->thisValue(); + auto castedThis = jsDynamicCast(thisValue); + if (UNLIKELY(!castedThis)) + return throwThisTypeError(*state, "TestObj", "methodWithOptionalAtomicStringIsEmptyString"); + ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); + auto& impl = castedThis->wrapped(); + String str = state->argument(0).isUndefined() ? emptyAtom : state->uncheckedArgument(0).toString(state)->toAtomicString(state); + if (UNLIKELY(state->hadException())) + return JSValue::encode(jsUndefined()); + impl.methodWithOptionalAtomicStringIsEmptyString(str); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN(ExecState* state) +{ + JSValue thisValue = state->thisValue(); + auto castedThis = jsDynamicCast(thisValue); + if (UNLIKELY(!castedThis)) + return throwThisTypeError(*state, "TestObj", "methodWithOptionalDoubleIsNaN"); + ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); + auto& impl = castedThis->wrapped(); + double number = state->argument(0).isUndefined() ? PNaN : state->uncheckedArgument(0).toNumber(state); + if (UNLIKELY(state->hadException())) + return JSValue::encode(jsUndefined()); + impl.methodWithOptionalDoubleIsNaN(number); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN(ExecState* state) +{ + JSValue thisValue = state->thisValue(); + auto castedThis = jsDynamicCast(thisValue); + if (UNLIKELY(!castedThis)) + return throwThisTypeError(*state, "TestObj", "methodWithOptionalFloatIsNaN"); + ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); + auto& impl = castedThis->wrapped(); + float number = state->argument(0).isUndefined() ? PNaN : state->uncheckedArgument(0).toFloat(state); + if (UNLIKELY(state->hadException())) + return JSValue::encode(jsUndefined()); + impl.methodWithOptionalFloatIsNaN(number); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalSequence(ExecState* state) +{ + JSValue thisValue = state->thisValue(); + auto castedThis = jsDynamicCast(thisValue); + if (UNLIKELY(!castedThis)) + return throwThisTypeError(*state, "TestObj", "methodWithOptionalSequence"); + ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); + auto& impl = castedThis->wrapped(); + Vector sequence = state->argument(0).isUndefined() ? Vector() : toNativeArray(state, state->uncheckedArgument(0)); + if (UNLIKELY(state->hadException())) + return JSValue::encode(jsUndefined()); + impl.methodWithOptionalSequence(sequence); return JSValue::encode(jsUndefined()); } diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp index 50b18c65fcb8..299ee41e08bd 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp @@ -200,7 +200,7 @@ EncodedJSValue JSC_HOST_CALL jsTestOverrideBuiltinsPrototypeFunctionNamedItem(Ex return throwThisTypeError(*state, "TestOverrideBuiltins", "namedItem"); ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestOverrideBuiltins::info()); auto& impl = castedThis->wrapped(); - String name = state->argument(0).toString(state)->value(state); + String name = state->argument(0).isUndefined() ? ASCIILiteral("test") : state->uncheckedArgument(0).toString(state)->value(state); if (UNLIKELY(state->hadException())) return JSValue::encode(jsUndefined()); JSValue result = toJS(state, castedThis->globalObject(), WTF::getPtr(impl.namedItem(name))); diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h index f5596ff57243..df93719bdf72 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -175,9 +175,15 @@ WEBCORE_EXPORT @interface DOMTestObj : DOMObject - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt; - (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2; - (void)methodWithOptionalString:(NSString *)str; +- (void)methodWithOptionalAtomicString:(NSString *)str; - (void)methodWithOptionalStringAndDefaultValue:(NSString *)str; -- (void)methodWithOptionalStringIsUndefined:(NSString *)str; -- (void)methodWithOptionalStringIsNullString:(NSString *)str; +- (void)methodWithOptionalAtomicStringAndDefaultValue:(NSString *)str; +- (void)methodWithOptionalStringIsNull:(NSString *)str; +- (void)methodWithOptionalAtomicStringIsNull:(NSString *)str; +- (void)methodWithOptionalStringIsEmptyString:(NSString *)str; +- (void)methodWithOptionalAtomicStringIsEmptyString:(NSString *)str; +- (void)methodWithOptionalDoubleIsNaN:(double)number; +- (void)methodWithOptionalFloatIsNaN:(float)number; - (void)classMethod; - (int)classMethodWithOptional:(int)arg; - (void)classMethod2:(int)arg; diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm index 5894c548ca65..67bf45d0b46a 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -1262,22 +1262,58 @@ - (void)methodWithOptionalString:(NSString *)str IMPL->methodWithOptionalString(str); } +- (void)methodWithOptionalAtomicString:(NSString *)str +{ + WebCore::JSMainThreadNullState state; + IMPL->methodWithOptionalAtomicString(str); +} + - (void)methodWithOptionalStringAndDefaultValue:(NSString *)str { WebCore::JSMainThreadNullState state; IMPL->methodWithOptionalStringAndDefaultValue(str); } -- (void)methodWithOptionalStringIsUndefined:(NSString *)str +- (void)methodWithOptionalAtomicStringAndDefaultValue:(NSString *)str +{ + WebCore::JSMainThreadNullState state; + IMPL->methodWithOptionalAtomicStringAndDefaultValue(str); +} + +- (void)methodWithOptionalStringIsNull:(NSString *)str +{ + WebCore::JSMainThreadNullState state; + IMPL->methodWithOptionalStringIsNull(str); +} + +- (void)methodWithOptionalAtomicStringIsNull:(NSString *)str +{ + WebCore::JSMainThreadNullState state; + IMPL->methodWithOptionalAtomicStringIsNull(str); +} + +- (void)methodWithOptionalStringIsEmptyString:(NSString *)str +{ + WebCore::JSMainThreadNullState state; + IMPL->methodWithOptionalStringIsEmptyString(str); +} + +- (void)methodWithOptionalAtomicStringIsEmptyString:(NSString *)str +{ + WebCore::JSMainThreadNullState state; + IMPL->methodWithOptionalAtomicStringIsEmptyString(str); +} + +- (void)methodWithOptionalDoubleIsNaN:(double)number { WebCore::JSMainThreadNullState state; - IMPL->methodWithOptionalStringIsUndefined(str); + IMPL->methodWithOptionalDoubleIsNaN(number); } -- (void)methodWithOptionalStringIsNullString:(NSString *)str +- (void)methodWithOptionalFloatIsNaN:(float)number { WebCore::JSMainThreadNullState state; - IMPL->methodWithOptionalStringIsNullString(str); + IMPL->methodWithOptionalFloatIsNaN(number); } diff --git a/Source/WebCore/bindings/scripts/test/TestInterface.idl b/Source/WebCore/bindings/scripts/test/TestInterface.idl index ed5f94471dc1..001507d7ccc8 100644 --- a/Source/WebCore/bindings/scripts/test/TestInterface.idl +++ b/Source/WebCore/bindings/scripts/test/TestInterface.idl @@ -33,7 +33,7 @@ CustomNamedSetter, Conditional=Condition1|Condition2, ConstructorCallWith=ScriptExecutionContext, - Constructor(DOMString str1, [Default=Undefined] optional DOMString str2), + Constructor(DOMString str1, optional DOMString str2 = "defaultString"), ConstructorRaisesException, ConstructorConditional=TEST_INTERFACE, ExportMacro=WEBCORE_EXPORT, diff --git a/Source/WebCore/bindings/scripts/test/TestNamedConstructor.idl b/Source/WebCore/bindings/scripts/test/TestNamedConstructor.idl index 47cf5ab2a0a4..b05021a685a6 100644 --- a/Source/WebCore/bindings/scripts/test/TestNamedConstructor.idl +++ b/Source/WebCore/bindings/scripts/test/TestNamedConstructor.idl @@ -30,7 +30,7 @@ // changes in its ouput. [ ActiveDOMObject, - NamedConstructor=Audio(DOMString str1, [Default=Undefined] optional DOMString str2, [Default=NullString] optional DOMString str3), + NamedConstructor=Audio(DOMString str1, optional DOMString str2 = "defaultString", optional DOMString str3 = null), ConstructorRaisesException ] interface TestNamedConstructor { }; diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl index 1c16f944e49d..cadf952ffaa3 100644 --- a/Source/WebCore/bindings/scripts/test/TestObj.idl +++ b/Source/WebCore/bindings/scripts/test/TestObj.idl @@ -179,9 +179,16 @@ enum _optional { "", "OptionalValue1", "OptionalValue2", "OptionalValue3" }; void methodWithNonOptionalArgAndOptionalArg(long nonOpt, optional long opt); void methodWithNonOptionalArgAndTwoOptionalArgs(long nonOpt, optional long opt1, optional long opt2); void methodWithOptionalString(optional DOMString str); + void methodWithOptionalAtomicString([AtomicString] optional DOMString str); void methodWithOptionalStringAndDefaultValue(optional DOMString str = "foo"); - void methodWithOptionalStringIsUndefined([Default=Undefined] optional DOMString str); - void methodWithOptionalStringIsNullString([Default=NullString] optional DOMString str); + void methodWithOptionalAtomicStringAndDefaultValue([AtomicString] optional DOMString str = "foo"); + void methodWithOptionalStringIsNull(optional DOMString str = null); + void methodWithOptionalAtomicStringIsNull([AtomicString] optional DOMString str = null); + void methodWithOptionalStringIsEmptyString(optional DOMString str = ""); + void methodWithOptionalAtomicStringIsEmptyString([AtomicString] optional DOMString str = ""); + void methodWithOptionalDoubleIsNaN(optional unrestricted double number = NaN); + void methodWithOptionalFloatIsNaN(optional unrestricted float number = NaN); + void methodWithOptionalSequence(optional sequence sequence = []); #if defined(TESTING_JS) // Callback interface parameters. diff --git a/Source/WebCore/bindings/scripts/test/TestOverrideBuiltins.idl b/Source/WebCore/bindings/scripts/test/TestOverrideBuiltins.idl index 68fd8da5c3e8..fa0fa7b02138 100644 --- a/Source/WebCore/bindings/scripts/test/TestOverrideBuiltins.idl +++ b/Source/WebCore/bindings/scripts/test/TestOverrideBuiltins.idl @@ -2,5 +2,5 @@ OverrideBuiltins ] interface TestOverrideBuiltins { - getter Node namedItem([Default=Undefined] optional DOMString name); + getter Node namedItem(optional DOMString name = "test"); }; diff --git a/Source/WebCore/css/CSSKeyframesRule.idl b/Source/WebCore/css/CSSKeyframesRule.idl index 642a047701c6..0389d931ba2e 100644 --- a/Source/WebCore/css/CSSKeyframesRule.idl +++ b/Source/WebCore/css/CSSKeyframesRule.idl @@ -30,10 +30,11 @@ interface CSSKeyframesRule : CSSRule { attribute DOMString? name; readonly attribute CSSRuleList cssRules; - void insertRule([Default=Undefined] optional DOMString rule); - void appendRule([Default=Undefined] optional DOMString rule); - void deleteRule([Default=Undefined] optional DOMString key); - CSSKeyframeRule findRule([Default=Undefined] optional DOMString key); + // FIXME: Using "undefined" as default parameter value is wrong. + void insertRule(optional DOMString rule = "undefined"); + void appendRule(optional DOMString rule = "undefined"); + void deleteRule(optional DOMString key = "undefined"); + CSSKeyframeRule findRule(optional DOMString key = "undefined"); getter CSSKeyframeRule (unsigned long index); }; diff --git a/Source/WebCore/css/CSSMediaRule.idl b/Source/WebCore/css/CSSMediaRule.idl index 38aeef293a57..cff22e4428b3 100644 --- a/Source/WebCore/css/CSSMediaRule.idl +++ b/Source/WebCore/css/CSSMediaRule.idl @@ -23,8 +23,8 @@ interface CSSMediaRule : CSSRule { readonly attribute MediaList media; readonly attribute CSSRuleList cssRules; - [ObjCLegacyUnnamedParameters, RaisesException] unsigned long insertRule([Default=Undefined] optional DOMString rule, - [Default=Undefined] optional unsigned long index); - [RaisesException] void deleteRule([Default=Undefined] optional unsigned long index); + [ObjCLegacyUnnamedParameters, RaisesException] unsigned long insertRule(optional DOMString rule = "undefined", + optional unsigned long index = 0); + [RaisesException] void deleteRule(optional unsigned long index = 0); }; diff --git a/Source/WebCore/css/CSSPrimitiveValue.idl b/Source/WebCore/css/CSSPrimitiveValue.idl index 2efb85e8693c..4c960cf16fca 100644 --- a/Source/WebCore/css/CSSPrimitiveValue.idl +++ b/Source/WebCore/css/CSSPrimitiveValue.idl @@ -55,11 +55,13 @@ readonly attribute unsigned short primitiveType; - [ObjCLegacyUnnamedParameters, RaisesException] void setFloatValue([Default=Undefined] optional unsigned short unitType, - [Default=Undefined] optional unrestricted float floatValue); - [RaisesException] unrestricted float getFloatValue([Default=Undefined] optional unsigned short unitType); - [ObjCLegacyUnnamedParameters, RaisesException] void setStringValue([Default=Undefined] optional unsigned short stringType, - [Default=Undefined] optional DOMString stringValue); + [ObjCLegacyUnnamedParameters, RaisesException] void setFloatValue(optional unsigned short unitType = 0, + optional unrestricted float floatValue = NaN); + [RaisesException] unrestricted float getFloatValue(optional unsigned short unitType = 0); + + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters, RaisesException] void setStringValue(optional unsigned short stringType = 0, + optional DOMString stringValue = "undefined"); [RaisesException] DOMString getStringValue(); [RaisesException] Counter getCounterValue(); [RaisesException] Rect getRectValue(); diff --git a/Source/WebCore/css/CSSRuleList.idl b/Source/WebCore/css/CSSRuleList.idl index 7ec2ae0e83f6..6c218944ddeb 100644 --- a/Source/WebCore/css/CSSRuleList.idl +++ b/Source/WebCore/css/CSSRuleList.idl @@ -29,6 +29,6 @@ SkipVTableValidation, ] interface CSSRuleList { readonly attribute unsigned long length; - getter CSSRule item([Default=Undefined] optional unsigned long index); + getter CSSRule item(optional unsigned long index = 0); }; diff --git a/Source/WebCore/css/CSSStyleDeclaration.idl b/Source/WebCore/css/CSSStyleDeclaration.idl index a0053c6a0e2e..acc0e5d466aa 100644 --- a/Source/WebCore/css/CSSStyleDeclaration.idl +++ b/Source/WebCore/css/CSSStyleDeclaration.idl @@ -31,22 +31,26 @@ ] interface CSSStyleDeclaration { [SetterRaisesException] attribute DOMString? cssText; - DOMString getPropertyValue([Default=Undefined] DOMString propertyName); - [Custom] CSSValue getPropertyCSSValue([Default=Undefined] optional DOMString propertyName); - [RaisesException] DOMString removeProperty([Default=Undefined] optional DOMString propertyName); - DOMString? getPropertyPriority([Default=Undefined] optional DOMString propertyName); + DOMString getPropertyValue(DOMString propertyName); + [Custom] CSSValue getPropertyCSSValue(optional DOMString propertyName); + + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] DOMString removeProperty(optional DOMString propertyName = "undefined"); + DOMString? getPropertyPriority(optional DOMString propertyName = "undefined"); // FIXME: 'priority' should use [TreatNullAs=EmptyString]. - [ObjCLegacyUnnamedParameters, RaisesException] void setProperty([Default=Undefined] optional DOMString propertyName, - [TreatNullAs=EmptyString, Default=Undefined] optional DOMString value, - [Default=Undefined] optional DOMString priority); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters, RaisesException] void setProperty(optional DOMString propertyName = "undefined", + [TreatNullAs=EmptyString] optional DOMString value = "undefined", + optional DOMString priority = "undefined"); readonly attribute unsigned long length; - getter DOMString item([Default=Undefined] optional unsigned long index); + getter DOMString item(optional unsigned long index = 0); readonly attribute CSSRule parentRule; // Extensions - DOMString? getPropertyShorthand([Default=Undefined] optional DOMString propertyName); - boolean isPropertyImplicit([Default=Undefined] optional DOMString propertyName); + // FIXME: Using "undefined" as default parameter value is wrong. + DOMString? getPropertyShorthand(optional DOMString propertyName = "undefined"); + boolean isPropertyImplicit(optional DOMString propertyName = "undefined"); }; diff --git a/Source/WebCore/css/CSSStyleSheet.idl b/Source/WebCore/css/CSSStyleSheet.idl index d02132f5f939..5f8ff7fb1b2e 100644 --- a/Source/WebCore/css/CSSStyleSheet.idl +++ b/Source/WebCore/css/CSSStyleSheet.idl @@ -23,16 +23,18 @@ interface CSSStyleSheet : StyleSheet { readonly attribute CSSRule ownerRule; readonly attribute CSSRuleList cssRules; - [ObjCLegacyUnnamedParameters, RaisesException] unsigned long insertRule([Default=Undefined] optional DOMString rule, - [Default=Undefined] optional unsigned long index); - [RaisesException] void deleteRule([Default=Undefined] optional unsigned long index); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters, RaisesException] unsigned long insertRule(optional DOMString rule = "undefined", + optional unsigned long index = 0); + [RaisesException] void deleteRule(optional unsigned long index = 0); // IE Extensions readonly attribute CSSRuleList rules; - [RaisesException] long addRule([Default=Undefined] optional DOMString selector, - [Default=Undefined] optional DOMString style, + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] long addRule(optional DOMString selector = "undefined", + optional DOMString style = "undefined", optional unsigned long index); - [RaisesException] void removeRule([Default=Undefined] optional unsigned long index); + [RaisesException] void removeRule(optional unsigned long index = 0); }; diff --git a/Source/WebCore/css/CSSSupportsRule.idl b/Source/WebCore/css/CSSSupportsRule.idl index 614033840616..523471abc1df 100644 --- a/Source/WebCore/css/CSSSupportsRule.idl +++ b/Source/WebCore/css/CSSSupportsRule.idl @@ -32,8 +32,9 @@ readonly attribute CSSRuleList cssRules; readonly attribute DOMString conditionText; - [RaisesException] unsigned long insertRule([Default=Undefined] optional DOMString rule, - [Default=Undefined] optional unsigned long index); - [RaisesException] void deleteRule([Default=Undefined] optional unsigned long index); + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] unsigned long insertRule(optional DOMString rule = "undefined", + optional unsigned long index = 0); + [RaisesException] void deleteRule(optional unsigned long index = 0); }; diff --git a/Source/WebCore/css/CSSValueList.idl b/Source/WebCore/css/CSSValueList.idl index d0aa3b859eae..9457b3822469 100644 --- a/Source/WebCore/css/CSSValueList.idl +++ b/Source/WebCore/css/CSSValueList.idl @@ -28,6 +28,6 @@ ImplementationLacksVTable, ] interface CSSValueList : CSSValue { readonly attribute unsigned long length; - getter CSSValue item([Default=Undefined] optional unsigned long index); + getter CSSValue item(optional unsigned long index = 0); }; diff --git a/Source/WebCore/css/MediaList.idl b/Source/WebCore/css/MediaList.idl index 9bfb56fac055..dc0ba8b0ae45 100644 --- a/Source/WebCore/css/MediaList.idl +++ b/Source/WebCore/css/MediaList.idl @@ -33,9 +33,11 @@ [SetterRaisesException] attribute DOMString? mediaText; readonly attribute unsigned long length; - getter DOMString? item([Default=Undefined] optional unsigned long index); - [RaisesException] void deleteMedium([Default=Undefined] optional DOMString oldMedium); - [RaisesException] void appendMedium([Default=Undefined] optional DOMString newMedium); + getter DOMString? item(optional unsigned long index = 0); + + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] void deleteMedium(optional DOMString oldMedium = "undefined"); + [RaisesException] void appendMedium(optional DOMString newMedium = "undefined"); }; diff --git a/Source/WebCore/css/MediaQueryList.idl b/Source/WebCore/css/MediaQueryList.idl index 4b097064c08a..9b62d1922289 100644 --- a/Source/WebCore/css/MediaQueryList.idl +++ b/Source/WebCore/css/MediaQueryList.idl @@ -22,6 +22,6 @@ ] interface MediaQueryList { readonly attribute DOMString media; readonly attribute boolean matches; - void addListener([Default=Undefined] optional MediaQueryListListener listener); - void removeListener([Default=Undefined] optional MediaQueryListListener listener); + void addListener(optional MediaQueryListListener listener); + void removeListener(optional MediaQueryListListener listener); }; diff --git a/Source/WebCore/css/MediaQueryListListener.idl b/Source/WebCore/css/MediaQueryListListener.idl index 23f4012a4db4..bd2d13fa0083 100644 --- a/Source/WebCore/css/MediaQueryListListener.idl +++ b/Source/WebCore/css/MediaQueryListListener.idl @@ -21,5 +21,5 @@ CallbackNeedsOperatorEqual, Callback=FunctionOnly, ] callback interface MediaQueryListListener { - boolean queryChanged([Default=Undefined] optional MediaQueryList list); + boolean queryChanged(optional MediaQueryList list = null); }; diff --git a/Source/WebCore/css/StyleMedia.idl b/Source/WebCore/css/StyleMedia.idl index 85af01217410..d7ad54936950 100644 --- a/Source/WebCore/css/StyleMedia.idl +++ b/Source/WebCore/css/StyleMedia.idl @@ -29,5 +29,7 @@ GenerateIsReachable=ImplFrame, ] interface StyleMedia { readonly attribute DOMString type; - boolean matchMedium([Default=Undefined] optional DOMString mediaquery); + + // FIXME: Using "undefined" as default parameter value is wrong. + boolean matchMedium(optional DOMString mediaquery = "undefined"); }; diff --git a/Source/WebCore/css/StyleSheetList.idl b/Source/WebCore/css/StyleSheetList.idl index dfcb93f27f1a..056b3ef5b7ff 100644 --- a/Source/WebCore/css/StyleSheetList.idl +++ b/Source/WebCore/css/StyleSheetList.idl @@ -24,7 +24,7 @@ ImplementationLacksVTable, ] interface StyleSheetList { readonly attribute unsigned long length; - getter StyleSheet item([Default=Undefined] optional unsigned long index); + getter StyleSheet item(optional unsigned long index = 0); getter CSSStyleSheet (DOMString name); }; diff --git a/Source/WebCore/css/WebKitCSSFilterValue.idl b/Source/WebCore/css/WebKitCSSFilterValue.idl index 45e7a2efc895..97f34a1748ae 100644 --- a/Source/WebCore/css/WebKitCSSFilterValue.idl +++ b/Source/WebCore/css/WebKitCSSFilterValue.idl @@ -44,5 +44,5 @@ readonly attribute unsigned short operationType; - getter CSSValue ([Default=Undefined] optional unsigned long index); + getter CSSValue (optional unsigned long index = 0); }; diff --git a/Source/WebCore/css/WebKitCSSMatrix.idl b/Source/WebCore/css/WebKitCSSMatrix.idl index 99a53392d30c..b687f5c05bb9 100644 --- a/Source/WebCore/css/WebKitCSSMatrix.idl +++ b/Source/WebCore/css/WebKitCSSMatrix.idl @@ -25,7 +25,7 @@ // Introduced in DOM Level ?: [ - Constructor([Default=NullString] optional DOMString cssValue), + Constructor(optional DOMString cssValue = null), ConstructorRaisesException, ImplementationLacksVTable, ] interface WebKitCSSMatrix { @@ -56,49 +56,50 @@ attribute unrestricted double m43; attribute unrestricted double m44; - [RaisesException] void setMatrixValue([Default=Undefined] optional DOMString string); + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] void setMatrixValue(optional DOMString string = "undefined"); // Multiply this matrix by secondMatrix, on the right (result = this * secondMatrix) - [Immutable] WebKitCSSMatrix multiply([Default=Undefined] optional WebKitCSSMatrix secondMatrix); + [Immutable] WebKitCSSMatrix multiply(optional WebKitCSSMatrix? secondMatrix = null); // Return the inverse of this matrix. Throw an exception if the matrix is not invertible [Immutable, RaisesException] WebKitCSSMatrix inverse(); // Return this matrix translated by the passed values. - // Passing a NaN will use a value of 0. This allows the 3D form to used for 2D operations - [Immutable] WebKitCSSMatrix translate([Default=Undefined] optional unrestricted double x, - [Default=Undefined] optional unrestricted double y, - [Default=Undefined] optional unrestricted double z); + // Passing a NaN will use a value of 0. This allows the 3D form to used for 2D operations + [Immutable] WebKitCSSMatrix translate(optional unrestricted double x = NaN, + optional unrestricted double y = NaN, + optional unrestricted double z = NaN); // Returns this matrix scaled by the passed values. // Passing scaleX or scaleZ as NaN uses a value of 1, but passing scaleY of NaN // makes it the same as scaleX. This allows the 3D form to used for 2D operations - [Immutable] WebKitCSSMatrix scale([Default=Undefined] optional unrestricted double scaleX, - [Default=Undefined] optional unrestricted double scaleY, - [Default=Undefined] optional unrestricted double scaleZ); + [Immutable] WebKitCSSMatrix scale(optional unrestricted double scaleX = NaN, + optional unrestricted double scaleY = NaN, + optional unrestricted double scaleZ = NaN); // Returns this matrix rotated by the passed values. // If rotY and rotZ are NaN, rotate about Z (rotX=0, rotateY=0, rotateZ=rotX). // Otherwise use a rotation value of 0 for any passed NaN. - [Immutable] WebKitCSSMatrix rotate([Default=Undefined] optional unrestricted double rotX, - [Default=Undefined] optional unrestricted double rotY, - [Default=Undefined] optional unrestricted double rotZ); + [Immutable] WebKitCSSMatrix rotate(optional unrestricted double rotX = NaN, + optional unrestricted double rotY = NaN, + optional unrestricted double rotZ = NaN); // Returns this matrix rotated about the passed axis by the passed angle. // Passing a NaN will use a value of 0. If the axis is (0,0,0) use a value // of (0,0,1). - [Immutable] WebKitCSSMatrix rotateAxisAngle([Default=Undefined] optional unrestricted double x, - [Default=Undefined] optional unrestricted double y, - [Default=Undefined] optional unrestricted double z, - [Default=Undefined] optional unrestricted double angle); + [Immutable] WebKitCSSMatrix rotateAxisAngle(optional unrestricted double x = NaN, + optional unrestricted double y = NaN, + optional unrestricted double z = NaN, + optional unrestricted double angle = NaN); // Returns this matrix skewed along the X axis by the passed values. // Passing a NaN will use a value of 0. - [Immutable] WebKitCSSMatrix skewX([Default=Undefined] optional unrestricted double angle); + [Immutable] WebKitCSSMatrix skewX(optional unrestricted double angle = NaN); // Returns this matrix skewed along the Y axis by the passed values. // Passing a NaN will use a value of 0. - [Immutable] WebKitCSSMatrix skewY([Default=Undefined] optional unrestricted double angle); + [Immutable] WebKitCSSMatrix skewY(optional unrestricted double angle = NaN); [NotEnumerable] DOMString toString(); }; diff --git a/Source/WebCore/css/WebKitCSSTransformValue.idl b/Source/WebCore/css/WebKitCSSTransformValue.idl index 3619e8127dc2..7905bd4ed77e 100644 --- a/Source/WebCore/css/WebKitCSSTransformValue.idl +++ b/Source/WebCore/css/WebKitCSSTransformValue.idl @@ -57,6 +57,6 @@ readonly attribute unsigned short operationType; - getter CSSValue ([Default=Undefined] optional unsigned long index); + getter CSSValue (optional unsigned long index = 0); }; diff --git a/Source/WebCore/dom/ClientRectList.idl b/Source/WebCore/dom/ClientRectList.idl index 3ebfc1cc0b31..eef3cc489c8c 100644 --- a/Source/WebCore/dom/ClientRectList.idl +++ b/Source/WebCore/dom/ClientRectList.idl @@ -29,7 +29,7 @@ ExportMacro=WEBCORE_EXPORT, ] interface ClientRectList { readonly attribute unsigned long length; - getter ClientRect item([Default=Undefined] optional unsigned long index); + getter ClientRect item(optional unsigned long index = 0); // FIXME: Fix list behavior to allow custom exceptions to be thrown. }; diff --git a/Source/WebCore/dom/Comment.idl b/Source/WebCore/dom/Comment.idl index 1b63aa02c562..9d62900c5e50 100644 --- a/Source/WebCore/dom/Comment.idl +++ b/Source/WebCore/dom/Comment.idl @@ -18,7 +18,7 @@ */ [ - Constructor([Default=NullString] optional DOMString data), + Constructor(optional DOMString data = null), ConstructorCallWith=Document, JSGenerateToJSObject ] interface Comment : CharacterData { diff --git a/Source/WebCore/dom/CompositionEvent.idl b/Source/WebCore/dom/CompositionEvent.idl index 5c6a197ad46f..d2039debcd63 100644 --- a/Source/WebCore/dom/CompositionEvent.idl +++ b/Source/WebCore/dom/CompositionEvent.idl @@ -30,11 +30,12 @@ [InitializedByEventConstructor] readonly attribute DOMString data; - void initCompositionEvent([Default=Undefined] optional DOMString typeArg, - [Default=Undefined] optional boolean canBubbleArg, - [Default=Undefined] optional boolean cancelableArg, - [Default=Undefined] optional DOMWindow viewArg, - [Default=Undefined] optional DOMString dataArg); + // FIXME: Using "undefined" as default parameter value is wrong. + void initCompositionEvent(optional DOMString typeArg = "undefined", + optional boolean canBubbleArg = false, + optional boolean cancelableArg = false, + optional DOMWindow? viewArg = null, + optional DOMString dataArg = "undefined"); }; diff --git a/Source/WebCore/dom/CustomEvent.h b/Source/WebCore/dom/CustomEvent.h index 76b3b5c8f428..5f5f44dea639 100644 --- a/Source/WebCore/dom/CustomEvent.h +++ b/Source/WebCore/dom/CustomEvent.h @@ -50,7 +50,7 @@ class CustomEvent final : public Event { return adoptRef(*new CustomEvent(type, initializer)); } - void initCustomEvent(JSC::ExecState&, const AtomicString& type, bool canBubble, bool cancelable, JSC::JSValue detail); + void initCustomEvent(JSC::ExecState&, const AtomicString& type, bool canBubble, bool cancelable, JSC::JSValue detail = JSC::JSValue::JSUndefined); EventInterface eventInterface() const override; diff --git a/Source/WebCore/dom/CustomEvent.idl b/Source/WebCore/dom/CustomEvent.idl index a23bfbf1c0d0..9abdbe79ca6c 100644 --- a/Source/WebCore/dom/CustomEvent.idl +++ b/Source/WebCore/dom/CustomEvent.idl @@ -29,5 +29,6 @@ ] interface CustomEvent : Event { [InitializedByEventConstructor, CustomGetter] readonly attribute any detail; - [CallWith=ScriptState] void initCustomEvent([Default=Undefined] optional DOMString typeArg, [Default=Undefined] optional boolean canBubbleArg, [Default=Undefined] optional boolean cancelableArg, [Default=Undefined] optional any detailArg); + // FIXME: Using "undefined" as default parameter value is wrong. + [CallWith=ScriptState] void initCustomEvent(optional DOMString typeArg = "undefined", optional boolean canBubbleArg = false, optional boolean cancelableArg = false, optional any detailArg); }; diff --git a/Source/WebCore/dom/DOMImplementation.idl b/Source/WebCore/dom/DOMImplementation.idl index feca859c03c8..095667c7c89f 100644 --- a/Source/WebCore/dom/DOMImplementation.idl +++ b/Source/WebCore/dom/DOMImplementation.idl @@ -25,12 +25,13 @@ // DOM Level 1 - [ObjCLegacyUnnamedParameters] boolean hasFeature([Default=Undefined] optional DOMString feature, - [TreatNullAs=EmptyString, Default=Undefined] optional DOMString version); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters] boolean hasFeature(optional DOMString feature = "undefined", + [TreatNullAs=EmptyString] optional DOMString version = "undefined"); // DOM Level 2 - [ObjCLegacyUnnamedParameters, RaisesException, NewObject] DocumentType createDocumentType([Default=Undefined] optional DOMString? qualifiedName, [Default=Undefined] optional DOMString? publicId, [Default=Undefined] optional DOMString? systemId); + [ObjCLegacyUnnamedParameters, RaisesException, NewObject] DocumentType createDocumentType(optional DOMString? qualifiedName = null, optional DOMString? publicId = null, optional DOMString? systemId = null); [NewObject, ObjCLegacyUnnamedParameters, RaisesException] #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT @@ -38,14 +39,16 @@ #else XMLDocument #endif - createDocument([Default=Undefined] optional DOMString? namespaceURI, [TreatNullAs=EmptyString, Default=Undefined] optional DOMString qualifiedName, [Default=Undefined] optional DocumentType? doctype); + // FIXME: Using "undefined" as default parameter value is wrong. + createDocument(optional DOMString? namespaceURI = null, [TreatNullAs=EmptyString] optional DOMString qualifiedName = "undefined", optional DocumentType? doctype = null); // DOMImplementationCSS interface from DOM Level 2 CSS - [ObjCLegacyUnnamedParameters, RaisesException] CSSStyleSheet createCSSStyleSheet([Default=Undefined] optional DOMString title, [Default=Undefined] optional DOMString media); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters, RaisesException] CSSStyleSheet createCSSStyleSheet(optional DOMString title = "undefined", optional DOMString media = "undefined"); // HTMLDOMImplementation interface from DOM Level 2 HTML - [NewObject] HTMLDocument createHTMLDocument([Default=NullString] optional DOMString title); + [NewObject] HTMLDocument createHTMLDocument(optional DOMString title = null); }; diff --git a/Source/WebCore/dom/DOMStringList.idl b/Source/WebCore/dom/DOMStringList.idl index ffc053e9aa94..a169595c0fdb 100644 --- a/Source/WebCore/dom/DOMStringList.idl +++ b/Source/WebCore/dom/DOMStringList.idl @@ -28,7 +28,9 @@ ImplementationLacksVTable, ] interface DOMStringList { readonly attribute unsigned long length; - getter DOMString? item([Default=Undefined] optional unsigned long index); - boolean contains([Default=Undefined] optional DOMString string); + getter DOMString? item(optional unsigned long index = 0); + + // FIXME: Using "undefined" as default parameter value is wrong. + boolean contains(optional DOMString string = "undefined"); }; diff --git a/Source/WebCore/dom/DataTransferItem.idl b/Source/WebCore/dom/DataTransferItem.idl index 3027eaf9bba4..8df97591bf08 100644 --- a/Source/WebCore/dom/DataTransferItem.idl +++ b/Source/WebCore/dom/DataTransferItem.idl @@ -36,7 +36,7 @@ readonly attribute DOMString kind; readonly attribute DOMString type; - void getAsString([Default=Undefined] optional StringCallback callback); + void getAsString(optional StringCallback callback); Blob getAsFile(); }; diff --git a/Source/WebCore/dom/DataTransferItemList.idl b/Source/WebCore/dom/DataTransferItemList.idl index f60899310e6c..b95415e09461 100644 --- a/Source/WebCore/dom/DataTransferItemList.idl +++ b/Source/WebCore/dom/DataTransferItemList.idl @@ -35,11 +35,12 @@ ImplementationLacksVTable, ] interface DataTransferItemList { readonly attribute long length; - getter DataTransferItem item([Default=Undefined] optional unsigned long index); + getter DataTransferItem item(optional unsigned long index = 0); void clear(); void add(File? file); - [RaisesException] void add([Default=Undefined] optional DOMString data, - [Default=Undefined] optional DOMString type); + + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] void add(optional DOMString data = "undefined", optional DOMString type = "undefined"); }; diff --git a/Source/WebCore/dom/DeviceMotionEvent.idl b/Source/WebCore/dom/DeviceMotionEvent.idl index b94ca26a5948..3fbc840b14c6 100644 --- a/Source/WebCore/dom/DeviceMotionEvent.idl +++ b/Source/WebCore/dom/DeviceMotionEvent.idl @@ -30,12 +30,13 @@ [Custom] readonly attribute Acceleration accelerationIncludingGravity; [Custom] readonly attribute RotationRate rotationRate; [Custom] readonly attribute unrestricted double interval; - [Custom] void initDeviceMotionEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean bubbles, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional Acceleration acceleration, - [Default=Undefined] optional Acceleration accelerationIncludingGravity, - [Default=Undefined] optional RotationRate rotationRate, - [Default=Undefined] optional unrestricted double interval); + + [Custom] void initDeviceMotionEvent(optional DOMString type, + optional boolean bubbles, + optional boolean cancelable, + optional Acceleration acceleration, + optional Acceleration accelerationIncludingGravity, + optional RotationRate rotationRate, + optional unrestricted double interval); }; diff --git a/Source/WebCore/dom/DeviceOrientationEvent.idl b/Source/WebCore/dom/DeviceOrientationEvent.idl index 33a8482dbd76..4afb49268714 100644 --- a/Source/WebCore/dom/DeviceOrientationEvent.idl +++ b/Source/WebCore/dom/DeviceOrientationEvent.idl @@ -35,23 +35,23 @@ #if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS [Custom] readonly attribute unrestricted double webkitCompassHeading; [Custom] readonly attribute unrestricted double webkitCompassAccuracy; - [Custom] void initDeviceOrientationEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean bubbles, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional unrestricted double alpha, - [Default=Undefined] optional unrestricted double beta, - [Default=Undefined] optional unrestricted double gamma, - [Default=Undefined] optional unrestricted double compassHeading, - [Default=Undefined] optional unrestricted double compassAccuracy); + [Custom] void initDeviceOrientationEvent(optional DOMString type, + optional boolean bubbles, + optional boolean cancelable, + optional unrestricted double alpha, + optional unrestricted double beta, + optional unrestricted double gamma, + optional unrestricted double compassHeading, + optional unrestricted double compassAccuracy); #else [Custom] readonly attribute boolean absolute; - [Custom] void initDeviceOrientationEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean bubbles, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional unrestricted double alpha, - [Default=Undefined] optional unrestricted double beta, - [Default=Undefined] optional unrestricted double gamma, - [Default=Undefined] optional boolean absolute); + [Custom] void initDeviceOrientationEvent(optional DOMString type, + optional boolean bubbles, + optional boolean cancelable, + optional unrestricted double alpha, + optional unrestricted double beta, + optional unrestricted double gamma, + optional boolean absolute); #endif }; diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 6fad249b091f..73d1e7ffde76 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -1031,7 +1031,7 @@ RefPtr Document::adoptNode(Node& source, ExceptionCode& ec) case ATTRIBUTE_NODE: { auto& attr = downcast(source); if (attr.ownerElement()) - attr.ownerElement()->removeAttributeNode(&attr, ec); + attr.ownerElement()->removeAttributeNode(attr, ec); break; } default: diff --git a/Source/WebCore/dom/Document.idl b/Source/WebCore/dom/Document.idl index ff545098d20c..a132be2ddc0d 100644 --- a/Source/WebCore/dom/Document.idl +++ b/Source/WebCore/dom/Document.idl @@ -34,21 +34,24 @@ [NewObject, RaisesException, ImplementedAs=createElementForBindings] Element createElement(DOMString tagName); [NewObject] DocumentFragment createDocumentFragment(); - [NewObject] Text createTextNode([Default=Undefined] optional DOMString data); - [NewObject] Comment createComment([Default=Undefined] optional DOMString data); - [NewObject, RaisesException] CDATASection createCDATASection([Default=Undefined] optional DOMString data); - [ObjCLegacyUnnamedParameters, NewObject, RaisesException] ProcessingInstruction createProcessingInstruction([Default=Undefined] optional DOMString target, - [Default=Undefined] optional DOMString data); - [NewObject, RaisesException] Attr createAttribute([Default=Undefined] optional DOMString name); + + // FIXME: Using "undefined" as default parameter value is wrong. + [NewObject] Text createTextNode(optional DOMString data = "undefined"); + [NewObject] Comment createComment(optional DOMString data = "undefined"); + [NewObject, RaisesException] CDATASection createCDATASection(optional DOMString data = "undefined"); + [ObjCLegacyUnnamedParameters, NewObject, RaisesException] ProcessingInstruction createProcessingInstruction(optional DOMString target = "undefined", + optional DOMString data = "undefined"); + [NewObject, RaisesException] Attr createAttribute(optional DOMString name = "undefined"); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - [RaisesException] EntityReference createEntityReference([Default=Undefined] optional DOMString name); + [RaisesException] EntityReference createEntityReference(optional DOMString name); #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName([Default=Undefined] optional DOMString tagname); + [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName(optional DOMString tagname); #else - HTMLCollection getElementsByTagName([Default=Undefined] optional DOMString tagname); + // FIXME: Using "undefined" as default parameter value is wrong. + HTMLCollection getElementsByTagName(optional DOMString tagname = "undefined"); #endif // Introduced in DOM Level 2: @@ -56,17 +59,20 @@ [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Node importNode(Node importedNode, optional boolean deep); // FIXME: 'qualifiedName' should not have [TreatNullAs=EmptyString]. - [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Element createElementNS([Default=Undefined] optional DOMString? namespaceURI, - [TreatNullAs=EmptyString, Default=Undefined] optional DOMString qualifiedName); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Element createElementNS(optional DOMString? namespaceURI = null, + [TreatNullAs=EmptyString] optional DOMString qualifiedName = "undefined"); // FIXME: 'qualifiedName' should not have [TreatNullAs=EmptyString]. - [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Attr createAttributeNS([Default=Undefined] optional DOMString? namespaceURI, - [TreatNullAs=EmptyString, Default=Undefined] optional DOMString qualifiedName); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters, NewObject, RaisesException] Attr createAttributeNS(optional DOMString? namespaceURI = null, + [TreatNullAs=EmptyString] optional DOMString qualifiedName = "undefined"); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS(optional DOMString namespaceURI, optional DOMString localName); #else - HTMLCollection getElementsByTagNameNS([Default=Undefined] optional DOMString? namespaceURI, [Default=Undefined] optional DOMString localName); + // FIXME: Using "undefined" as default parameter value is wrong. + HTMLCollection getElementsByTagNameNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined"); #endif // DOM Level 3 Core @@ -91,7 +97,8 @@ // DOM Level 2 Events (DocumentEvents interface) - [RaisesException, NewObject] Event createEvent([Default=Undefined] optional DOMString eventType); + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException, NewObject] Event createEvent(optional DOMString eventType = "undefined"); // DOM Level 2 Tranversal and Range (DocumentRange interface) @@ -127,25 +134,29 @@ // DOM Level 2 Style (DocumentCSS interface) - [ObjCLegacyUnnamedParameters] CSSStyleDeclaration getOverrideStyle([Default=Undefined] optional Element? element, - [Default=Undefined] optional DOMString pseudoElement); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters] CSSStyleDeclaration getOverrideStyle(optional Element? element = null, optional DOMString pseudoElement = "undefined"); readonly attribute DOMString contentType; // DOM Level 3 XPath (XPathEvaluator interface) - [ObjCLegacyUnnamedParameters, RaisesException] XPathExpression createExpression([Default=Undefined] optional DOMString expression, - [Default=Undefined] optional XPathNSResolver? resolver); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters, RaisesException] XPathExpression createExpression(optional DOMString expression = "undefined", + optional XPathNSResolver? resolver = null); XPathNSResolver createNSResolver(Node? nodeResolver); - [ObjCLegacyUnnamedParameters, RaisesException] XPathResult evaluate([Default=Undefined] optional DOMString expression, - [Default=Undefined] optional Node? contextNode, - [Default=Undefined] optional XPathNSResolver? resolver, - [Default=Undefined] optional unsigned short type, - [Default=Undefined] optional XPathResult? inResult); + + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters, RaisesException] XPathResult evaluate(optional DOMString expression = "undefined", + optional Node? contextNode = null, + optional XPathNSResolver? resolver = null, + optional unsigned short type = 0, + optional XPathResult? inResult = null); // Common extensions - boolean execCommand([Default=Undefined] optional DOMString command, - [Default=Undefined] optional boolean userInterface, - optional DOMString? value); + // FIXME: Using "undefined" as default parameter value is wrong. + boolean execCommand(optional DOMString command = "undefined", + optional boolean userInterface = false, + optional DOMString? value); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C // FIXME: remove the these two versions once optional is implemented for Objective-C. @@ -154,11 +165,12 @@ boolean execCommand(DOMString command); #endif - boolean queryCommandEnabled([Default=Undefined] optional DOMString command); - boolean queryCommandIndeterm([Default=Undefined] optional DOMString command); - boolean queryCommandState([Default=Undefined] optional DOMString command); - boolean queryCommandSupported([Default=Undefined] optional DOMString command); - DOMString queryCommandValue([Default=Undefined] optional DOMString command); + // FIXME: Using "undefined" as default parameter value is wrong. + boolean queryCommandEnabled(optional DOMString command = "undefined"); + boolean queryCommandIndeterm(optional DOMString command = "undefined"); + boolean queryCommandState(optional DOMString command = "undefined"); + boolean queryCommandSupported(optional DOMString command = "undefined"); + DOMString queryCommandValue(optional DOMString command = "undefined"); // Moved down from HTMLDocument @@ -187,7 +199,8 @@ readonly attribute HTMLCollection anchors; readonly attribute DOMString lastModified; - NodeList getElementsByName([Default=Undefined,AtomicString] optional DOMString elementName); + // FIXME: Using "undefined" as default parameter value is wrong. + NodeList getElementsByName([AtomicString] optional DOMString elementName = "undefined"); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT [PutForwards=href, Unforgeable] readonly attribute Location? location; @@ -203,10 +216,8 @@ readonly attribute DOMString defaultCharset; readonly attribute DOMString readyState; - Element elementFromPoint([Default=Undefined] optional long x, - [Default=Undefined] optional long y); - Range caretRangeFromPoint([Default=Undefined] optional long x, - [Default=Undefined] optional long y); + Element elementFromPoint(optional long x = 0, optional long y = 0); + Range caretRangeFromPoint(optional long x = 0, optional long y = 0); // Mozilla extensions #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT @@ -244,9 +255,10 @@ // HTML 5 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName([Default=Undefined] optional DOMString classNames); + [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName(optional DOMString classNames); #else - HTMLCollection getElementsByClassName([Default=Undefined] optional DOMString classNames); + // FIXME: Using "undefined" as default parameter value is wrong. + HTMLCollection getElementsByClassName(optional DOMString classNames = "undefined"); #endif readonly attribute Element? activeElement; @@ -279,17 +291,17 @@ #if defined(ENABLE_IOS_TOUCH_EVENTS) && ENABLE_IOS_TOUCH_EVENTS #include #elif defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS - [NewObject, RaisesException] Touch createTouch([Default=Undefined] optional DOMWindow? window, - [Default=Undefined] optional EventTarget? target, - [Default=Undefined] optional long identifier, - [Default=Undefined] optional long pageX, - [Default=Undefined] optional long pageY, - [Default=Undefined] optional long screenX, - [Default=Undefined] optional long screenY, - [Default=Undefined] optional long webkitRadiusX, - [Default=Undefined] optional long webkitRadiusY, - [Default=Undefined] optional unrestricted float webkitRotationAngle, - [Default=Undefined] optional unrestricted float webkitForce); + [NewObject, RaisesException] Touch createTouch(optional DOMWindow? window = null, + optional EventTarget? target = null, + optional long identifier = 0, + optional long pageX = 0, + optional long pageY = 0, + optional long screenX = 0, + optional long screenY = 0, + optional long webkitRadiusX = 0, + optional long webkitRadiusY = 0, + optional unrestricted float webkitRotationAngle = NaN, + optional unrestricted float webkitForce = NaN); [NewObject, Custom, RaisesException] TouchList createTouchList(); #endif diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 1ef82afac7f4..70a829177216 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -1932,20 +1932,15 @@ const Vector>& Element::attrNodeList() return *attrNodeListForElement(*this); } -RefPtr Element::setAttributeNode(Attr* attrNode, ExceptionCode& ec) +RefPtr Element::setAttributeNode(Attr& attrNode, ExceptionCode& ec) { - if (!attrNode) { - ec = TYPE_MISMATCH_ERR; - return nullptr; - } - - RefPtr oldAttrNode = attrIfExists(attrNode->qualifiedName().localName(), shouldIgnoreAttributeCase(*this)); - if (oldAttrNode.get() == attrNode) - return attrNode; // This Attr is already attached to the element. + RefPtr oldAttrNode = attrIfExists(attrNode.qualifiedName().localName(), shouldIgnoreAttributeCase(*this)); + if (oldAttrNode.get() == &attrNode) + return &attrNode; // This Attr is already attached to the element. // INUSE_ATTRIBUTE_ERR: Raised if node is an Attr that is already an attribute of another Element object. // The DOM user must explicitly clone Attr nodes to re-use them in other elements. - if (attrNode->ownerElement() && attrNode->ownerElement() != this) { + if (attrNode.ownerElement() && attrNode.ownerElement() != this) { ec = INUSE_ATTRIBUTE_ERR; return nullptr; } @@ -1953,83 +1948,74 @@ RefPtr Element::setAttributeNode(Attr* attrNode, ExceptionCode& ec) synchronizeAllAttributes(); UniqueElementData& elementData = ensureUniqueElementData(); - unsigned existingAttributeIndex = elementData.findAttributeIndexByName(attrNode->qualifiedName().localName(), shouldIgnoreAttributeCase(*this)); + unsigned existingAttributeIndex = elementData.findAttributeIndexByName(attrNode.qualifiedName().localName(), shouldIgnoreAttributeCase(*this)); if (existingAttributeIndex != ElementData::attributeNotFound) { const Attribute& attribute = attributeAt(existingAttributeIndex); if (oldAttrNode) detachAttrNodeFromElementWithValue(oldAttrNode.get(), attribute.value()); else - oldAttrNode = Attr::create(document(), attrNode->qualifiedName(), attribute.value()); + oldAttrNode = Attr::create(document(), attrNode.qualifiedName(), attribute.value()); - if (attribute.name().matches(attrNode->qualifiedName())) - setAttributeInternal(existingAttributeIndex, attrNode->qualifiedName(), attrNode->value(), NotInSynchronizationOfLazyAttribute); + if (attribute.name().matches(attrNode.qualifiedName())) + setAttributeInternal(existingAttributeIndex, attrNode.qualifiedName(), attrNode.value(), NotInSynchronizationOfLazyAttribute); else { removeAttributeInternal(existingAttributeIndex, NotInSynchronizationOfLazyAttribute); - unsigned existingAttributeIndexForFullQualifiedName = elementData.findAttributeIndexByName(attrNode->qualifiedName()); - setAttributeInternal(existingAttributeIndexForFullQualifiedName, attrNode->qualifiedName(), attrNode->value(), NotInSynchronizationOfLazyAttribute); + unsigned existingAttributeIndexForFullQualifiedName = elementData.findAttributeIndexByName(attrNode.qualifiedName()); + setAttributeInternal(existingAttributeIndexForFullQualifiedName, attrNode.qualifiedName(), attrNode.value(), NotInSynchronizationOfLazyAttribute); } } else { - unsigned existingAttributeIndexForFullQualifiedName = elementData.findAttributeIndexByName(attrNode->qualifiedName()); - setAttributeInternal(existingAttributeIndexForFullQualifiedName, attrNode->qualifiedName(), attrNode->value(), NotInSynchronizationOfLazyAttribute); + unsigned existingAttributeIndexForFullQualifiedName = elementData.findAttributeIndexByName(attrNode.qualifiedName()); + setAttributeInternal(existingAttributeIndexForFullQualifiedName, attrNode.qualifiedName(), attrNode.value(), NotInSynchronizationOfLazyAttribute); } - if (attrNode->ownerElement() != this) { - attrNode->attachToElement(this); - treeScope().adoptIfNeeded(attrNode); - ensureAttrNodeListForElement(*this).append(attrNode); + if (attrNode.ownerElement() != this) { + attrNode.attachToElement(this); + treeScope().adoptIfNeeded(&attrNode); + ensureAttrNodeListForElement(*this).append(&attrNode); } return oldAttrNode; } -RefPtr Element::setAttributeNodeNS(Attr* attrNode, ExceptionCode& ec) +RefPtr Element::setAttributeNodeNS(Attr& attrNode, ExceptionCode& ec) { - if (!attrNode) { - ec = TYPE_MISMATCH_ERR; - return 0; - } - - RefPtr oldAttrNode = attrIfExists(attrNode->qualifiedName()); - if (oldAttrNode.get() == attrNode) - return attrNode; // This Attr is already attached to the element. + RefPtr oldAttrNode = attrIfExists(attrNode.qualifiedName()); + if (oldAttrNode.get() == &attrNode) + return &attrNode; // This Attr is already attached to the element. // INUSE_ATTRIBUTE_ERR: Raised if node is an Attr that is already an attribute of another Element object. // The DOM user must explicitly clone Attr nodes to re-use them in other elements. - if (attrNode->ownerElement() && attrNode->ownerElement() != this) { + if (attrNode.ownerElement() && attrNode.ownerElement() != this) { ec = INUSE_ATTRIBUTE_ERR; - return 0; + return nullptr; } synchronizeAllAttributes(); UniqueElementData& elementData = ensureUniqueElementData(); - unsigned index = elementData.findAttributeIndexByName(attrNode->qualifiedName()); + unsigned index = elementData.findAttributeIndexByName(attrNode.qualifiedName()); if (index != ElementData::attributeNotFound) { if (oldAttrNode) detachAttrNodeFromElementWithValue(oldAttrNode.get(), elementData.attributeAt(index).value()); else - oldAttrNode = Attr::create(document(), attrNode->qualifiedName(), elementData.attributeAt(index).value()); + oldAttrNode = Attr::create(document(), attrNode.qualifiedName(), elementData.attributeAt(index).value()); } - setAttributeInternal(index, attrNode->qualifiedName(), attrNode->value(), NotInSynchronizationOfLazyAttribute); + setAttributeInternal(index, attrNode.qualifiedName(), attrNode.value(), NotInSynchronizationOfLazyAttribute); - attrNode->attachToElement(this); - treeScope().adoptIfNeeded(attrNode); - ensureAttrNodeListForElement(*this).append(attrNode); + attrNode.attachToElement(this); + treeScope().adoptIfNeeded(&attrNode); + ensureAttrNodeListForElement(*this).append(&attrNode); return oldAttrNode.release(); } -RefPtr Element::removeAttributeNode(Attr* attr, ExceptionCode& ec) +RefPtr Element::removeAttributeNode(Attr& attr, ExceptionCode& ec) { - if (!attr) { - ec = TYPE_MISMATCH_ERR; - return nullptr; - } - if (attr->ownerElement() != this) { + if (attr.ownerElement() != this) { ec = NOT_FOUND_ERR; return nullptr; } - ASSERT(&document() == &attr->document()); + ASSERT(&document() == &attr.document()); synchronizeAllAttributes(); @@ -2038,15 +2024,15 @@ RefPtr Element::removeAttributeNode(Attr* attr, ExceptionCode& ec) return nullptr; } - unsigned existingAttributeIndex = m_elementData->findAttributeIndexByName(attr->qualifiedName()); + unsigned existingAttributeIndex = m_elementData->findAttributeIndexByName(attr.qualifiedName()); if (existingAttributeIndex == ElementData::attributeNotFound) { ec = NOT_FOUND_ERR; return nullptr; } - RefPtr attrNode = attr; - detachAttrNodeFromElementWithValue(attr, m_elementData->attributeAt(existingAttributeIndex).value()); + RefPtr attrNode = &attr; + detachAttrNodeFromElementWithValue(&attr, m_elementData->attributeAt(existingAttributeIndex).value()); removeAttributeInternal(existingAttributeIndex, NotInSynchronizationOfLazyAttribute); return attrNode; } diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index f6395a6d9708..6fad6e1d93e8 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -170,9 +170,9 @@ class Element : public ContainerNode { RefPtr getAttributeNode(const AtomicString& name); RefPtr getAttributeNodeNS(const AtomicString& namespaceURI, const AtomicString& localName); - RefPtr setAttributeNode(Attr*, ExceptionCode&); - RefPtr setAttributeNodeNS(Attr*, ExceptionCode&); - RefPtr removeAttributeNode(Attr*, ExceptionCode&); + RefPtr setAttributeNode(Attr&, ExceptionCode&); + RefPtr setAttributeNodeNS(Attr&, ExceptionCode&); + RefPtr removeAttributeNode(Attr&, ExceptionCode&); RefPtr attrIfExists(const QualifiedName&); RefPtr attrIfExists(const AtomicString& localName, bool shouldIgnoreAttributeCase); diff --git a/Source/WebCore/dom/Element.idl b/Source/WebCore/dom/Element.idl index 9515eebbaab0..f2bfa563699c 100644 --- a/Source/WebCore/dom/Element.idl +++ b/Source/WebCore/dom/Element.idl @@ -28,20 +28,26 @@ readonly attribute DOMString? tagName; - DOMString? getAttribute([Default=Undefined] optional DOMString name); + // FIXME: Using "undefined" as default parameter value is wrong. + DOMString? getAttribute(optional DOMString name = "undefined"); [ObjCLegacyUnnamedParameters, RaisesException, InvokesCustomElementLifecycleCallbacks] - void setAttribute([Default=Undefined] optional DOMString name, [Default=Undefined] optional DOMString value); - [InvokesCustomElementLifecycleCallbacks] void removeAttribute([Default=Undefined] optional DOMString name); - Attr getAttributeNode([Default=Undefined] optional DOMString name); - [RaisesException, InvokesCustomElementLifecycleCallbacks] Attr setAttributeNode([Default=Undefined] optional Attr newAttr); - [RaisesException, InvokesCustomElementLifecycleCallbacks] Attr removeAttributeNode([Default=Undefined] optional Attr oldAttr); + // FIXME: Using "undefined" as default parameter value is wrong. + void setAttribute(optional DOMString name = "undefined", optional DOMString value = "undefined"); + + // FIXME: Using "undefined" as default parameter value is wrong. + [InvokesCustomElementLifecycleCallbacks] void removeAttribute(optional DOMString name = "undefined"); + Attr getAttributeNode(optional DOMString name = "undefined"); + + [RaisesException, InvokesCustomElementLifecycleCallbacks] Attr setAttributeNode(Attr newAttr); + [RaisesException, InvokesCustomElementLifecycleCallbacks] Attr removeAttributeNode(Attr oldAttr); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName([Default=Undefined] optional DOMString name); + [ImplementedAs=getElementsByTagNameForObjC] NodeList getElementsByTagName(optional DOMString name); #else - HTMLCollection getElementsByTagName([Default=Undefined] optional DOMString name); + // FIXME: Using "undefined" as default parameter value is wrong. + HTMLCollection getElementsByTagName(optional DOMString name = "undefined"); #endif #if !defined(LANGUAGE_OBJECTIVE_C) @@ -52,22 +58,29 @@ // DOM Level 2 Core - [ObjCLegacyUnnamedParameters] DOMString? getAttributeNS([Default=Undefined] optional DOMString? namespaceURI, [Default=Undefined] optional DOMString localName); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters] DOMString? getAttributeNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined"); [ObjCLegacyUnnamedParameters, RaisesException, InvokesCustomElementLifecycleCallbacks] - void setAttributeNS([Default=Undefined] optional DOMString? namespaceURI, [Default=Undefined] optional DOMString qualifiedName, [Default=Undefined] optional DOMString value); + + // FIXME: Using "undefined" as default parameter value is wrong. + void setAttributeNS(optional DOMString? namespaceURI = null, optional DOMString qualifiedName = "undefined", optional DOMString value = "undefined"); [ObjCLegacyUnnamedParameters, InvokesCustomElementLifecycleCallbacks] void removeAttributeNS(DOMString? namespaceURI, DOMString localName); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C [ObjCLegacyUnnamedParameters, ImplementedAs=getElementsByTagNameNSForObjC] NodeList getElementsByTagNameNS(optional DOMString namespaceURI, optional DOMString localName); #else - HTMLCollection getElementsByTagNameNS([Default=Undefined] optional DOMString? namespaceURI, [Default=Undefined] optional DOMString localName); + // FIXME: Using "undefined" as default parameter value is wrong. + HTMLCollection getElementsByTagNameNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined"); #endif - [ObjCLegacyUnnamedParameters] Attr getAttributeNodeNS([Default=Undefined] optional DOMString? namespaceURI, [Default=Undefined] optional DOMString localName); - [RaisesException, InvokesCustomElementLifecycleCallbacks] Attr setAttributeNodeNS([Default=Undefined] optional Attr newAttr); + + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters] Attr getAttributeNodeNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined"); + [RaisesException, InvokesCustomElementLifecycleCallbacks] Attr setAttributeNodeNS(Attr newAttr); boolean hasAttribute(DOMString name); - [ObjCLegacyUnnamedParameters] boolean hasAttributeNS([Default=Undefined] optional DOMString? namespaceURI, [Default=Undefined] optional DOMString localName); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters] boolean hasAttributeNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined"); [ImplementedAs=cssomStyle] readonly attribute CSSStyleDeclaration style; @@ -115,14 +128,15 @@ // WebKit extensions void scrollIntoViewIfNeeded(optional boolean centerIfNeeded); - void scrollByLines([Default=Undefined] optional long lines); - void scrollByPages([Default=Undefined] optional long pages); + void scrollByLines(optional long lines = 0); + void scrollByPages(optional long pages = 0); // HTML 5 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName([Default=Undefined] optional DOMString name); + [ImplementedAs=getElementsByClassNameForObjC] NodeList getElementsByClassName(optional DOMString name); #else - HTMLCollection getElementsByClassName([Default=Undefined] optional DOMString name); + // FIXME: Using "undefined" as default parameter value is wrong. + HTMLCollection getElementsByClassName(optional DOMString name = "undefined"); #endif [TreatNullAs=EmptyString, SetterRaisesException] attribute DOMString innerHTML; [TreatNullAs=EmptyString, SetterRaisesException] attribute DOMString outerHTML; @@ -153,7 +167,7 @@ #if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API // Mozilla version const unsigned short ALLOW_KEYBOARD_INPUT = 1; - void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags); + void webkitRequestFullScreen(optional unsigned short flags = 0); // W3C version void webkitRequestFullscreen(); diff --git a/Source/WebCore/dom/Event.idl b/Source/WebCore/dom/Event.idl index e1c6bd577e73..b5f7a6734691 100644 --- a/Source/WebCore/dom/Event.idl +++ b/Source/WebCore/dom/Event.idl @@ -65,9 +65,11 @@ void stopPropagation(); void preventDefault(); - [ObjCLegacyUnnamedParameters] void initEvent([Default=Undefined] optional DOMString eventTypeArg, - [Default=Undefined] optional boolean canBubbleArg, - [Default=Undefined] optional boolean cancelableArg); + + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters] void initEvent(optional DOMString eventTypeArg = "undefined", + optional boolean canBubbleArg = false, + optional boolean cancelableArg = false); // DOM Level 3 Additions. readonly attribute boolean defaultPrevented; diff --git a/Source/WebCore/dom/HashChangeEvent.idl b/Source/WebCore/dom/HashChangeEvent.idl index 8674ffcd99f3..4aab4cb77cb7 100644 --- a/Source/WebCore/dom/HashChangeEvent.idl +++ b/Source/WebCore/dom/HashChangeEvent.idl @@ -21,11 +21,12 @@ [ ConstructorTemplate=Event, ] interface HashChangeEvent : Event { - void initHashChangeEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean canBubble, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional DOMString oldURL, - [Default=Undefined] optional DOMString newURL); + // FIXME: Using "undefined" as default parameter value is wrong. + void initHashChangeEvent(optional DOMString type = "undefined", + optional boolean canBubble = false, + optional boolean cancelable = false, + optional DOMString oldURL = "undefined", + optional DOMString newURL = "undefined"); [InitializedByEventConstructor] readonly attribute DOMString oldURL; [InitializedByEventConstructor] readonly attribute DOMString newURL; }; diff --git a/Source/WebCore/dom/KeyboardEvent.idl b/Source/WebCore/dom/KeyboardEvent.idl index 550717b63607..77dc061ae823 100644 --- a/Source/WebCore/dom/KeyboardEvent.idl +++ b/Source/WebCore/dom/KeyboardEvent.idl @@ -52,63 +52,65 @@ readonly attribute boolean altGraphKey; #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT - boolean getModifierState([Default=Undefined] optional DOMString keyIdentifierArg); + boolean getModifierState(optional DOMString keyIdentifierArg); #endif // FIXME: this does not match the version in the DOM spec. - void initKeyboardEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean canBubble, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional DOMString keyIdentifier, - [Default=Undefined] optional unsigned long location, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey, - [Default=Undefined] optional boolean altGraphKey); + // FIXME: Using "undefined" as default parameter value is wrong. + void initKeyboardEvent(optional DOMString type = "undefined", + optional boolean canBubble = false, + optional boolean cancelable = false, + optional DOMWindow? view = null, + optional DOMString keyIdentifier = "undefined", + optional unsigned long location = 0, + optional boolean ctrlKey = false, + optional boolean altKey = false, + optional boolean shiftKey = false, + optional boolean metaKey = false, + optional boolean altGraphKey = false); // WebKit Extensions #if (!defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT) && (!defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT) readonly attribute long keyCode; readonly attribute long charCode; - void initKeyboardEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean canBubble, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional DOMString keyIdentifier, - [Default=Undefined] optional unsigned long location, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey); + // FIXME: Using "undefined" as default parameter value is wrong. + void initKeyboardEvent(optional DOMString type = "undefined", + optional boolean canBubble = false, + optional boolean cancelable = false, + optional DOMWindow? view = null, + optional DOMString keyIdentifier = "undefined", + optional unsigned long location = 0, + optional boolean ctrlKey = false, + optional boolean altKey = false, + optional boolean shiftKey = false, + optional boolean metaKey = false); #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C // For backward compatibility. - void initKeyboardEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean canBubble, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional DOMString keyIdentifier, - [Default=Undefined] optional unsigned long keyLocation, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey, - [Default=Undefined] optional boolean altGraphKey); + void initKeyboardEvent(optional DOMString type, + optional boolean canBubble, + optional boolean cancelable, + optional DOMWindow? view, + optional DOMString keyIdentifier, + optional unsigned long keyLocation, + optional boolean ctrlKey, + optional boolean altKey, + optional boolean shiftKey, + optional boolean metaKey, + optional boolean altGraphKey); - void initKeyboardEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean canBubble, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional DOMString keyIdentifier, - [Default=Undefined] optional unsigned long keyLocation, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey); + void initKeyboardEvent(optional DOMString type, + optional boolean canBubble, + optional boolean cancelable, + optional DOMWindow? view, + optional DOMString keyIdentifier, + optional unsigned long keyLocation, + optional boolean ctrlKey, + optional boolean altKey, + optional boolean shiftKey, + optional boolean metaKey); #endif }; diff --git a/Source/WebCore/dom/MessageEvent.idl b/Source/WebCore/dom/MessageEvent.idl index 74750a3dd0c4..8cb608aa02c6 100644 --- a/Source/WebCore/dom/MessageEvent.idl +++ b/Source/WebCore/dom/MessageEvent.idl @@ -32,27 +32,28 @@ [InitializedByEventConstructor] readonly attribute DOMString origin; [InitializedByEventConstructor] readonly attribute DOMString lastEventId; [InitializedByEventConstructor] readonly attribute EventTarget source; // May be a DOMWindow or a MessagePort. + #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT [InitializedByEventConstructor, CachedAttribute, CustomGetter] readonly attribute any data; [InitializedByEventConstructor] readonly attribute MessagePort[] ports; - [Custom] void initMessageEvent([Default=Undefined] optional DOMString typeArg, - [Default=Undefined] optional boolean canBubbleArg, - [Default=Undefined] optional boolean cancelableArg, - [Default=Undefined] optional any dataArg, - [Default=Undefined] optional DOMString originArg, - [Default=Undefined] optional DOMString lastEventIdArg, - [Default=Undefined] optional DOMWindow sourceArg, - [Default=Undefined] optional Array messagePorts); + [Custom] void initMessageEvent(optional DOMString typeArg, + optional boolean canBubbleArg, + optional boolean cancelableArg, + optional any dataArg, + optional DOMString originArg, + optional DOMString lastEventIdArg, + optional DOMWindow sourceArg, + optional Array messagePorts); - [Custom] void webkitInitMessageEvent([Default=Undefined] optional DOMString typeArg, - [Default=Undefined] optional boolean canBubbleArg, - [Default=Undefined] optional boolean cancelableArg, - [Default=Undefined] optional any dataArg, - [Default=Undefined] optional DOMString originArg, - [Default=Undefined] optional DOMString lastEventIdArg, - [Default=Undefined] optional DOMWindow sourceArg, - [Default=Undefined] optional Array transferables); + [Custom] void webkitInitMessageEvent(optional DOMString typeArg, + optional boolean canBubbleArg, + optional boolean cancelableArg, + optional any dataArg, + optional DOMString originArg, + optional DOMString lastEventIdArg, + optional DOMWindow sourceArg, + optional Array transferables); #else // Code generator for ObjC bindings does not support custom bindings, thus there is no good way to // return a variant value. As workaround, expose the data attribute as SerializedScriptValue. @@ -61,14 +62,14 @@ // There's no good way to expose an array via the ObjC bindings, so for now just expose a single port. readonly attribute MessagePort messagePort; - void initMessageEvent([Default=Undefined] optional DOMString typeArg, - [Default=Undefined] optional boolean canBubbleArg, - [Default=Undefined] optional boolean cancelableArg, - [Default=Undefined] optional SerializedScriptValue dataArg, - [Default=Undefined] optional DOMString originArg, - [Default=Undefined] optional DOMString lastEventIdArg, - [Default=Undefined] optional DOMWindow sourceArg, - [Default=Undefined] optional MessagePort messagePort); + void initMessageEvent(optional DOMString typeArg, + optional boolean canBubbleArg, + optional boolean cancelableArg, + optional SerializedScriptValue? dataArg, + optional DOMString originArg, + optional DOMString lastEventIdArg, + optional DOMWindow? sourceArg, + optional MessagePort? messagePort); #endif }; diff --git a/Source/WebCore/dom/MouseEvent.idl b/Source/WebCore/dom/MouseEvent.idl index d388f34c8919..1edc741ed0ef 100644 --- a/Source/WebCore/dom/MouseEvent.idl +++ b/Source/WebCore/dom/MouseEvent.idl @@ -43,21 +43,22 @@ [Conditional=MOUSE_FORCE_EVENTS, ImplementedAs=force]readonly attribute double webkitForce; #endif - [ObjCLegacyUnnamedParameters] void initMouseEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean canBubble, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional long detail, - [Default=Undefined] optional long screenX, - [Default=Undefined] optional long screenY, - [Default=Undefined] optional long clientX, - [Default=Undefined] optional long clientY, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey, - [Default=Undefined] optional unsigned short button, - [Default=Undefined] optional EventTarget relatedTarget); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters] void initMouseEvent(optional DOMString type = "undefined", + optional boolean canBubble = false, + optional boolean cancelable = false, + optional DOMWindow? view = null, + optional long detail = 0, + optional long screenX = 0, + optional long screenY = 0, + optional long clientX = 0, + optional long clientY = 0, + optional boolean ctrlKey = false, + optional boolean altKey = false, + optional boolean shiftKey = false, + optional boolean metaKey = false, + optional unsigned short button = 0, + optional EventTarget? relatedTarget = null); // extensions readonly attribute long offsetX; diff --git a/Source/WebCore/dom/MutationEvent.idl b/Source/WebCore/dom/MutationEvent.idl index 54b52410e5c1..4033fb2289b9 100644 --- a/Source/WebCore/dom/MutationEvent.idl +++ b/Source/WebCore/dom/MutationEvent.idl @@ -31,14 +31,15 @@ interface MutationEvent : Event { readonly attribute DOMString attrName; readonly attribute unsigned short attrChange; - [ObjCLegacyUnnamedParameters] void initMutationEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean canBubble, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional Node relatedNode, - [Default=Undefined] optional DOMString prevValue, - [Default=Undefined] optional DOMString newValue, - [Default=Undefined] optional DOMString attrName, - [Default=Undefined] optional unsigned short attrChange); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters] void initMutationEvent(optional DOMString type = "undefined", + optional boolean canBubble = false, + optional boolean cancelable = false, + optional Node? relatedNode = null, + optional DOMString prevValue = "undefined", + optional DOMString newValue = "undefined", + optional DOMString attrName = "undefined", + optional unsigned short attrChange = 0); }; diff --git a/Source/WebCore/dom/NamedNodeMap.cpp b/Source/WebCore/dom/NamedNodeMap.cpp index 2e0adf0becbc..195e79bbb647 100644 --- a/Source/WebCore/dom/NamedNodeMap.cpp +++ b/Source/WebCore/dom/NamedNodeMap.cpp @@ -79,15 +79,10 @@ RefPtr NamedNodeMap::removeNamedItemNS(const AtomicString& namespaceURI, c return m_element.detachAttribute(index); } -RefPtr NamedNodeMap::setNamedItem(Node* node, ExceptionCode& ec) +RefPtr NamedNodeMap::setNamedItem(Node& node, ExceptionCode& ec) { - if (!node) { - ec = NOT_FOUND_ERR; - return nullptr; - } - // Not mentioned in spec: throw a HIERARCHY_REQUEST_ERROR if the user passes in a non-attribute node - if (!is(*node)) { + if (!is(node)) { ec = HIERARCHY_REQUEST_ERR; return nullptr; } @@ -95,7 +90,7 @@ RefPtr NamedNodeMap::setNamedItem(Node* node, ExceptionCode& ec) return m_element.setAttributeNode(downcast(node), ec); } -RefPtr NamedNodeMap::setNamedItemNS(Node* node, ExceptionCode& ec) +RefPtr NamedNodeMap::setNamedItemNS(Node& node, ExceptionCode& ec) { return setNamedItem(node, ec); } diff --git a/Source/WebCore/dom/NamedNodeMap.h b/Source/WebCore/dom/NamedNodeMap.h index 49bd29f421f8..1cf0e345c919 100644 --- a/Source/WebCore/dom/NamedNodeMap.h +++ b/Source/WebCore/dom/NamedNodeMap.h @@ -58,8 +58,8 @@ class NamedNodeMap : public ScriptWrappable { RefPtr getNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName) const; RefPtr removeNamedItemNS(const AtomicString& namespaceURI, const AtomicString& localName, ExceptionCode&); - RefPtr setNamedItem(Node*, ExceptionCode&); - RefPtr setNamedItemNS(Node*, ExceptionCode&); + RefPtr setNamedItem(Node&, ExceptionCode&); + RefPtr setNamedItemNS(Node&, ExceptionCode&); RefPtr item(unsigned index) const; unsigned length() const; diff --git a/Source/WebCore/dom/NamedNodeMap.idl b/Source/WebCore/dom/NamedNodeMap.idl index 4ab220ccf2a3..d786acf4178f 100644 --- a/Source/WebCore/dom/NamedNodeMap.idl +++ b/Source/WebCore/dom/NamedNodeMap.idl @@ -23,15 +23,17 @@ ImplementationLacksVTable, ] interface NamedNodeMap { - getter Node getNamedItem([Default=Undefined] optional DOMString name); - [RaisesException] Node setNamedItem([Default=Undefined] optional Node node); - [RaisesException] Node removeNamedItem([Default=Undefined] optional DOMString name); - getter Node item([Default=Undefined] optional unsigned long index); + // FIXME: Using "undefined" as default parameter value is wrong. + getter Node getNamedItem(optional DOMString name = "undefined"); + [RaisesException] Node setNamedItem(Node node); + [RaisesException] Node removeNamedItem(optional DOMString name = "undefined"); + getter Node item(optional unsigned long index = 0); readonly attribute unsigned long length; // Introduced in DOM Level 2: - [ObjCLegacyUnnamedParameters] Node getNamedItemNS([Default=Undefined] optional DOMString? namespaceURI, [Default=Undefined] optional DOMString localName); - [RaisesException] Node setNamedItemNS([Default=Undefined] optional Node node); - [ObjCLegacyUnnamedParameters, RaisesException] Node removeNamedItemNS([Default=Undefined] optional DOMString? namespaceURI, [Default=Undefined] optional DOMString localName); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters] Node getNamedItemNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined"); + [RaisesException] Node setNamedItemNS(Node node); + [ObjCLegacyUnnamedParameters, RaisesException] Node removeNamedItemNS(optional DOMString? namespaceURI = null, optional DOMString localName = "undefined"); }; diff --git a/Source/WebCore/dom/Node.idl b/Source/WebCore/dom/Node.idl index e25ac2ed1433..c2435103f622 100644 --- a/Source/WebCore/dom/Node.idl +++ b/Source/WebCore/dom/Node.idl @@ -74,7 +74,7 @@ boolean hasChildNodes(); [NewObject, RaisesException, ImplementedAs=cloneNodeForBindings, InvokesCustomElementLifecycleCallbacks] - Node cloneNode([Default=Undefined] optional boolean deep); + Node cloneNode(optional boolean deep = false); void normalize(); @@ -101,11 +101,12 @@ // FIXME: the spec says this can also raise on retrieval. [SetterRaisesException] attribute DOMString? textContent; - boolean isSameNode([Default=Undefined] optional Node other); - boolean isEqualNode([Default=Undefined] optional Node other); - DOMString? lookupPrefix([Default=Undefined] optional DOMString? namespaceURI); - boolean isDefaultNamespace([Default=Undefined] optional DOMString? namespaceURI); - DOMString? lookupNamespaceURI([Default=Undefined] optional DOMString? prefix); + boolean isSameNode(optional Node other = null); + boolean isEqualNode(optional Node other = null); + + DOMString? lookupPrefix(optional DOMString? namespaceURI = null); + boolean isDefaultNamespace(optional DOMString? namespaceURI = null); + DOMString? lookupNamespaceURI(optional DOMString? prefix = null); // DocumentPosition const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; @@ -115,10 +116,10 @@ const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; - unsigned short compareDocumentPosition([Default=Undefined] optional Node other); + unsigned short compareDocumentPosition(optional Node other = null); // Introduced in DOM4 - boolean contains([Default=Undefined] optional Node other); + boolean contains(optional Node other = null); // IE extensions readonly attribute Element parentElement; diff --git a/Source/WebCore/dom/NodeFilter.idl b/Source/WebCore/dom/NodeFilter.idl index 7ed0dd13100f..fc70397d2102 100644 --- a/Source/WebCore/dom/NodeFilter.idl +++ b/Source/WebCore/dom/NodeFilter.idl @@ -44,9 +44,9 @@ const unsigned long SHOW_NOTATION = 0x00000800; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - short acceptNode([Default=Undefined] optional Node n); + short acceptNode(optional Node n); #else - [Custom] unsigned short acceptNode([Default=Undefined] optional Node n); + [Custom] unsigned short acceptNode(optional Node node); #endif }; diff --git a/Source/WebCore/dom/NonElementParentNode.idl b/Source/WebCore/dom/NonElementParentNode.idl index 0623a45b2758..3311183c2c61 100644 --- a/Source/WebCore/dom/NonElementParentNode.idl +++ b/Source/WebCore/dom/NonElementParentNode.idl @@ -28,5 +28,6 @@ [ NoInterfaceObject, ] interface NonElementParentNode { - Element getElementById([Default=Undefined,ObjCExplicitAtomicString,RequiresExistingAtomicString] optional DOMString elementId); + // FIXME: Using "undefined" as default parameter value is wrong. + Element getElementById([ObjCExplicitAtomicString,RequiresExistingAtomicString] optional DOMString elementId = "undefined"); }; diff --git a/Source/WebCore/dom/OverflowEvent.idl b/Source/WebCore/dom/OverflowEvent.idl index 577023f6e726..f530bf5962e7 100644 --- a/Source/WebCore/dom/OverflowEvent.idl +++ b/Source/WebCore/dom/OverflowEvent.idl @@ -35,9 +35,9 @@ [InitializedByEventConstructor] readonly attribute boolean verticalOverflow; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - void initOverflowEvent([Default=Undefined] optional unsigned short orient, - [Default=Undefined] optional boolean horizontalOverflow, - [Default=Undefined] optional boolean verticalOverflow); + void initOverflowEvent(optional unsigned short orient, + optional boolean horizontalOverflow, + optional boolean verticalOverflow); #endif }; diff --git a/Source/WebCore/dom/Range.idl b/Source/WebCore/dom/Range.idl index a758683927eb..4f8b54eaecbb 100644 --- a/Source/WebCore/dom/Range.idl +++ b/Source/WebCore/dom/Range.idl @@ -33,15 +33,13 @@ readonly attribute boolean collapsed; readonly attribute Node commonAncestorContainer; - [ObjCLegacyUnnamedParameters, RaisesException] void setStart(Node refNode, - [Default=Undefined] optional long offset); - [ObjCLegacyUnnamedParameters, RaisesException] void setEnd(Node refNode, - [Default=Undefined] optional long offset); + [ObjCLegacyUnnamedParameters, RaisesException] void setStart(Node refNode, optional long offset = 0); + [ObjCLegacyUnnamedParameters, RaisesException] void setEnd(Node refNode, optional long offset = 0); [RaisesException] void setStartBefore(Node refNode); [RaisesException] void setStartAfter(Node refNode); [RaisesException] void setEndBefore(Node refNode); [RaisesException] void setEndAfter(Node refNode); - void collapse([Default=Undefined] optional boolean toStart); + void collapse(optional boolean toStart = false); [RaisesException] void selectNode(Node refNode); [RaisesException] void selectNodeContents(Node refNode); @@ -51,7 +49,7 @@ const unsigned short END_TO_END = 2; const unsigned short END_TO_START = 3; - [ObjCLegacyUnnamedParameters, RaisesException, ImplementedAs=compareBoundaryPointsForBindings] short compareBoundaryPoints([Default=Undefined] optional unsigned short how, Range sourceRange); + [ObjCLegacyUnnamedParameters, RaisesException, ImplementedAs=compareBoundaryPointsForBindings] short compareBoundaryPoints(optional unsigned short how = 0, Range sourceRange); [RaisesException] void deleteContents(); [RaisesException, NewObject] DocumentFragment extractContents(); @@ -72,7 +70,8 @@ // extensions - [RaisesException] DocumentFragment createContextualFragment([Default=Undefined] optional DOMString html); + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] DocumentFragment createContextualFragment(optional DOMString html = "undefined"); // WebKit extensions @@ -84,11 +83,12 @@ const unsigned short NODE_BEFORE_AND_AFTER = 2; const unsigned short NODE_INSIDE = 3; - [RaisesException] short comparePoint(Node refNode, [Default=Undefined] optional long offset); + [RaisesException] short comparePoint(Node refNode, optional long offset = 0); [RaisesException] boolean intersectsNode(Node refNode); - [RaisesException] boolean isPointInRange(Node refNode, [Default=Undefined] optional long offset); + [RaisesException] boolean isPointInRange(Node refNode, optional long offset = 0); - [RaisesException] void expand([Default=Undefined] optional DOMString unit); + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] void expand(optional DOMString unit = "undefined"); #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT readonly attribute DOMString text; diff --git a/Source/WebCore/dom/Text.idl b/Source/WebCore/dom/Text.idl index 9df82a2a6347..f296a4a24962 100644 --- a/Source/WebCore/dom/Text.idl +++ b/Source/WebCore/dom/Text.idl @@ -17,7 +17,7 @@ * Boston, MA 02110-1301, USA. */ [ - Constructor([Default=NullString] optional DOMString data), + Constructor(optional DOMString data = null), ConstructorCallWith=Document ] interface Text : CharacterData { @@ -27,6 +27,8 @@ // Introduced in DOM Level 3: readonly attribute DOMString wholeText; - [RaisesException] Text replaceWholeText([Default=Undefined] optional DOMString content); + + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] Text replaceWholeText(optional DOMString content = "undefined"); }; diff --git a/Source/WebCore/dom/TextEvent.idl b/Source/WebCore/dom/TextEvent.idl index 98b591bd9997..364065fa82d4 100644 --- a/Source/WebCore/dom/TextEvent.idl +++ b/Source/WebCore/dom/TextEvent.idl @@ -28,11 +28,12 @@ interface TextEvent : UIEvent { readonly attribute DOMString data; - void initTextEvent([Default=Undefined] optional DOMString typeArg, - [Default=Undefined] optional boolean canBubbleArg, - [Default=Undefined] optional boolean cancelableArg, - [Default=Undefined] optional DOMWindow viewArg, - [Default=Undefined] optional DOMString dataArg); + // FIXME: Using "undefined" as default parameter value is wrong. + void initTextEvent(optional DOMString typeArg = "undefined", + optional boolean canBubbleArg = false, + optional boolean cancelableArg = false, + optional DOMWindow? viewArg = null, + optional DOMString dataArg = "undefined"); }; diff --git a/Source/WebCore/dom/TouchEvent.idl b/Source/WebCore/dom/TouchEvent.idl index 07ce747a6043..cb10c145998b 100644 --- a/Source/WebCore/dom/TouchEvent.idl +++ b/Source/WebCore/dom/TouchEvent.idl @@ -34,17 +34,18 @@ readonly attribute boolean altKey; readonly attribute boolean metaKey; - void initTouchEvent([Default=Undefined] optional TouchList touches, - [Default=Undefined] optional TouchList targetTouches, - [Default=Undefined] optional TouchList changedTouches, - [Default=Undefined] optional DOMString type, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional long screenX, - [Default=Undefined] optional long screenY, - [Default=Undefined] optional long clientX, - [Default=Undefined] optional long clientY, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey); + // FIXME: Using "undefined" as default parameter value is wrong. + void initTouchEvent(optional TouchList? touches = null, + optional TouchList? targetTouches = null, + optional TouchList? changedTouches = null, + optional DOMString type = "undefined", + optional DOMWindow? view = null, + optional long screenX = 0, + optional long screenY = 0, + optional long clientX = 0, + optional long clientY = 0, + optional boolean ctrlKey = false, + optional boolean altKey = false, + optional boolean shiftKey = false, + optional boolean metaKey = false); }; diff --git a/Source/WebCore/dom/UIEvent.idl b/Source/WebCore/dom/UIEvent.idl index 7d33ef297f79..33d45e1b2b29 100644 --- a/Source/WebCore/dom/UIEvent.idl +++ b/Source/WebCore/dom/UIEvent.idl @@ -24,11 +24,12 @@ [InitializedByEventConstructor] readonly attribute DOMWindow view; [InitializedByEventConstructor] readonly attribute long detail; - [ObjCLegacyUnnamedParameters] void initUIEvent([Default=Undefined] optional DOMString type, - [Default=Undefined] optional boolean canBubble, - [Default=Undefined] optional boolean cancelable, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional long detail); + // FIXME: Using "undefined" as default parameter value is wrong. + [ObjCLegacyUnnamedParameters] void initUIEvent(optional DOMString type = "undefined", + optional boolean canBubble = false, + optional boolean cancelable = false, + optional DOMWindow? view = null, + optional long detail = 0); // extensions readonly attribute long keyCode; diff --git a/Source/WebCore/dom/WheelEvent.idl b/Source/WebCore/dom/WheelEvent.idl index 687966adbae5..3d3439c268d1 100644 --- a/Source/WebCore/dom/WheelEvent.idl +++ b/Source/WebCore/dom/WheelEvent.idl @@ -47,30 +47,30 @@ #endif /* defined(LANGUAGE_OBJECTIVE_C) */ #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT - void initWheelEvent([Default=Undefined] optional long wheelDeltaX, - [Default=Undefined] optional long wheelDeltaY, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional long screenX, - [Default=Undefined] optional long screenY, - [Default=Undefined] optional long clientX, - [Default=Undefined] optional long clientY, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey); + void initWheelEvent(optional long wheelDeltaX, + optional long wheelDeltaY, + optional DOMWindow? view, + optional long screenX, + optional long screenY, + optional long clientX, + optional long clientY, + optional boolean ctrlKey, + optional boolean altKey, + optional boolean shiftKey, + optional boolean metaKey); #endif /* !defined(LANGUAGE_JAVASCRIPT) */ #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - void initWebKitWheelEvent([Default=Undefined] optional long wheelDeltaX, - [Default=Undefined] optional long wheelDeltaY, - [Default=Undefined] optional DOMWindow view, - [Default=Undefined] optional long screenX, - [Default=Undefined] optional long screenY, - [Default=Undefined] optional long clientX, - [Default=Undefined] optional long clientY, - [Default=Undefined] optional boolean ctrlKey, - [Default=Undefined] optional boolean altKey, - [Default=Undefined] optional boolean shiftKey, - [Default=Undefined] optional boolean metaKey); + void initWebKitWheelEvent(optional long wheelDeltaX = 0, + optional long wheelDeltaY = 0, + optional DOMWindow? view = null, + optional long screenX = 0, + optional long screenY = 0, + optional long clientX = 0, + optional long clientY = 0, + optional boolean ctrlKey = false, + optional boolean altKey = false, + optional boolean shiftKey = false, + optional boolean metaKey = false); #endif /* defined(LANGUAGE_JAVASCRIPT) */ }; diff --git a/Source/WebCore/html/DOMFormData.idl b/Source/WebCore/html/DOMFormData.idl index 0035347bab3b..8b03aa39c364 100644 --- a/Source/WebCore/html/DOMFormData.idl +++ b/Source/WebCore/html/DOMFormData.idl @@ -37,8 +37,8 @@ ] interface DOMFormData { // void append(DOMString name, DOMString value); // void append(DOMString name, Blob value, optional DOMString filename); - [Custom] void append([Default=Undefined] optional DOMString name, - [Default=Undefined] optional DOMString value, - [Default=Undefined] optional DOMString filename); + [Custom] void append(optional DOMString name, + optional DOMString value, + optional DOMString filename); }; diff --git a/Source/WebCore/html/HTMLAllCollection.idl b/Source/WebCore/html/HTMLAllCollection.idl index bc5e63ab2aa2..dcddf1ee7b59 100644 --- a/Source/WebCore/html/HTMLAllCollection.idl +++ b/Source/WebCore/html/HTMLAllCollection.idl @@ -29,7 +29,7 @@ GenerateIsReachable=ImplOwnerNodeRoot, ] interface HTMLAllCollection { readonly attribute unsigned long length; - [Custom] getter Element item([Default=Undefined] optional unsigned long index); + [Custom] getter Element item(optional unsigned long index); [Custom] getter Element namedItem(DOMString name); // FIXME: This should return an HTMLAllCollection. NodeList tags(DOMString name); diff --git a/Source/WebCore/html/HTMLAudioElement.idl b/Source/WebCore/html/HTMLAudioElement.idl index 30e5d90a0177..71db7fc9d435 100644 --- a/Source/WebCore/html/HTMLAudioElement.idl +++ b/Source/WebCore/html/HTMLAudioElement.idl @@ -26,6 +26,6 @@ [ EnabledAtRuntime, Conditional=VIDEO, - NamedConstructor=Audio([Default=NullString] optional DOMString src) + NamedConstructor=Audio(optional DOMString src = null) ] interface HTMLAudioElement : HTMLMediaElement { }; diff --git a/Source/WebCore/html/HTMLCanvasElement.idl b/Source/WebCore/html/HTMLCanvasElement.idl index 074ca8e81b21..f3542a25046b 100644 --- a/Source/WebCore/html/HTMLCanvasElement.idl +++ b/Source/WebCore/html/HTMLCanvasElement.idl @@ -40,8 +40,8 @@ #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C // The custom binding is needed to handle context creation attributes. - [Custom] any getContext([Default=Undefined] optional DOMString contextId); - [Custom] any probablySupportsContext([Default=Undefined] optional DOMString contextId); + [Custom] any getContext(optional DOMString contextId); + [Custom] any probablySupportsContext(optional DOMString contextId); #endif }; diff --git a/Source/WebCore/html/HTMLCollection.idl b/Source/WebCore/html/HTMLCollection.idl index e55459a86c19..ee28cda9b8f4 100644 --- a/Source/WebCore/html/HTMLCollection.idl +++ b/Source/WebCore/html/HTMLCollection.idl @@ -27,15 +27,17 @@ readonly attribute unsigned long length; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT - getter Node item([Default=Undefined] optional unsigned long index); - getter Node namedItem([Default=Undefined] optional DOMString name); + getter Node item(optional unsigned long index); + getter Node namedItem(optional DOMString name); #else - getter Element item([Default=Undefined] optional unsigned long index); - getter Element namedItem([Default=Undefined] optional DOMString name); + getter Element item(optional unsigned long index = 0); + + // FIXME: Using "undefined" as default parameter value is wrong. + getter Element namedItem(optional DOMString name = "undefined"); #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - NodeList tags([Default=Undefined] optional DOMString name); + NodeList tags(optional DOMString name); #endif }; diff --git a/Source/WebCore/html/HTMLDocument.idl b/Source/WebCore/html/HTMLDocument.idl index 9b808ca03957..41d097cb438f 100644 --- a/Source/WebCore/html/HTMLDocument.idl +++ b/Source/WebCore/html/HTMLDocument.idl @@ -26,8 +26,8 @@ ] interface HTMLDocument : Document { [Custom, ForwardDeclareInHeader] void open(); void close(); - [Custom] void write([Default=Undefined] optional DOMString text); - [Custom] void writeln([Default=Undefined] optional DOMString text); + [Custom] void write(optional DOMString text); + [Custom] void writeln(optional DOMString text); readonly attribute HTMLCollection embeds; readonly attribute HTMLCollection plugins; diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp index c0834a2b88ba..56aeed59912b 100644 --- a/Source/WebCore/html/HTMLElement.cpp +++ b/Source/WebCore/html/HTMLElement.cpp @@ -660,15 +660,9 @@ Node* HTMLElement::insertAdjacent(const String& where, Ref&& newChild, Exc return nullptr; } -Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChild, ExceptionCode& ec) +Element* HTMLElement::insertAdjacentElement(const String& where, Element& newChild, ExceptionCode& ec) { - if (!newChild) { - // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative. - ec = TYPE_MISMATCH_ERR; - return nullptr; - } - - Node* returnValue = insertAdjacent(where, *newChild, ec); + Node* returnValue = insertAdjacent(where, newChild, ec); ASSERT_WITH_SECURITY_IMPLICATION(!returnValue || is(*returnValue)); return downcast(returnValue); } diff --git a/Source/WebCore/html/HTMLElement.h b/Source/WebCore/html/HTMLElement.h index cd5bd201e5cd..7c366393558e 100644 --- a/Source/WebCore/html/HTMLElement.h +++ b/Source/WebCore/html/HTMLElement.h @@ -49,7 +49,7 @@ class HTMLElement : public StyledElement { void setInnerText(const String&, ExceptionCode&); void setOuterText(const String&, ExceptionCode&); - Element* insertAdjacentElement(const String& where, Element* newChild, ExceptionCode&); + Element* insertAdjacentElement(const String& where, Element& newChild, ExceptionCode&); void insertAdjacentHTML(const String& where, const String& html, ExceptionCode&); void insertAdjacentText(const String& where, const String& text, ExceptionCode&); diff --git a/Source/WebCore/html/HTMLElement.idl b/Source/WebCore/html/HTMLElement.idl index 7a758e3f1fc3..a6c9091d4e57 100644 --- a/Source/WebCore/html/HTMLElement.idl +++ b/Source/WebCore/html/HTMLElement.idl @@ -43,10 +43,12 @@ [TreatNullAs=EmptyString, SetterRaisesException] attribute DOMString innerText; [TreatNullAs=EmptyString, SetterRaisesException] attribute DOMString outerText; - - [RaisesException] Element insertAdjacentElement([Default=Undefined] optional DOMString where, [Default=Undefined] optional Element element); - [RaisesException] void insertAdjacentHTML([Default=Undefined] optional DOMString where, [Default=Undefined] optional DOMString html); - [RaisesException] void insertAdjacentText([Default=Undefined] optional DOMString where, [Default=Undefined] optional DOMString text); + + [RaisesException] Element insertAdjacentElement(DOMString where, Element element); + + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] void insertAdjacentHTML(optional DOMString where = "undefined", optional DOMString html = "undefined"); + [RaisesException] void insertAdjacentText(optional DOMString where = "undefined", optional DOMString text = "undefined"); [SetterRaisesException] attribute DOMString contentEditable; readonly attribute boolean isContentEditable; diff --git a/Source/WebCore/html/HTMLFormControlsCollection.idl b/Source/WebCore/html/HTMLFormControlsCollection.idl index 49819418b0a9..6df80bbc5abf 100644 --- a/Source/WebCore/html/HTMLFormControlsCollection.idl +++ b/Source/WebCore/html/HTMLFormControlsCollection.idl @@ -21,6 +21,6 @@ [ GenerateIsReachable=ImplOwnerNodeRoot, ] interface HTMLFormControlsCollection : HTMLCollection { - getter HTMLElement ([Default=Undefined] optional unsigned long index); - [Custom] getter HTMLElement namedItem([Default=Undefined] optional DOMString name); + getter HTMLElement (optional unsigned long index = 0); + [Custom] getter HTMLElement namedItem(optional DOMString name); }; diff --git a/Source/WebCore/html/HTMLInputElement.idl b/Source/WebCore/html/HTMLInputElement.idl index 7e2ef20f75c1..9d76f9423387 100644 --- a/Source/WebCore/html/HTMLInputElement.idl +++ b/Source/WebCore/html/HTMLInputElement.idl @@ -92,13 +92,13 @@ [RaisesException] void setRangeText(DOMString replacement, unsigned long start, unsigned long end, - [Default=NullString] optional DOMString selectionMode); + optional DOMString selectionMode = null); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C [Custom] void setSelectionRange(long start, long end); #else - [Custom] void setSelectionRange([Default=Undefined] optional long start, - [Default=Undefined] optional long end, + [Custom] void setSelectionRange(optional long start, + optional long end, optional DOMString direction); #endif diff --git a/Source/WebCore/html/HTMLMediaElement.idl b/Source/WebCore/html/HTMLMediaElement.idl index f1303728dc99..87e028a1e213 100644 --- a/Source/WebCore/html/HTMLMediaElement.idl +++ b/Source/WebCore/html/HTMLMediaElement.idl @@ -46,10 +46,12 @@ readonly attribute TimeRanges buffered; void load(); + + // FIXME: Using "undefined" as default parameter value is wrong. #if (defined(ENABLE_ENCRYPTED_MEDIA) && ENABLE_ENCRYPTED_MEDIA) || (defined(ENABLE_ENCRYPTED_MEDIA_V2) && ENABLE_ENCRYPTED_MEDIA_V2) - DOMString canPlayType([Default=Undefined] optional DOMString type, optional DOMString? keySystem); + DOMString canPlayType(optional DOMString type = "undefined", optional DOMString? keySystem); #else - DOMString canPlayType([Default=Undefined] optional DOMString type); + DOMString canPlayType(optional DOMString type = "undefined"); #endif // ready state @@ -97,8 +99,8 @@ #if (!defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT) && (!defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C) [Conditional=ENCRYPTED_MEDIA, RaisesException] void webkitGenerateKeyRequest(DOMString? keySystem, optional Uint8Array initData); - [Conditional=ENCRYPTED_MEDIA, RaisesException] void webkitAddKey(DOMString? keySystem, Uint8Array key, optional Uint8Array initData, [Default=NullString] optional DOMString sessionId); - [Conditional=ENCRYPTED_MEDIA, RaisesException] void webkitCancelKeyRequest(DOMString? keySystem, [Default=NullString] optional DOMString sessionId); + [Conditional=ENCRYPTED_MEDIA, RaisesException] void webkitAddKey(DOMString? keySystem, Uint8Array key, optional Uint8Array initData, optional DOMString sessionId = null); + [Conditional=ENCRYPTED_MEDIA, RaisesException] void webkitCancelKeyRequest(DOMString? keySystem, optional DOMString sessionId = null); [Conditional=ENCRYPTED_MEDIA_V2, ImplementedAs=keys] readonly attribute MediaKeys webkitKeys; [Conditional=ENCRYPTED_MEDIA_V2, ImplementedAs=setMediaKeys] void webkitSetMediaKeys(MediaKeys? mediaKeys); diff --git a/Source/WebCore/html/HTMLOptionElement.idl b/Source/WebCore/html/HTMLOptionElement.idl index eeafa422d00e..f0ffde407993 100644 --- a/Source/WebCore/html/HTMLOptionElement.idl +++ b/Source/WebCore/html/HTMLOptionElement.idl @@ -20,7 +20,7 @@ [ JSGenerateToNativeObject, - NamedConstructor=Option([Default=NullString] optional DOMString data, [Default=NullString] optional DOMString value, [Default=Undefined] optional boolean defaultSelected, [Default=Undefined] optional boolean selected), + NamedConstructor=Option(optional DOMString data = null, optional DOMString value = null, optional boolean defaultSelected = false, optional boolean selected = false), ConstructorRaisesException ] interface HTMLOptionElement : HTMLElement { [Reflect] attribute boolean disabled; diff --git a/Source/WebCore/html/HTMLOptionsCollection.idl b/Source/WebCore/html/HTMLOptionsCollection.idl index bae98b0c5116..0083ae5975c4 100644 --- a/Source/WebCore/html/HTMLOptionsCollection.idl +++ b/Source/WebCore/html/HTMLOptionsCollection.idl @@ -27,18 +27,19 @@ [CustomSetter, SetterRaisesException] attribute unsigned long length; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT - getter Node namedItem([Default=Undefined] optional DOMString name); + getter Node namedItem(optional DOMString name); #else - getter HTMLOptionElement namedItem([Default=Undefined] optional DOMString name); + // FIXME: Using "undefined" as default parameter value is wrong. + getter HTMLOptionElement namedItem(optional DOMString name = "undefined"); #endif #if (!defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C) && (!defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT) - [RaisesException] void add(HTMLElement element, [Default=Undefined] optional HTMLElement? before); - [RaisesException] void add(HTMLElement element, [Default=Undefined] optional long index); + [RaisesException] void add(HTMLElement element, optional HTMLElement? before = null); + [RaisesException] void add(HTMLElement element, optional long index = 0); #else [RaisesException] void add(HTMLOptionElement option, unsigned long index); #endif - [Custom] void remove([Default=Undefined] optional unsigned long index); + [Custom] void remove(optional unsigned long index); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C Node item(unsigned long index); diff --git a/Source/WebCore/html/HTMLSelectElement.idl b/Source/WebCore/html/HTMLSelectElement.idl index 8ecbd8c079e4..1da6a829fd35 100644 --- a/Source/WebCore/html/HTMLSelectElement.idl +++ b/Source/WebCore/html/HTMLSelectElement.idl @@ -47,15 +47,17 @@ #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT getter Node item(unsigned long index); - Node namedItem([Default=Undefined] optional DOMString name); + Node namedItem(optional DOMString name); #else getter HTMLOptionElement? item(unsigned long index); - HTMLOptionElement? namedItem([Default=Undefined] optional DOMString name); + + // FIXME: Using "undefined" as default parameter value is wrong. + HTMLOptionElement? namedItem(optional DOMString name = "undefined"); #endif - [ObjCLegacyUnnamedParameters, RaisesException] void add(HTMLElement element, [Default=Undefined] optional HTMLElement? before); + [ObjCLegacyUnnamedParameters, RaisesException] void add(HTMLElement element, optional HTMLElement? before = null); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [RaisesException] void add(HTMLElement element, [Default=Undefined] optional long index); + [RaisesException] void add(HTMLElement element, optional long index = 0); // In JavaScript, we support both option index and option object parameters. // As of this writing this cannot be auto-generated. [Custom] void remove(/* indexOrOption */); diff --git a/Source/WebCore/html/HTMLTableElement.idl b/Source/WebCore/html/HTMLTableElement.idl index 76377e976289..bb37bcdc93d7 100644 --- a/Source/WebCore/html/HTMLTableElement.idl +++ b/Source/WebCore/html/HTMLTableElement.idl @@ -46,6 +46,6 @@ interface HTMLTableElement : HTMLElement { void deleteCaption(); [RaisesException] HTMLElement insertRow(optional long index = -1); - [RaisesException] void deleteRow([Default=Undefined] optional long index); + [RaisesException] void deleteRow(optional long index = 0); }; diff --git a/Source/WebCore/html/HTMLTableRowElement.idl b/Source/WebCore/html/HTMLTableRowElement.idl index b4443f502d41..45b753529f2f 100644 --- a/Source/WebCore/html/HTMLTableRowElement.idl +++ b/Source/WebCore/html/HTMLTableRowElement.idl @@ -28,6 +28,6 @@ interface HTMLTableRowElement : HTMLElement { [Reflect=charoff] attribute DOMString chOff; [Reflect] attribute DOMString vAlign; [RaisesException] HTMLElement insertCell(optional long index = -1); - [RaisesException] void deleteCell([Default=Undefined] optional long index); + [RaisesException] void deleteCell(optional long index = 0); }; diff --git a/Source/WebCore/html/HTMLTableSectionElement.idl b/Source/WebCore/html/HTMLTableSectionElement.idl index 002fe82ff756..432cecd26912 100644 --- a/Source/WebCore/html/HTMLTableSectionElement.idl +++ b/Source/WebCore/html/HTMLTableSectionElement.idl @@ -27,6 +27,6 @@ [Reflect] attribute DOMString vAlign; readonly attribute HTMLCollection rows; [RaisesException] HTMLElement insertRow(optional long index = -1); - [RaisesException] void deleteRow([Default=Undefined] optional long index); + [RaisesException] void deleteRow(optional long index = 0); }; diff --git a/Source/WebCore/html/HTMLTextAreaElement.idl b/Source/WebCore/html/HTMLTextAreaElement.idl index c8ae97cbce97..e786a822dd49 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.idl +++ b/Source/WebCore/html/HTMLTextAreaElement.idl @@ -60,13 +60,13 @@ interface HTMLTextAreaElement : HTMLElement { [RaisesException] void setRangeText(DOMString replacement, unsigned long start, unsigned long end, - [Default=NullString] optional DOMString selectionMode); + optional DOMString selectionMode = null); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C void setSelectionRange(long start, long end); #else - void setSelectionRange([Default=Undefined] optional long start, - [Default=Undefined] optional long end, + void setSelectionRange(optional long start = 0, + optional long end = 0, optional DOMString direction); #endif diff --git a/Source/WebCore/html/ImageData.idl b/Source/WebCore/html/ImageData.idl index b0f7ea2879c9..e754b4d41599 100644 --- a/Source/WebCore/html/ImageData.idl +++ b/Source/WebCore/html/ImageData.idl @@ -29,10 +29,7 @@ [ Exposed=(Window,Worker), CustomToJSObject, - // FIXME: Without [Default=Undefined] CodeGeneratorJS can't generate JSImageData. But with - // the extended attribute we accept a value of 0 for sh and don't throw. - // https://bugs.webkit.org/show_bug.cgi?id=130667 - Constructor(Uint8ClampedArray data, unsigned long sw, [Default=Undefined] optional unsigned long sh), + Constructor(Uint8ClampedArray data, unsigned long sw, optional unsigned long sh = 0), Constructor(unsigned long sw, unsigned long sh), ConstructorRaisesException, ImplementationLacksVTable diff --git a/Source/WebCore/html/canvas/CanvasGradient.idl b/Source/WebCore/html/canvas/CanvasGradient.idl index cd586679a960..85e59d7bcb92 100644 --- a/Source/WebCore/html/canvas/CanvasGradient.idl +++ b/Source/WebCore/html/canvas/CanvasGradient.idl @@ -25,9 +25,7 @@ [ ImplementationLacksVTable, ] interface CanvasGradient { - - [RaisesException] void addColorStop([Default=Undefined] optional float offset, - [Default=Undefined] optional DOMString color); - + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] void addColorStop(optional float offset = NaN, optional DOMString color = "undefined"); }; diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl b/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl index c93aaaba611e..a78b030a89f2 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl +++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl @@ -82,8 +82,8 @@ interface CanvasRenderingContext2D : CanvasRenderingContext { unrestricted float radius); void rect(unrestricted float x, unrestricted float y, unrestricted float width, unrestricted float height); [RaisesException] void arc(unrestricted float x, unrestricted float y, unrestricted float radius, unrestricted float startAngle, - unrestricted float endAngle, [Default=Undefined] optional boolean anticlockwise); - [RaisesException] void ellipse(unrestricted float x, unrestricted float y, unrestricted float radiusX, unrestricted float radiusY, unrestricted float rotation, unrestricted float startAngle, unrestricted float endAngle, [Default=Undefined] optional boolean anticlockwise); + unrestricted float endAngle, optional boolean anticlockwise = false); + [RaisesException] void ellipse(unrestricted float x, unrestricted float y, unrestricted float radiusX, unrestricted float radiusY, unrestricted float rotation, unrestricted float startAngle, unrestricted float endAngle, optional boolean anticlockwise = false); void fill(DOMPath path, optional CanvasWindingRule winding = "nonzero"); void stroke(DOMPath path); @@ -109,13 +109,18 @@ interface CanvasRenderingContext2D : CanvasRenderingContext { // other - void setAlpha([Default=Undefined] optional unrestricted float alpha); - void setCompositeOperation([Default=Undefined] optional DOMString compositeOperation); + void setAlpha(optional unrestricted float alpha = NaN); - void setLineWidth([Default=Undefined] optional unrestricted float width); - void setLineCap([Default=Undefined] optional DOMString cap); - void setLineJoin([Default=Undefined] optional DOMString join); - void setMiterLimit([Default=Undefined] optional unrestricted float limit); + // FIXME: Using "undefined" as default parameter value is wrong. + void setCompositeOperation(optional DOMString compositeOperation = "undefined"); + + void setLineWidth(optional unrestricted float width = NaN); + + // FIXME: Using "undefined" as default parameter value is wrong. + void setLineCap(optional DOMString cap = "undefined"); + void setLineJoin(optional DOMString join = "undefined"); + + void setMiterLimit(optional unrestricted float limit = NaN); void clearShadow(); diff --git a/Source/WebCore/html/canvas/DOMPath.idl b/Source/WebCore/html/canvas/DOMPath.idl index 5209d83ba69e..39c8cb4fa7e6 100644 --- a/Source/WebCore/html/canvas/DOMPath.idl +++ b/Source/WebCore/html/canvas/DOMPath.idl @@ -38,35 +38,35 @@ // FIXME: These methods should be shared with CanvasRenderingContext2D in the CanvasPathMethods interface. void closePath(); - void moveTo([Default=Undefined] optional float x, - [Default=Undefined] optional float y); - void lineTo([Default=Undefined] optional float x, - [Default=Undefined] optional float y); - void quadraticCurveTo([Default=Undefined] optional float cpx, - [Default=Undefined] optional float cpy, - [Default=Undefined] optional float x, - [Default=Undefined] optional float y); - void bezierCurveTo([Default=Undefined] optional float cp1x, - [Default=Undefined] optional float cp1y, - [Default=Undefined] optional float cp2x, - [Default=Undefined] optional float cp2y, - [Default=Undefined] optional float x, - [Default=Undefined] optional float y); - [RaisesException] void arcTo([Default=Undefined] optional float x1, - [Default=Undefined] optional float y1, - [Default=Undefined] optional float x2, - [Default=Undefined] optional float y2, - [Default=Undefined] optional float radius); - void rect([Default=Undefined] optional float x, - [Default=Undefined] optional float y, - [Default=Undefined] optional float width, - [Default=Undefined] optional float height); - [RaisesException] void arc([Default=Undefined] optional float x, - [Default=Undefined] optional float y, - [Default=Undefined] optional float radius, - [Default=Undefined] optional float startAngle, - [Default=Undefined] optional float endAngle, - [Default=Undefined] optional boolean anticlockwise); - [RaisesException] void ellipse(unrestricted float x, unrestricted float y, unrestricted float radiusX, unrestricted float radiusY, unrestricted float rotation, unrestricted float startAngle, unrestricted float endAngle, [Default=Undefined] optional boolean anticlockwise); + void moveTo(optional float x = NaN, + optional float y = NaN); + void lineTo(optional float x = NaN, + optional float y = NaN); + void quadraticCurveTo(optional float cpx = NaN, + optional float cpy = NaN, + optional float x = NaN, + optional float y = NaN); + void bezierCurveTo(optional float cp1x = NaN, + optional float cp1y = NaN, + optional float cp2x = NaN, + optional float cp2y = NaN, + optional float x = NaN, + optional float y = NaN); + [RaisesException] void arcTo(optional float x1 = NaN, + optional float y1 = NaN, + optional float x2 = NaN, + optional float y2 = NaN, + optional float radius = NaN); + void rect(optional float x = NaN, + optional float y = NaN, + optional float width = NaN, + optional float height = NaN); + [RaisesException] void arc(optional float x = NaN, + optional float y = NaN, + optional float radius = NaN, + optional float startAngle = NaN, + optional float endAngle = NaN, + optional boolean anticlockwise = false); + [RaisesException] void ellipse(unrestricted float x, unrestricted float y, unrestricted float radiusX, unrestricted float radiusY, unrestricted float rotation, unrestricted float startAngle, unrestricted float endAngle, optional boolean anticlockwise = false); }; diff --git a/Source/WebCore/html/canvas/OESVertexArrayObject.idl b/Source/WebCore/html/canvas/OESVertexArrayObject.idl index 56ecf6ff1109..326ef1a4dfac 100644 --- a/Source/WebCore/html/canvas/OESVertexArrayObject.idl +++ b/Source/WebCore/html/canvas/OESVertexArrayObject.idl @@ -32,7 +32,7 @@ const unsigned int VERTEX_ARRAY_BINDING_OES = 0x85B5; [StrictTypeChecking] WebGLVertexArrayObjectOES createVertexArrayOES(); - [StrictTypeChecking] void deleteVertexArrayOES([Default=Undefined] optional WebGLVertexArrayObjectOES arrayObject); - [StrictTypeChecking] boolean isVertexArrayOES([Default=Undefined] optional WebGLVertexArrayObjectOES arrayObject); - [StrictTypeChecking, RaisesException] void bindVertexArrayOES([Default=Undefined] optional WebGLVertexArrayObjectOES arrayObject); + [StrictTypeChecking] void deleteVertexArrayOES(optional WebGLVertexArrayObjectOES? arrayObject = null); + [StrictTypeChecking] boolean isVertexArrayOES(optional WebGLVertexArrayObjectOES? arrayObject = null); + [StrictTypeChecking, RaisesException] void bindVertexArrayOES(optional WebGLVertexArrayObjectOES? arrayObject = null); }; diff --git a/Source/WebCore/page/DOMSelection.cpp b/Source/WebCore/page/DOMSelection.cpp index f605661bd853..52ce0a95644e 100644 --- a/Source/WebCore/page/DOMSelection.cpp +++ b/Source/WebCore/page/DOMSelection.cpp @@ -327,26 +327,21 @@ void DOMSelection::modify(const String& alterString, const String& directionStri m_frame->selection().modify(alter, direction, granularity); } -void DOMSelection::extend(Node* node, int offset, ExceptionCode& ec) +void DOMSelection::extend(Node& node, int offset, ExceptionCode& ec) { if (!m_frame) return; - if (!node) { - ec = TYPE_MISMATCH_ERR; - return; - } - - if (offset < 0 || offset > (node->offsetInCharacters() ? caretMaxOffset(node) : static_cast(node->countChildNodes()))) { + if (offset < 0 || offset > (node.offsetInCharacters() ? caretMaxOffset(&node) : static_cast(node.countChildNodes()))) { ec = INDEX_SIZE_ERR; return; } - if (!isValidForPosition(node)) + if (!isValidForPosition(&node)) return; // FIXME: Eliminate legacy editing positions - m_frame->selection().setExtent(createLegacyEditingPosition(node, offset), DOWNSTREAM); + m_frame->selection().setExtent(createLegacyEditingPosition(&node, offset), DOWNSTREAM); } PassRefPtr DOMSelection::getRangeAt(int index, ExceptionCode& ec) diff --git a/Source/WebCore/page/DOMSelection.h b/Source/WebCore/page/DOMSelection.h index 2fa1e87a93eb..ac28af545d8c 100644 --- a/Source/WebCore/page/DOMSelection.h +++ b/Source/WebCore/page/DOMSelection.h @@ -79,7 +79,7 @@ namespace WebCore { void collapse(Node*, int offset, ExceptionCode&); void collapseToEnd(ExceptionCode&); void collapseToStart(ExceptionCode&); - void extend(Node*, int offset, ExceptionCode&); + void extend(Node&, int offset, ExceptionCode&); PassRefPtr getRangeAt(int, ExceptionCode&); void removeAllRanges(); void addRange(Range*); diff --git a/Source/WebCore/page/DOMSelection.idl b/Source/WebCore/page/DOMSelection.idl index 2eb62148a3f2..336ae854624f 100644 --- a/Source/WebCore/page/DOMSelection.idl +++ b/Source/WebCore/page/DOMSelection.idl @@ -41,19 +41,19 @@ readonly attribute boolean isCollapsed; readonly attribute long rangeCount; - [RaisesException] void collapse([Default=Undefined] optional Node node, [Default=Undefined] optional long index); + [RaisesException] void collapse(optional Node? node = null, optional long index = 0); [RaisesException] void collapseToEnd(); [RaisesException] void collapseToStart(); void deleteFromDocument(); - boolean containsNode([Default=Undefined] optional Node node, [Default=Undefined] optional boolean allowPartial); - [RaisesException] void selectAllChildren([Default=Undefined] optional Node node); + boolean containsNode(optional Node? node = null, optional boolean allowPartial = false); + [RaisesException] void selectAllChildren(optional Node? node = null); - [RaisesException] void extend([Default=Undefined] optional Node node, [Default=Undefined] optional long offset); + [RaisesException] void extend(optional Node node = null, optional long offset = 0); - [RaisesException] Range getRangeAt([Default=Undefined] optional long index); + [RaisesException] Range getRangeAt(optional long index = 0); void removeAllRanges(); - void addRange([Default=Undefined] optional Range range); + void addRange(optional Range? range = null); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT [NotEnumerable] DOMString toString(); @@ -69,9 +69,10 @@ // IE's type accessor returns "none", "text" and "control" readonly attribute DOMString type; - void modify([Default=Undefined] optional DOMString alter, [Default=Undefined] optional DOMString direction, [Default=Undefined] optional DOMString granularity); - [RaisesException] void setBaseAndExtent([Default=Undefined] optional Node baseNode, [Default=Undefined] optional long baseOffset, [Default=Undefined] optional Node extentNode, [Default=Undefined] optional long extentOffset); - [RaisesException] void setPosition([Default=Undefined] optional Node node, [Default=Undefined] optional long offset); + // FIXME: Using "undefined" as default parameter value is wrong. + void modify(optional DOMString alter = "undefined", optional DOMString direction = "undefined", optional DOMString granularity = "undefined"); + [RaisesException] void setBaseAndExtent(optional Node? baseNode = null, optional long baseOffset = 0, optional Node? extentNode = null, optional long extentOffset = 0); + [RaisesException] void setPosition(optional Node? node = null, optional long offset = 0); // IE extension // http://msdn.microsoft.com/en-us/library/ms535869(VS.85).aspx diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index eff06d372fee..8335b4407762 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -73,17 +73,19 @@ optional any dialogArgs, optional DOMString featureArgs); - void alert([Default=Undefined] optional DOMString message); - boolean confirm([Default=Undefined] optional DOMString message); - DOMString? prompt([Default=Undefined] optional DOMString message, [Default=Undefined] optional DOMString? defaultValue); - - boolean find([Default=Undefined] optional DOMString string, - [Default=Undefined] optional boolean caseSensitive, - [Default=Undefined] optional boolean backwards, - [Default=Undefined] optional boolean wrap, - [Default=Undefined] optional boolean wholeWord, - [Default=Undefined] optional boolean searchInFrames, - [Default=Undefined] optional boolean showDialog); + // FIXME: Using "undefined" as default parameter value is wrong. + void alert(optional DOMString message = "undefined"); + boolean confirm(optional DOMString message = "undefined"); + DOMString? prompt(optional DOMString message = "undefined", optional DOMString? defaultValue = null); + + // FIXME: Using "undefined" as default parameter value is wrong. + boolean find(optional DOMString string = "undefined", + optional boolean caseSensitive = false, + optional boolean backwards = false, + optional boolean wrap = false, + optional boolean wholeWord = false, + optional boolean searchInFrames = false, + optional boolean showDialog = false); [Replaceable] readonly attribute boolean offscreenBuffering; @@ -100,13 +102,13 @@ readonly attribute long pageXOffset; readonly attribute long pageYOffset; - void scrollBy([Default=Undefined] optional long x, [Default=Undefined] optional long y); - void scrollTo([Default=Undefined] optional long x, [Default=Undefined] optional long y); - void scroll([Default=Undefined] optional long x, [Default=Undefined] optional long y); - void moveBy([Default=Undefined] optional unrestricted float x, [Default=Undefined] optional unrestricted float y); // FIXME: this should take longs not floats. - void moveTo([Default=Undefined] optional unrestricted float x, [Default=Undefined] optional unrestricted float y); // FIXME: this should take longs not floats. - void resizeBy([Default=Undefined] optional unrestricted float x, [Default=Undefined] optional unrestricted float y); // FIXME: this should take longs not floats. - void resizeTo([Default=Undefined] optional unrestricted float width, [Default=Undefined] optional unrestricted float height); // FIXME: this should take longs not floats. + void scrollBy(optional long x = 0, optional long y = 0); + void scrollTo(optional long x = 0, optional long y = 0); + void scroll(optional long x = 0, optional long y = 0); + void moveBy(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: this should take longs not floats. + void moveTo(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: this should take longs not floats. + void resizeBy(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: this should take longs not floats. + void resizeTo(optional unrestricted float width = NaN, optional unrestricted float height = NaN); // FIXME: this should take longs not floats. [DoNotCheckSecurity, ForwardDeclareInHeader] readonly attribute boolean closed; @@ -140,19 +142,19 @@ readonly attribute StyleMedia styleMedia; // DOM Level 2 Style Interface - CSSStyleDeclaration getComputedStyle([Default=Undefined] optional Element element, [Default=Undefined] optional DOMString? pseudoElement); + CSSStyleDeclaration getComputedStyle(optional Element? element = null, optional DOMString? pseudoElement = null); // WebKit extensions #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - CSSRuleList getMatchedCSSRules([Default=Undefined] optional Element element, [Default=Undefined] optional DOMString? pseudoElement); + CSSRuleList getMatchedCSSRules(optional Element? element = null, optional DOMString? pseudoElement = null); #endif [Replaceable] readonly attribute unrestricted double devicePixelRatio; - WebKitPoint webkitConvertPointFromPageToNode([Default=Undefined] optional Node node, - [Default=Undefined] optional WebKitPoint p); - WebKitPoint webkitConvertPointFromNodeToPage([Default=Undefined] optional Node node, - [Default=Undefined] optional WebKitPoint p); + WebKitPoint webkitConvertPointFromPageToNode(optional Node? node = null, + optional WebKitPoint? p = null); + WebKitPoint webkitConvertPointFromNodeToPage(optional Node? node = null, + optional WebKitPoint? p = null); readonly attribute DOMApplicationCache applicationCache; diff --git a/Source/WebCore/page/History.idl b/Source/WebCore/page/History.idl index f7758226257a..82f3ac7ba7f3 100644 --- a/Source/WebCore/page/History.idl +++ b/Source/WebCore/page/History.idl @@ -31,7 +31,7 @@ [CallWith=Document, ForwardDeclareInHeader] void back(); [CallWith=Document, ForwardDeclareInHeader] void forward(); - [CallWith=Document, ForwardDeclareInHeader] void go([Default=Undefined] optional long distance); + [CallWith=Document, ForwardDeclareInHeader] void go(optional long distance = 0); [Custom, RaisesException] void pushState(any data, DOMString title, optional DOMString url); [Custom, RaisesException] void replaceState(any data, DOMString title, optional DOMString url); diff --git a/Source/WebCore/page/Performance.idl b/Source/WebCore/page/Performance.idl index 471fb50fdb5c..21bfa4a99144 100644 --- a/Source/WebCore/page/Performance.idl +++ b/Source/WebCore/page/Performance.idl @@ -39,7 +39,7 @@ #if defined(ENABLE_PERFORMANCE_TIMELINE) && ENABLE_PERFORMANCE_TIMELINE PerformanceEntryList webkitGetEntries(); PerformanceEntryList webkitGetEntriesByType(DOMString entryType); - PerformanceEntryList webkitGetEntriesByName(DOMString name, [Default=NullString] optional DOMString entryType); + PerformanceEntryList webkitGetEntriesByName(DOMString name, optional DOMString entryType = null); #endif #if defined(ENABLE_RESOURCE_TIMING) && ENABLE_RESOURCE_TIMING @@ -52,10 +52,10 @@ // See http://www.w3.org/TR/2012/CR-user-timing-20120726/ #if defined(ENABLE_USER_TIMING) && ENABLE_USER_TIMING [RaisesException] void webkitMark(DOMString markName); - void webkitClearMarks([Default=NullString] optional DOMString markName); + void webkitClearMarks(optional DOMString markName = null); - [RaisesException] void webkitMeasure(DOMString measureName, [Default=NullString] optional DOMString startMark, [Default=NullString] optional DOMString endMark); - void webkitClearMeasures([Default=NullString] optional DOMString measureName); + [RaisesException] void webkitMeasure(DOMString measureName, optional DOMString startMark = null, optional DOMString endMark = null); + void webkitClearMeasures(optional DOMString measureName = null); #endif // See http://www.w3.org/TR/hr-time/ for details. diff --git a/Source/WebCore/page/WindowTimers.idl b/Source/WebCore/page/WindowTimers.idl index 56563a302bbb..c58d4cb9bd9a 100644 --- a/Source/WebCore/page/WindowTimers.idl +++ b/Source/WebCore/page/WindowTimers.idl @@ -28,9 +28,9 @@ [ NoInterfaceObject, ] interface WindowTimers { - [Custom] long setTimeout(any handler, [Default=Undefined] optional long timeout); - void clearTimeout([Default=Undefined] optional long handle); - [Custom] long setInterval(any handler, [Default=Undefined] optional long timeout); - void clearInterval([Default=Undefined] optional long handle); + [Custom] long setTimeout(any handler, optional long timeout); + void clearTimeout(optional long handle = 0); + [Custom] long setInterval(any handler, optional long timeout); + void clearInterval(optional long handle = 0); }; diff --git a/Source/WebCore/plugins/DOMMimeTypeArray.idl b/Source/WebCore/plugins/DOMMimeTypeArray.idl index cdce50a3d903..6ec76aa652cf 100644 --- a/Source/WebCore/plugins/DOMMimeTypeArray.idl +++ b/Source/WebCore/plugins/DOMMimeTypeArray.idl @@ -23,7 +23,9 @@ InterfaceName=MimeTypeArray, ] interface DOMMimeTypeArray { readonly attribute unsigned long length; - getter DOMMimeType item([Default=Undefined] optional unsigned long index); - getter DOMMimeType namedItem([Default=Undefined] optional DOMString name); + getter DOMMimeType item(optional unsigned long index = 0); + + // FIXME: Using "undefined" as default parameter value is wrong. + getter DOMMimeType namedItem(optional DOMString name = "undefined"); }; diff --git a/Source/WebCore/plugins/DOMPlugin.idl b/Source/WebCore/plugins/DOMPlugin.idl index a1b6240912b1..4f8ad1e99347 100644 --- a/Source/WebCore/plugins/DOMPlugin.idl +++ b/Source/WebCore/plugins/DOMPlugin.idl @@ -25,7 +25,9 @@ readonly attribute DOMString filename; readonly attribute DOMString description; readonly attribute unsigned long length; - getter DOMMimeType item([Default=Undefined] optional unsigned long index); - getter DOMMimeType namedItem([Default=Undefined] optional DOMString name); + getter DOMMimeType item(optional unsigned long index = 0); + + // FIXME: Using "undefined" as default parameter value is wrong. + getter DOMMimeType namedItem(optional DOMString name = "undefined"); }; diff --git a/Source/WebCore/plugins/DOMPluginArray.idl b/Source/WebCore/plugins/DOMPluginArray.idl index 85d05223ccdc..5e7ccea20626 100644 --- a/Source/WebCore/plugins/DOMPluginArray.idl +++ b/Source/WebCore/plugins/DOMPluginArray.idl @@ -23,8 +23,11 @@ InterfaceName=PluginArray, ] interface DOMPluginArray { readonly attribute unsigned long length; - getter DOMPlugin item([Default=Undefined] optional unsigned long index); - getter DOMPlugin namedItem([Default=Undefined] optional DOMString name); - void refresh([Default=Undefined] optional boolean reload); + getter DOMPlugin item(optional unsigned long index = 0); + + // FIXME: Using "undefined" as default parameter value is wrong. + getter DOMPlugin namedItem(optional DOMString name = "undefined"); + + void refresh(optional boolean reload = false); }; diff --git a/Source/WebCore/storage/StorageEvent.idl b/Source/WebCore/storage/StorageEvent.idl index 5c9396dcc081..5aa46a2ec8f0 100644 --- a/Source/WebCore/storage/StorageEvent.idl +++ b/Source/WebCore/storage/StorageEvent.idl @@ -32,16 +32,17 @@ [InitializedByEventConstructor] readonly attribute DOMString url; [InitializedByEventConstructor] readonly attribute Storage storageArea; - void initStorageEvent([Default=Undefined] optional DOMString typeArg, - [Default=Undefined] optional boolean canBubbleArg, - [Default=Undefined] optional boolean cancelableArg, - [Default=Undefined] optional DOMString keyArg, - [Default=Undefined] optional DOMString? oldValueArg, - [Default=Undefined] optional DOMString? newValueArg, - [Default=Undefined] optional DOMString urlArg, - [Default=Undefined] optional Storage storageAreaArg); + // FIXME: Using "undefined" as default parameter value is wrong. + void initStorageEvent(optional DOMString typeArg = "undefined", + optional boolean canBubbleArg = false, + optional boolean cancelableArg = false, + optional DOMString keyArg = "undefined", + optional DOMString? oldValueArg = null, + optional DOMString? newValueArg = null, + optional DOMString urlArg = "undefined", + optional Storage? storageAreaArg = null); // Needed once we support initEventNS - // void initStorageEventNS(DOMString namespaceURI, DOMString typeArg, boolean canBubbleArg, boolean cancelableArg, DOMString keyArg, DOMString oldValueArg, DOMString newValueArg, DOMString urlArg, Storage storageAreaArg); + // void initStorageEventNS(DOMString namespaceURI, DOMString typeArg, boolean canBubbleArg, boolean cancelableArg, DOMString keyArg, DOMString oldValueArg, DOMString newValueArg, DOMString urlArg, Storage? storageAreaArg); }; diff --git a/Source/WebCore/svg/SVGAnimationElement.idl b/Source/WebCore/svg/SVGAnimationElement.idl index 191c23e5a360..f9a17f5b498f 100644 --- a/Source/WebCore/svg/SVGAnimationElement.idl +++ b/Source/WebCore/svg/SVGAnimationElement.idl @@ -32,9 +32,9 @@ interface SVGAnimationElement : SVGElement { [RaisesException] unrestricted float getSimpleDuration(); void beginElement(); - void beginElementAt([Default=Undefined] optional unrestricted float offset); + void beginElementAt(optional unrestricted float offset = NaN); void endElement(); - void endElementAt([Default=Undefined] optional unrestricted float offset); + void endElementAt(optional unrestricted float offset = NaN); }; SVGAnimationElement implements SVGExternalResourcesRequired; diff --git a/Source/WebCore/svg/SVGDocument.idl b/Source/WebCore/svg/SVGDocument.idl index 7f91e93369dc..5c88fc28a399 100644 --- a/Source/WebCore/svg/SVGDocument.idl +++ b/Source/WebCore/svg/SVGDocument.idl @@ -24,6 +24,7 @@ interface SVGDocument : XMLDocument { readonly attribute SVGSVGElement rootElement; // Overwrite the one in events::DocumentEvent - [RaisesException] Event createEvent([Default=Undefined] optional DOMString eventType); + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] Event createEvent(optional DOMString eventType = "undefined"); }; diff --git a/Source/WebCore/svg/SVGElement.idl b/Source/WebCore/svg/SVGElement.idl index 2546746ac6ac..c3ba8b30f6cf 100644 --- a/Source/WebCore/svg/SVGElement.idl +++ b/Source/WebCore/svg/SVGElement.idl @@ -38,7 +38,8 @@ attribute long tabIndex; - CSSValue getPresentationAttribute([Default=Undefined] optional DOMString name); + // FIXME: Using "undefined" as default parameter value is wrong. + CSSValue getPresentationAttribute(optional DOMString name = "undefined"); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT void focus(); diff --git a/Source/WebCore/svg/SVGFEDropShadowElement.idl b/Source/WebCore/svg/SVGFEDropShadowElement.idl index bb2ca0769f24..04bcdfbad178 100644 --- a/Source/WebCore/svg/SVGFEDropShadowElement.idl +++ b/Source/WebCore/svg/SVGFEDropShadowElement.idl @@ -24,8 +24,8 @@ interface SVGFEDropShadowElement : SVGElement { readonly attribute SVGAnimatedNumber stdDeviationX; readonly attribute SVGAnimatedNumber stdDeviationY; - void setStdDeviation([Default=Undefined] optional unrestricted float stdDeviationX, - [Default=Undefined] optional unrestricted float stdDeviationY); + void setStdDeviation(optional unrestricted float stdDeviationX = NaN, + optional unrestricted float stdDeviationY = NaN); }; SVGFEDropShadowElement implements SVGFilterPrimitiveStandardAttributes; diff --git a/Source/WebCore/svg/SVGFEGaussianBlurElement.idl b/Source/WebCore/svg/SVGFEGaussianBlurElement.idl index daa81d25d123..b32aee1cd080 100644 --- a/Source/WebCore/svg/SVGFEGaussianBlurElement.idl +++ b/Source/WebCore/svg/SVGFEGaussianBlurElement.idl @@ -37,8 +37,8 @@ readonly attribute SVGAnimatedNumber stdDeviationY; readonly attribute SVGAnimatedEnumeration edgeMode; - void setStdDeviation([Default=Undefined] optional unrestricted float stdDeviationX, - [Default=Undefined] optional unrestricted float stdDeviationY); + void setStdDeviation(optional unrestricted float stdDeviationX = NaN, + optional unrestricted float stdDeviationY = NaN); }; SVGFEGaussianBlurElement implements SVGFilterPrimitiveStandardAttributes; diff --git a/Source/WebCore/svg/SVGFEMorphologyElement.idl b/Source/WebCore/svg/SVGFEMorphologyElement.idl index d539b7aa705b..b6d86f40b4e0 100644 --- a/Source/WebCore/svg/SVGFEMorphologyElement.idl +++ b/Source/WebCore/svg/SVGFEMorphologyElement.idl @@ -36,8 +36,8 @@ readonly attribute SVGAnimatedNumber radiusX; readonly attribute SVGAnimatedNumber radiusY; - void setRadius([Default=Undefined] optional unrestricted float radiusX, - [Default=Undefined] optional unrestricted float radiusY); + void setRadius(optional unrestricted float radiusX = NaN, + optional unrestricted float radiusY = NaN); }; SVGFEMorphologyElement implements SVGFilterPrimitiveStandardAttributes; diff --git a/Source/WebCore/svg/SVGFilterElement.idl b/Source/WebCore/svg/SVGFilterElement.idl index f21d7286ba6f..4b788db1ba2f 100644 --- a/Source/WebCore/svg/SVGFilterElement.idl +++ b/Source/WebCore/svg/SVGFilterElement.idl @@ -34,8 +34,8 @@ interface SVGFilterElement : SVGElement { readonly attribute SVGAnimatedInteger filterResX; readonly attribute SVGAnimatedInteger filterResY; - void setFilterRes([Default=Undefined] optional unsigned long filterResX, - [Default=Undefined] optional unsigned long filterResY); + void setFilterRes(optional unsigned long filterResX = 0, + optional unsigned long filterResY = 0); }; SVGFilterElement implements SVGExternalResourcesRequired; diff --git a/Source/WebCore/svg/SVGGraphicsElement.idl b/Source/WebCore/svg/SVGGraphicsElement.idl index d3681d2aeb7a..8b6d4eba473d 100644 --- a/Source/WebCore/svg/SVGGraphicsElement.idl +++ b/Source/WebCore/svg/SVGGraphicsElement.idl @@ -32,7 +32,7 @@ interface SVGGraphicsElement : SVGElement { SVGRect getBBox(); SVGMatrix getCTM(); SVGMatrix getScreenCTM(); - [RaisesException] SVGMatrix getTransformToElement([Default=Undefined] optional SVGElement element); + [RaisesException] SVGMatrix getTransformToElement(optional SVGElement? element = null); }; SVGGraphicsElement implements SVGTests; diff --git a/Source/WebCore/svg/SVGMarkerElement.idl b/Source/WebCore/svg/SVGMarkerElement.idl index 60a7678c6366..ff7ec173f56a 100644 --- a/Source/WebCore/svg/SVGMarkerElement.idl +++ b/Source/WebCore/svg/SVGMarkerElement.idl @@ -43,7 +43,7 @@ interface SVGMarkerElement : SVGElement { readonly attribute SVGAnimatedAngle orientAngle; void setOrientToAuto(); - void setOrientToAngle([Default=Undefined] optional SVGAngle angle); + void setOrientToAngle(optional SVGAngle angle = null); }; SVGMarkerElement implements SVGExternalResourcesRequired; diff --git a/Source/WebCore/svg/SVGPathElement.idl b/Source/WebCore/svg/SVGPathElement.idl index 1d8081fd6336..34042b530983 100644 --- a/Source/WebCore/svg/SVGPathElement.idl +++ b/Source/WebCore/svg/SVGPathElement.idl @@ -28,77 +28,77 @@ interface SVGPathElement : SVGGraphicsElement { readonly attribute SVGAnimatedNumber pathLength; unrestricted float getTotalLength(); - SVGPoint getPointAtLength([Default=Undefined] optional unrestricted float distance); - unsigned long getPathSegAtLength([Default=Undefined] optional unrestricted float distance); + SVGPoint getPointAtLength(optional unrestricted float distance = NaN); + unsigned long getPathSegAtLength(optional unrestricted float distance = NaN); SVGPathSegClosePath createSVGPathSegClosePath(); - SVGPathSegMovetoAbs createSVGPathSegMovetoAbs([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y); - SVGPathSegMovetoRel createSVGPathSegMovetoRel([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y); + SVGPathSegMovetoAbs createSVGPathSegMovetoAbs(optional unrestricted float x = NaN, + optional unrestricted float y = NaN); + SVGPathSegMovetoRel createSVGPathSegMovetoRel(optional unrestricted float x = NaN, + optional unrestricted float y = NaN); - SVGPathSegLinetoAbs createSVGPathSegLinetoAbs([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y); - SVGPathSegLinetoRel createSVGPathSegLinetoRel([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y); + SVGPathSegLinetoAbs createSVGPathSegLinetoAbs(optional unrestricted float x = NaN, + optional unrestricted float y = NaN); + SVGPathSegLinetoRel createSVGPathSegLinetoRel(optional unrestricted float x = NaN, + optional unrestricted float y = NaN); - SVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y, - [Default=Undefined] optional unrestricted float x1, - [Default=Undefined] optional unrestricted float y1, - [Default=Undefined] optional unrestricted float x2, - [Default=Undefined] optional unrestricted float y2); - SVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y, - [Default=Undefined] optional unrestricted float x1, - [Default=Undefined] optional unrestricted float y1, - [Default=Undefined] optional unrestricted float x2, - [Default=Undefined] optional unrestricted float y2); + SVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs(optional unrestricted float x = NaN, + optional unrestricted float y = NaN, + optional unrestricted float x1 = NaN, + optional unrestricted float y1 = NaN, + optional unrestricted float x2 = NaN, + optional unrestricted float y2 = NaN); + SVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel(optional unrestricted float x = NaN, + optional unrestricted float y = NaN, + optional unrestricted float x1 = NaN, + optional unrestricted float y1 = NaN, + optional unrestricted float x2 = NaN, + optional unrestricted float y2 = NaN); - SVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y, - [Default=Undefined] optional unrestricted float x1, - [Default=Undefined] optional unrestricted float y1); - SVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y, - [Default=Undefined] optional unrestricted float x1, - [Default=Undefined] optional unrestricted float y1); + SVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs(optional unrestricted float x = NaN, + optional unrestricted float y = NaN, + optional unrestricted float x1 = NaN, + optional unrestricted float y1 = NaN); + SVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel(optional unrestricted float x = NaN, + optional unrestricted float y = NaN, + optional unrestricted float x1 = NaN, + optional unrestricted float y1 = NaN); - SVGPathSegArcAbs createSVGPathSegArcAbs([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y, - [Default=Undefined] optional unrestricted float r1, - [Default=Undefined] optional unrestricted float r2, - [Default=Undefined] optional unrestricted float angle, - [Default=Undefined] optional boolean largeArcFlag, - [Default=Undefined] optional boolean sweepFlag); - SVGPathSegArcRel createSVGPathSegArcRel([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y, - [Default=Undefined] optional unrestricted float r1, - [Default=Undefined] optional unrestricted float r2, - [Default=Undefined] optional unrestricted float angle, - [Default=Undefined] optional boolean largeArcFlag, - [Default=Undefined] optional boolean sweepFlag); + SVGPathSegArcAbs createSVGPathSegArcAbs(optional unrestricted float x = NaN, + optional unrestricted float y = NaN, + optional unrestricted float r1 = NaN, + optional unrestricted float r2 = NaN, + optional unrestricted float angle = NaN, + optional boolean largeArcFlag = false, + optional boolean sweepFlag = false); + SVGPathSegArcRel createSVGPathSegArcRel(optional unrestricted float x = NaN, + optional unrestricted float y = NaN, + optional unrestricted float r1 = NaN, + optional unrestricted float r2 = NaN, + optional unrestricted float angle = NaN, + optional boolean largeArcFlag = false, + optional boolean sweepFlag = false); - SVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs([Default=Undefined] optional unrestricted float x); - SVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel([Default=Undefined] optional unrestricted float x); + SVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs(optional unrestricted float x = NaN); + SVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel(optional unrestricted float x = NaN); - SVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs([Default=Undefined] optional unrestricted float y); - SVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel([Default=Undefined] optional unrestricted float y); + SVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs(optional unrestricted float y = NaN); + SVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel(optional unrestricted float y = NaN); - SVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y, - [Default=Undefined] optional unrestricted float x2, - [Default=Undefined] optional unrestricted float y2); - SVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y, - [Default=Undefined] optional unrestricted float x2, - [Default=Undefined] optional unrestricted float y2); + SVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs(optional unrestricted float x = NaN, + optional unrestricted float y = NaN, + optional unrestricted float x2 = NaN, + optional unrestricted float y2 = NaN); + SVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel(optional unrestricted float x = NaN, + optional unrestricted float y = NaN, + optional unrestricted float x2 = NaN, + optional unrestricted float y2 = NaN); - SVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y); - SVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel([Default=Undefined] optional unrestricted float x, - [Default=Undefined] optional unrestricted float y); + SVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs(optional unrestricted float x = NaN, + optional unrestricted float y = NaN); + SVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel(optional unrestricted float x = NaN, + optional unrestricted float y = NaN); readonly attribute SVGPathSegList pathSegList; readonly attribute SVGPathSegList normalizedPathSegList; diff --git a/Source/WebCore/svg/SVGSVGElement.idl b/Source/WebCore/svg/SVGSVGElement.idl index 3dd8afdb1c58..613c402dcba4 100644 --- a/Source/WebCore/svg/SVGSVGElement.idl +++ b/Source/WebCore/svg/SVGSVGElement.idl @@ -41,19 +41,19 @@ interface SVGSVGElement : SVGGraphicsElement { attribute unrestricted float currentScale; readonly attribute SVGPoint currentTranslate; - unsigned long suspendRedraw([Default=Undefined] optional unsigned long maxWaitMilliseconds); - void unsuspendRedraw([Default=Undefined] optional unsigned long suspendHandleId); + unsigned long suspendRedraw(optional unsigned long maxWaitMilliseconds = 0); + void unsuspendRedraw(optional unsigned long suspendHandleId = 0); void unsuspendRedrawAll(); void forceRedraw(); void pauseAnimations(); void unpauseAnimations(); boolean animationsPaused(); unrestricted float getCurrentTime(); - void setCurrentTime([Default=Undefined] optional unrestricted float seconds); - NodeList getIntersectionList([Default=Undefined] optional SVGRect rect, [Default=Undefined] optional SVGElement referenceElement); - NodeList getEnclosureList([Default=Undefined] optional SVGRect rect, [Default=Undefined] optional SVGElement referenceElement); - boolean checkIntersection([Default=Undefined] optional SVGElement element, [Default=Undefined] optional SVGRect rect); - boolean checkEnclosure([Default=Undefined] optional SVGElement element, [Default=Undefined] optional SVGRect rect); + 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); void deselectAll(); SVGNumber createSVGNumber(); @@ -63,9 +63,10 @@ interface SVGSVGElement : SVGGraphicsElement { SVGMatrix createSVGMatrix(); SVGRect createSVGRect(); SVGTransform createSVGTransform(); - SVGTransform createSVGTransformFromMatrix([Default=Undefined] optional SVGMatrix matrix); + SVGTransform createSVGTransformFromMatrix(optional SVGMatrix matrix = null); - Element getElementById([Default=Undefined, RequiresExistingAtomicString] optional DOMString elementId); + // FIXME: Using "undefined" as default parameter value is wrong. + Element getElementById([RequiresExistingAtomicString] optional DOMString elementId = "undefined"); }; SVGSVGElement implements SVGExternalResourcesRequired; diff --git a/Source/WebCore/svg/SVGTests.idl b/Source/WebCore/svg/SVGTests.idl index a9c8d8c5f3d9..fb6a72d124d4 100644 --- a/Source/WebCore/svg/SVGTests.idl +++ b/Source/WebCore/svg/SVGTests.idl @@ -33,6 +33,7 @@ readonly attribute SVGStringList requiredExtensions; readonly attribute SVGStringList systemLanguage; - boolean hasExtension([Default=Undefined] optional DOMString extension); + // FIXME: Using "undefined" as default parameter value is wrong. + boolean hasExtension(optional DOMString extension = "undefined"); }; diff --git a/Source/WebCore/svg/SVGTextContentElement.idl b/Source/WebCore/svg/SVGTextContentElement.idl index 44782b4929f6..151d797f710f 100644 --- a/Source/WebCore/svg/SVGTextContentElement.idl +++ b/Source/WebCore/svg/SVGTextContentElement.idl @@ -34,15 +34,14 @@ interface SVGTextContentElement : SVGGraphicsElement { long getNumberOfChars(); unrestricted float getComputedTextLength(); - [RaisesException] unrestricted float getSubStringLength([Default=Undefined] optional unsigned long offset, - [Default=Undefined] optional unsigned long length); - [RaisesException] SVGPoint getStartPositionOfChar([Default=Undefined] optional unsigned long offset); - [RaisesException] SVGPoint getEndPositionOfChar([Default=Undefined] optional unsigned long offset); - [RaisesException] SVGRect getExtentOfChar([Default=Undefined] optional unsigned long offset); - [RaisesException] unrestricted float getRotationOfChar([Default=Undefined] optional unsigned long offset); - long getCharNumAtPosition([Default=Undefined] optional SVGPoint point); - [RaisesException] void selectSubString([Default=Undefined] optional unsigned long offset, - [Default=Undefined] optional unsigned long length); + [RaisesException] unrestricted float getSubStringLength(optional unsigned long offset = 0, + optional unsigned long length = 0); + [RaisesException] SVGPoint getStartPositionOfChar(optional unsigned long offset = 0); + [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); + [RaisesException] void selectSubString(optional unsigned long offset = 0, optional unsigned long length = 0); }; // FIXME: SVGTextContentElement is not supposed to implement SVGExternalResourcesRequired. diff --git a/Source/WebCore/xml/DOMParser.idl b/Source/WebCore/xml/DOMParser.idl index 940496b9b386..5edfa87ed10d 100644 --- a/Source/WebCore/xml/DOMParser.idl +++ b/Source/WebCore/xml/DOMParser.idl @@ -21,6 +21,6 @@ Constructor, ImplementationLacksVTable, ] interface DOMParser { - [RaisesException] Document parseFromString([Default=Undefined] optional DOMString str, - [Default=Undefined] optional DOMString contentType); + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] Document parseFromString(optional DOMString str = "undefined", optional DOMString contentType = "undefined"); }; diff --git a/Source/WebCore/xml/XMLSerializer.cpp b/Source/WebCore/xml/XMLSerializer.cpp index 9a9f9a3921f3..b277319e304a 100644 --- a/Source/WebCore/xml/XMLSerializer.cpp +++ b/Source/WebCore/xml/XMLSerializer.cpp @@ -27,13 +27,9 @@ namespace WebCore { -String XMLSerializer::serializeToString(Node* node, ExceptionCode& ec) +String XMLSerializer::serializeToString(Node& node) { - if (!node) { - ec = TypeError; - return String(); - } - return createMarkup(*node, IncludeNode, 0, DoNotResolveURLs, 0, XMLFragmentSerialization); + return createMarkup(node, IncludeNode, 0, DoNotResolveURLs, 0, XMLFragmentSerialization); } } // namespace WebCore diff --git a/Source/WebCore/xml/XMLSerializer.h b/Source/WebCore/xml/XMLSerializer.h index 90cd13b25c56..cb40d7451c27 100644 --- a/Source/WebCore/xml/XMLSerializer.h +++ b/Source/WebCore/xml/XMLSerializer.h @@ -34,7 +34,7 @@ namespace WebCore { public: static Ref create() { return adoptRef(*new XMLSerializer); } - String serializeToString(Node*, ExceptionCode&); + String serializeToString(Node&); private: XMLSerializer() { } diff --git a/Source/WebCore/xml/XMLSerializer.idl b/Source/WebCore/xml/XMLSerializer.idl index 81732d445817..fb4d17c1e5cc 100644 --- a/Source/WebCore/xml/XMLSerializer.idl +++ b/Source/WebCore/xml/XMLSerializer.idl @@ -22,6 +22,6 @@ Constructor, ImplementationLacksVTable, ] interface XMLSerializer { - [RaisesException] DOMString serializeToString([Default=Undefined] optional Node node); + DOMString serializeToString(Node node); }; diff --git a/Source/WebCore/xml/XPathEvaluator.idl b/Source/WebCore/xml/XPathEvaluator.idl index 198e67aa0cd2..e1e6658e510d 100644 --- a/Source/WebCore/xml/XPathEvaluator.idl +++ b/Source/WebCore/xml/XPathEvaluator.idl @@ -21,14 +21,16 @@ Constructor, ImplementationLacksVTable, ] interface XPathEvaluator { - [RaisesException] XPathExpression createExpression([Default=Undefined] optional DOMString expression, - [Default=Undefined] optional XPathNSResolver resolver); + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] XPathExpression createExpression(optional DOMString expression = "undefined", + optional XPathNSResolver resolver = null); - XPathNSResolver createNSResolver([Default=Undefined] optional Node nodeResolver); + XPathNSResolver createNSResolver(optional Node? nodeResolver = null); - [RaisesException] XPathResult evaluate([Default=Undefined] optional DOMString expression, - [Default=Undefined] optional Node contextNode, - [Default=Undefined] optional XPathNSResolver resolver, - [Default=Undefined] optional unsigned short type, - [Default=Undefined] optional XPathResult inResult); + // FIXME: Using "undefined" as default parameter value is wrong. + [RaisesException] XPathResult evaluate(optional DOMString expression = "undefined", + optional Node? contextNode = null, + optional XPathNSResolver? resolver = null, + optional unsigned short type = 0, + optional XPathResult? inResult = null); }; diff --git a/Source/WebCore/xml/XPathExpression.idl b/Source/WebCore/xml/XPathExpression.idl index 3286bdff442a..fcf3786be5ef 100644 --- a/Source/WebCore/xml/XPathExpression.idl +++ b/Source/WebCore/xml/XPathExpression.idl @@ -20,6 +20,6 @@ [ ImplementationLacksVTable, ] interface XPathExpression { - [ObjCLegacyUnnamedParameters, RaisesException] XPathResult evaluate([Default=Undefined] optional Node contextNode, [Default=Undefined] optional unsigned short type, [Default=Undefined] optional XPathResult inResult); + [ObjCLegacyUnnamedParameters, RaisesException] XPathResult evaluate(optional Node? contextNode = null, optional unsigned short type = 0, optional XPathResult? inResult = null); }; diff --git a/Source/WebCore/xml/XPathNSResolver.idl b/Source/WebCore/xml/XPathNSResolver.idl index f1271ce8cf32..869b3d663afb 100644 --- a/Source/WebCore/xml/XPathNSResolver.idl +++ b/Source/WebCore/xml/XPathNSResolver.idl @@ -23,6 +23,7 @@ ObjCProtocol, SkipVTableValidation, ] interface XPathNSResolver { - DOMString? lookupNamespaceURI([Default=Undefined] optional DOMString prefix); + // FIXME: Using "undefined" as default parameter value is wrong. + DOMString? lookupNamespaceURI(optional DOMString prefix = "undefined"); }; diff --git a/Source/WebCore/xml/XPathResult.idl b/Source/WebCore/xml/XPathResult.idl index 15d06e3f24db..6a300d2ece88 100644 --- a/Source/WebCore/xml/XPathResult.idl +++ b/Source/WebCore/xml/XPathResult.idl @@ -45,6 +45,6 @@ [GetterRaisesException] readonly attribute unsigned long snapshotLength; [RaisesException] Node iterateNext(); - [RaisesException] Node snapshotItem([Default=Undefined] optional unsigned long index); + [RaisesException] Node snapshotItem(optional unsigned long index = 0); }; diff --git a/Source/WebCore/xml/XSLTProcessor.idl b/Source/WebCore/xml/XSLTProcessor.idl index d9297e514a17..6d3261743948 100644 --- a/Source/WebCore/xml/XSLTProcessor.idl +++ b/Source/WebCore/xml/XSLTProcessor.idl @@ -36,9 +36,9 @@ ImplementationLacksVTable, ] interface XSLTProcessor { - void importStylesheet([Default=Undefined] optional Node stylesheet); - DocumentFragment transformToFragment([Default=Undefined] optional Node source, [Default=Undefined] optional Document docVal); - Document transformToDocument([Default=Undefined] optional Node source); + void importStylesheet(optional Node? stylesheet = null); + DocumentFragment transformToFragment(optional Node? source = null, optional Document? docVal = null); + Document transformToDocument(optional Node? source = null); [Custom] void setParameter(DOMString namespaceURI, DOMString localName, DOMString value); [Custom] DOMString getParameter(DOMString namespaceURI, DOMString localName); diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 1f7f9015fa51..8a94ec58b10e 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,12 @@ +2016-04-23 Chris Dumez + + [WebIDL] Drop [Default] WebKit-IDL extended attribute + https://bugs.webkit.org/show_bug.cgi?id=156955 + + Reviewed by Darin Adler. + + * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: + 2016-04-23 Csaba Osztrogonác Really enable INDEXED_DATABASE on Apple Mac cmake build diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl index 3d5ffad5c16f..89c3c8ebc3cd 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl +++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl @@ -175,7 +175,7 @@ interface TestRunner { // Geolocation void setGeolocationPermission(boolean value); - void setMockGeolocationPosition(double latitude, double longitude, double accuracy, [Default=Undefined] optional object altitude, optional object altitudeAccuracy, optional object heading, optional object speed); + void setMockGeolocationPosition(double latitude, double longitude, double accuracy, optional object altitude, optional object altitudeAccuracy, optional object heading, optional object speed); void setMockGeolocationPositionUnavailableError(DOMString errorMessage); boolean isGeolocationProviderActive();