<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[189957] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/189957">189957</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-09-17 18:48:17 -0700 (Thu, 17 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WebIDL] Add support for default parameter values
https://bugs.webkit.org/show_bug.cgi?id=149263
&lt;rdar://problem/22545600&gt;

Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

Rebaseline several W3C tests now that more NodeIterator / TreeWalker
checks are passing.

* web-platform-tests/dom/traversal/NodeIterator-expected.txt:
* web-platform-tests/dom/traversal/TreeWalker-basic-expected.txt:

Source/WebCore:

Add support for default parameter values to our Web IDL parser and JS
bindings generator. This allows the bindings to convert undefined to
the parameter's default value for optional parameters:
https://heycam.github.io/webidl/#dfn-optional-argument-default-value

Previously, our bindings generator would just convert undefined to
0 / false / &quot;undefined&quot; for optional parameters, depending on the
parameter type.

This patch uses the new default parameter support to fix a bug in
document.createNodeIterator() / document.createTreeWalker()'s handling
of the whatToShow parameter:
https://dom.spec.whatwg.org/#document

WebKit currently was undefined to 0 in this case, even though it should
use the parameter's default value: OxFFFFFFFF.

I am planning to go through other optional parameters in a follow-up
patch and add default values where needed.

No new tests, already covered by existing layout tests and
added bindings tests coverage.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateParametersCheck):
* bindings/scripts/IDLParser.pm:
(parseOptionalOrRequiredArgument):
* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
(webkit_dom_test_obj_method_with_optional_arg_and_default_value):
(webkit_dom_test_obj_method_with_optional_string_and_default_value):
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue):
* bindings/scripts/test/ObjC/DOMTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
(-[DOMTestObj methodWithOptionalArgAndDefaultValue:]):
(-[DOMTestObj methodWithOptionalStringAndDefaultValue:]):
* bindings/scripts/test/TestObj.idl:
* dom/Document.idl:

LayoutTests:

Rebaseline several NodeIterator / TreeWalker tests now that more checks
are passing.

* fast/dom/createNodeIterator-parameters-expected.txt:
* fast/dom/createTreeWalker-parameters-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomcreateNodeIteratorparametersexpectedtxt">trunk/LayoutTests/fast/dom/createNodeIterator-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomcreateTreeWalkerparametersexpectedtxt">trunk/LayoutTests/fast/dom/createTreeWalker-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomtraversalNodeIteratorexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/NodeIterator-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomtraversalTreeWalkerbasicexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/TreeWalker-basic-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsIDLParserpm">trunk/Source/WebCore/bindings/scripts/IDLParser.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjh">trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestObjh">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestObjmm">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
<li><a href="#trunkSourceWebCoredomDocumentidl">trunk/Source/WebCore/dom/Document.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/LayoutTests/ChangeLog        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-09-17  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WebIDL] Add support for default parameter values
+        https://bugs.webkit.org/show_bug.cgi?id=149263
+        &lt;rdar://problem/22545600&gt;
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline several NodeIterator / TreeWalker tests now that more checks
+        are passing.
+
+        * fast/dom/createNodeIterator-parameters-expected.txt:
+        * fast/dom/createTreeWalker-parameters-expected.txt:
+
</ins><span class="cx"> 2015-09-17  Saam barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         add a regress test for richards with try/catch.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomcreateNodeIteratorparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/createNodeIterator-parameters-expected.txt (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/createNodeIterator-parameters-expected.txt        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/LayoutTests/fast/dom/createNodeIterator-parameters-expected.txt        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> iterator = document.createNodeIterator(document, undefined, undefined)
</span><span class="cx"> PASS iterator.root is document
</span><span class="cx"> PASS iterator.referenceNode is document
</span><del>-FAIL iterator.whatToShow should be 4294967295. Was 0.
</del><ins>+PASS iterator.whatToShow is 0xFFFFFFFF
</ins><span class="cx"> PASS iterator.filter is null
</span><span class="cx"> PASS iterator.pointerBeforeReferenceNode is true
</span><span class="cx"> PASS successfullyParsed is true
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomcreateTreeWalkerparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/createTreeWalker-parameters-expected.txt (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/createTreeWalker-parameters-expected.txt        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/LayoutTests/fast/dom/createTreeWalker-parameters-expected.txt        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> walker = document.createTreeWalker(document, undefined, undefined)
</span><span class="cx"> PASS walker.root is document
</span><span class="cx"> PASS walker.currentNode is document
</span><del>-FAIL walker.whatToShow should be 4294967295. Was 0.
</del><ins>+PASS walker.whatToShow is 0xFFFFFFFF
</ins><span class="cx"> PASS walker.filter is null
</span><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-09-17  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WebIDL] Add support for default parameter values
+        https://bugs.webkit.org/show_bug.cgi?id=149263
+        &lt;rdar://problem/22545600&gt;
+
+        Reviewed by Ryosuke Niwa.
+
+        Rebaseline several W3C tests now that more NodeIterator / TreeWalker
+        checks are passing.
+
+        * web-platform-tests/dom/traversal/NodeIterator-expected.txt:
+        * web-platform-tests/dom/traversal/TreeWalker-basic-expected.txt:
+
</ins><span class="cx"> 2015-09-17  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         CSS WG multicol-1 tests failures with 1px differences due to baseline difference.
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomtraversalNodeIteratorexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/NodeIterator-expected.txt (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/NodeIterator-expected.txt        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/NodeIterator-expected.txt        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> PASS detach() should be a no-op 
</span><span class="cx"> PASS createNodeIterator() parameter defaults 
</span><span class="cx"> PASS createNodeIterator() with null as arguments 
</span><del>-FAIL createNodeIterator() with undefined as arguments assert_equals: whatToShow expected 4294967295 but got 0
</del><ins>+PASS createNodeIterator() with undefined as arguments 
</ins><span class="cx"> PASS Propagate exception from filter function 
</span><span class="cx"> PASS document.createNodeIterator(paras[0], 0, null) 
</span><span class="cx"> PASS document.createNodeIterator(paras[0], 0, (function(node) { return true })) 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomtraversalTreeWalkerbasicexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/TreeWalker-basic-expected.txt (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/TreeWalker-basic-expected.txt        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/traversal/TreeWalker-basic-expected.txt        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx"> 
</span><span class="cx"> PASS Construct a TreeWalker by document.createTreeWalker(root). 
</span><span class="cx"> PASS Construct a TreeWalker by document.createTreeWalker(root, null, null). 
</span><del>-FAIL Construct a TreeWalker by document.createTreeWalker(root, undefined, undefined). assert_equals: whatToShow expected 4294967295 but got 0
</del><ins>+PASS Construct a TreeWalker by document.createTreeWalker(root, undefined, undefined). 
</ins><span class="cx"> PASS Give an invalid root node to document.createTreeWalker(). 
</span><span class="cx"> PASS Walk over nodes. 
</span><span class="cx"> PASS Optional arguments to createTreeWalker should be optional (3 passed, null). 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/ChangeLog        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2015-09-17  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        [WebIDL] Add support for default parameter values
+        https://bugs.webkit.org/show_bug.cgi?id=149263
+        &lt;rdar://problem/22545600&gt;
+
+        Reviewed by Ryosuke Niwa.
+
+        Add support for default parameter values to our Web IDL parser and JS
+        bindings generator. This allows the bindings to convert undefined to
+        the parameter's default value for optional parameters:
+        https://heycam.github.io/webidl/#dfn-optional-argument-default-value
+
+        Previously, our bindings generator would just convert undefined to
+        0 / false / &quot;undefined&quot; for optional parameters, depending on the
+        parameter type.
+
+        This patch uses the new default parameter support to fix a bug in
+        document.createNodeIterator() / document.createTreeWalker()'s handling
+        of the whatToShow parameter:
+        https://dom.spec.whatwg.org/#document
+
+        WebKit currently was undefined to 0 in this case, even though it should
+        use the parameter's default value: OxFFFFFFFF.
+
+        I am planning to go through other optional parameters in a follow-up
+        patch and add default values where needed.
+
+        No new tests, already covered by existing layout tests and
+        added bindings tests coverage.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateParametersCheck):
+        * bindings/scripts/IDLParser.pm:
+        (parseOptionalOrRequiredArgument):
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+        (webkit_dom_test_obj_method_with_optional_arg_and_default_value):
+        (webkit_dom_test_obj_method_with_optional_string_and_default_value):
+        * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue):
+        * bindings/scripts/test/ObjC/DOMTestObj.h:
+        * bindings/scripts/test/ObjC/DOMTestObj.mm:
+        (-[DOMTestObj methodWithOptionalArgAndDefaultValue:]):
+        (-[DOMTestObj methodWithOptionalStringAndDefaultValue:]):
+        * bindings/scripts/test/TestObj.idl:
+        * dom/Document.idl:
+
</ins><span class="cx"> 2015-09-17  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Multi-hop reference cycles not detected.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -3404,6 +3404,9 @@
</span><span class="cx">                 if ($optional &amp;&amp; $defaultAttribute &amp;&amp; $defaultAttribute eq &quot;NullString&quot;) {
</span><span class="cx">                     $outer = &quot;exec-&gt;argument($argsIndex).isUndefined() ? String() : &quot;;
</span><span class="cx">                     $inner = &quot;exec-&gt;uncheckedArgument($argsIndex)&quot;;
</span><ins>+                } elsif ($optional &amp;&amp; $parameter-&gt;default) {
+                    $outer = &quot;exec-&gt;argument($argsIndex).isUndefined() ? &quot; . $parameter-&gt;default  . &quot; : &quot;;
+                    $inner = &quot;exec-&gt;uncheckedArgument($argsIndex)&quot;;
</ins><span class="cx">                 } else {
</span><span class="cx">                     $outer = &quot;&quot;;
</span><span class="cx">                     $inner = &quot;exec-&gt;argument($argsIndex)&quot;;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsIDLParserpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -82,6 +82,7 @@
</span><span class="cx">     isNullable =&gt; '$', # Is variable type Nullable (T?)
</span><span class="cx">     isVariadic =&gt; '$', # Is variable variadic (long... numbers)
</span><span class="cx">     isOptional =&gt; '$', # Is variable optional (optional T)
</span><ins>+    default =&gt; '$', # Default value for parameters
</ins><span class="cx"> });
</span><span class="cx"> 
</span><span class="cx"> # Used to represent string constants
</span><span class="lines">@@ -1433,7 +1434,7 @@
</span><span class="cx">         $paramDataNode-&gt;type(identifierRemoveNullablePrefix(typeRemoveNullableSuffix($type)));
</span><span class="cx">         $paramDataNode-&gt;isOptional(1);
</span><span class="cx">         $paramDataNode-&gt;name($self-&gt;parseArgumentName());
</span><del>-        $self-&gt;parseDefault();
</del><ins>+        $paramDataNode-&gt;default($self-&gt;parseDefault());
</ins><span class="cx">         return $paramDataNode;
</span><span class="cx">     }
</span><span class="cx">     if ($next-&gt;type() == IdentifierToken || $next-&gt;value() =~ /$nextExceptionField_1/) {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -1283,6 +1283,14 @@
</span><span class="cx">     item-&gt;methodWithOptionalArg(opt);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void webkit_dom_test_obj_method_with_optional_arg_and_default_value(WebKitDOMTestObj* self, glong opt)
+{
+    WebCore::JSMainThreadNullState state;
+    g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+    WebCore::TestObj* item = WebKit::core(self);
+    item-&gt;methodWithOptionalArgAndDefaultValue(opt);
+}
+
</ins><span class="cx"> void webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg(WebKitDOMTestObj* self, glong nonOpt, glong opt)
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><span class="lines">@@ -1309,6 +1317,16 @@
</span><span class="cx">     item-&gt;methodWithOptionalString(convertedStr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void webkit_dom_test_obj_method_with_optional_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-&gt;methodWithOptionalStringAndDefaultValue(convertedStr);
+}
+
</ins><span class="cx"> void webkit_dom_test_obj_method_with_optional_string_is_undefined(WebKitDOMTestObj* self, const gchar* str)
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -384,6 +384,16 @@
</span><span class="cx"> webkit_dom_test_obj_method_with_optional_arg(WebKitDOMTestObj* self, glong opt);
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * webkit_dom_test_obj_method_with_optional_arg_and_default_value:
+ * @self: A #WebKitDOMTestObj
+ * @opt: A #glong
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_arg_and_default_value(WebKitDOMTestObj* self, glong opt);
+
+/**
</ins><span class="cx">  * webkit_dom_test_obj_method_with_non_optional_arg_and_optional_arg:
</span><span class="cx">  * @self: A #WebKitDOMTestObj
</span><span class="cx">  * @nonOpt: A #glong
</span><span class="lines">@@ -417,6 +427,16 @@
</span><span class="cx"> webkit_dom_test_obj_method_with_optional_string(WebKitDOMTestObj* self, const gchar* str);
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * webkit_dom_test_obj_method_with_optional_string_and_default_value:
+ * @self: A #WebKitDOMTestObj
+ * @str: A #gchar
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_method_with_optional_string_and_default_value(WebKitDOMTestObj* self, const gchar* str);
+
+/**
</ins><span class="cx">  * webkit_dom_test_obj_method_with_optional_string_is_undefined:
</span><span class="cx">  * @self: A #WebKitDOMTestObj
</span><span class="cx">  * @str: A #gchar
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -109,9 +109,11 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStack(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalString(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsNullString(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(JSC::ExecState*);
</span><span class="lines">@@ -620,9 +622,11 @@
</span><span class="cx">     { &quot;withScriptExecutionContextAndScriptStateWithSpaces&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionWithScriptExecutionContextAndScriptStateWithSpaces), (intptr_t) (0) } },
</span><span class="cx">     { &quot;withScriptArgumentsAndCallStack&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStack), (intptr_t) (0) } },
</span><span class="cx">     { &quot;methodWithOptionalArg&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t) (0) } },
</span><ins>+    { &quot;methodWithOptionalArgAndDefaultValue&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue), (intptr_t) (0) } },
</ins><span class="cx">     { &quot;methodWithNonOptionalArgAndOptionalArg&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t) (1) } },
</span><span class="cx">     { &quot;methodWithNonOptionalArgAndTwoOptionalArgs&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t) (1) } },
</span><span class="cx">     { &quot;methodWithOptionalString&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithOptionalString), (intptr_t) (0) } },
</span><ins>+    { &quot;methodWithOptionalStringAndDefaultValue&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue), (intptr_t) (0) } },
</ins><span class="cx">     { &quot;methodWithOptionalStringIsUndefined&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined), (intptr_t) (0) } },
</span><span class="cx">     { &quot;methodWithOptionalStringIsNullString&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithOptionalStringIsNullString), (intptr_t) (0) } },
</span><span class="cx">     { &quot;methodWithCallbackArg&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithCallbackArg), (intptr_t) (1) } },
</span><span class="lines">@@ -3529,6 +3533,28 @@
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue(ExecState* exec)
+{
+    JSValue thisValue = exec-&gt;thisValue();
+    JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*exec, &quot;TestObj&quot;, &quot;methodWithOptionalArgAndDefaultValue&quot;);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto&amp; impl = castedThis-&gt;impl();
+
+    size_t argsCount = exec-&gt;argumentCount();
+    if (argsCount &lt;= 0) {
+        impl.methodWithOptionalArgAndDefaultValue();
+        return JSValue::encode(jsUndefined());
+    }
+
+    int opt = exec-&gt;argument(0).isUndefined() ? 666 : toInt32(exec, exec-&gt;uncheckedArgument(0), NormalConversion);
+    if (UNLIKELY(exec-&gt;hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.methodWithOptionalArgAndDefaultValue(opt);
+    return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     JSValue thisValue = exec-&gt;thisValue();
</span><span class="lines">@@ -3613,6 +3639,28 @@
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringAndDefaultValue(ExecState* exec)
+{
+    JSValue thisValue = exec-&gt;thisValue();
+    JSTestObj* castedThis = jsDynamicCast&lt;JSTestObj*&gt;(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*exec, &quot;TestObj&quot;, &quot;methodWithOptionalStringAndDefaultValue&quot;);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+    auto&amp; impl = castedThis-&gt;impl();
+
+    size_t argsCount = exec-&gt;argumentCount();
+    if (argsCount &lt;= 0) {
+        impl.methodWithOptionalStringAndDefaultValue();
+        return JSValue::encode(jsUndefined());
+    }
+
+    String str = exec-&gt;argument(0).isUndefined() ? &quot;foo&quot; : exec-&gt;uncheckedArgument(0).toString(exec)-&gt;value(exec);
+    if (UNLIKELY(exec-&gt;hadException()))
+        return JSValue::encode(jsUndefined());
+    impl.methodWithOptionalStringAndDefaultValue(str);
+    return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalStringIsUndefined(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     JSValue thisValue = exec-&gt;thisValue();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -151,9 +151,11 @@
</span><span class="cx"> - (DOMTestObj *)withScriptExecutionContextAndScriptStateWithSpaces;
</span><span class="cx"> - (void)withScriptArgumentsAndCallStack;
</span><span class="cx"> - (void)methodWithOptionalArg:(int)opt;
</span><ins>+- (void)methodWithOptionalArgAndDefaultValue:(int)opt;
</ins><span class="cx"> - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt;
</span><span class="cx"> - (void)methodWithNonOptionalArgAndTwoOptionalArgs:(int)nonOpt opt1:(int)opt1 opt2:(int)opt2;
</span><span class="cx"> - (void)methodWithOptionalString:(NSString *)str;
</span><ins>+- (void)methodWithOptionalStringAndDefaultValue:(NSString *)str;
</ins><span class="cx"> - (void)methodWithOptionalStringIsUndefined:(NSString *)str;
</span><span class="cx"> - (void)methodWithOptionalStringIsNullString:(NSString *)str;
</span><span class="cx"> - (void)classMethod;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -1007,6 +1007,12 @@
</span><span class="cx">     IMPL-&gt;methodWithOptionalArg(opt);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)methodWithOptionalArgAndDefaultValue:(int)opt
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL-&gt;methodWithOptionalArgAndDefaultValue(opt);
+}
+
</ins><span class="cx"> - (void)methodWithNonOptionalArgAndOptionalArg:(int)nonOpt opt:(int)opt
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><span class="lines">@@ -1025,6 +1031,12 @@
</span><span class="cx">     IMPL-&gt;methodWithOptionalString(str);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)methodWithOptionalStringAndDefaultValue:(NSString *)str
+{
+    WebCore::JSMainThreadNullState state;
+    IMPL-&gt;methodWithOptionalStringAndDefaultValue(str);
+}
+
</ins><span class="cx"> - (void)methodWithOptionalStringIsUndefined:(NSString *)str
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -140,11 +140,13 @@
</span><span class="cx">     [CallWith=  ScriptExecutionContext  &amp;  ScriptState  ] attribute TestObj withScriptExecutionContextAndScriptStateWithSpacesAttribute;
</span><span class="cx">     [CallWith=ScriptArguments&amp;CallStack] attribute TestObj withScriptArgumentsAndCallStackAttribute;
</span><span class="cx"> 
</span><del>-    // 'Optional' extended attribute
</del><ins>+    // Optional parameters.
</ins><span class="cx">     void    methodWithOptionalArg(optional long opt);
</span><ins>+    void    methodWithOptionalArgAndDefaultValue(optional long opt = 666);
</ins><span class="cx">     void    methodWithNonOptionalArgAndOptionalArg(long nonOpt, optional long opt);
</span><span class="cx">     void    methodWithNonOptionalArgAndTwoOptionalArgs(long nonOpt, optional long opt1, optional long opt2);
</span><span class="cx">     void    methodWithOptionalString(optional DOMString str);
</span><ins>+    void    methodWithOptionalStringAndDefaultValue(optional DOMString str = &quot;foo&quot;);
</ins><span class="cx">     void    methodWithOptionalStringIsUndefined([Default=Undefined] optional DOMString str);
</span><span class="cx">     void    methodWithOptionalStringIsNullString([Default=NullString] optional DOMString str);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.idl (189956 => 189957)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.idl        2015-09-18 01:34:58 UTC (rev 189956)
+++ trunk/Source/WebCore/dom/Document.idl        2015-09-18 01:48:17 UTC (rev 189957)
</span><span class="lines">@@ -93,11 +93,11 @@
</span><span class="cx">     // DOM Level 2 Tranversal and Range (DocumentTraversal interface)
</span><span class="cx"> 
</span><span class="cx">     [ObjCLegacyUnnamedParameters, RaisesException, NewObject] NodeIterator createNodeIterator(Node root,
</span><del>-        optional unsigned long whatToShow,
</del><ins>+        optional unsigned long whatToShow = 0xFFFFFFFF,
</ins><span class="cx">         optional NodeFilter? filter,
</span><span class="cx">         optional boolean expandEntityReferences);
</span><span class="cx">     [ObjCLegacyUnnamedParameters, RaisesException, NewObject] TreeWalker createTreeWalker(Node root,
</span><del>-        optional unsigned long whatToShow,
</del><ins>+        optional unsigned long whatToShow = 0xFFFFFFFF,
</ins><span class="cx">         optional NodeFilter? filter,
</span><span class="cx">         optional boolean expandEntityReferences);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>