<!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>[200907] 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/200907">200907</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-05-13 19:10:27 -0700 (Fri, 13 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Align window.scroll() / scrollTo() / scrollBy() with the CSSOM specification
https://bugs.webkit.org/show_bug.cgi?id=157666
Reviewed by Darin Adler.
Source/WebCore:
Align window.scroll() / scrollTo() / scrollBy() with Firefox and the CSSOM
specification:
https://drafts.csswg.org/cssom-view/#extensions-to-the-window-interface
In particular, the following changes were made:
1. Make parameters to scroll() / scrollTo() / scrollBy() mandatory.
2. Add overloads for scroll() / scrollTo() / scrollBy() that take an
optional ScrollToOptions dictionary.
3. Update API to use "unrestricted double" typing for x/y instead of
"long". This matches the specification but it does not really change
our behavior at this point because the values are still casted to
int in our implementation.
Web-Exposed behavior changes:
1. JS can now pass a dictionary to scroll() / scrollTo() / scrollBy().
This a new feature that Firefox already supports (Chrome does not).
2. Passing only 1 parameter to scroll() / scrollTo() / scrollBy() that
is not a dictionary will now throw a TypeError. The compatibility
risky should be low because Firefox and Chrome already throw in this
case (Chrome has been throwing for 2 years and a half).
3. Calling scrollTo() / scroll() without any parameter no longer
scrolls to 0. Instead we use the current viewport's x/y which means
we don't scroll at all. The new behavior matches Firefox, Chrome and
IE 11. This fixes scrolling on the following Website:
https://members.chosun.com/cms_subscribe/application/index.jsp
No new tests, extended existing testing.
* bindings/js/JSDOMConvert.h:
(WebCore::convert):
(WebCore::convertOptional):
* bindings/scripts/CodeGeneratorJS.pm:
(ShouldAllowNonFiniteForFloatingPointType):
(GenerateConversionRuleWithLeadingComma):
(GenerateDictionaryImplementationContent):
(JSValueToNative):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::convert<TestObj::Dictionary>):
* bindings/scripts/test/TestObj.idl:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::scrollBy):
(WebCore::DOMWindow::scrollTo):
* page/DOMWindow.h:
* page/DOMWindow.idl:
LayoutTests:
Update / improve testing coverage for the API.
* fast/dom/Window/window-scroll-arguments-expected.txt:
* fast/dom/Window/window-scroll-arguments.html:
* fast/dom/non-numeric-values-numeric-parameters-expected.txt:
* fast/dom/script-tests/non-numeric-values-numeric-parameters.js:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomWindowwindowscrollargumentsexpectedtxt">trunk/LayoutTests/fast/dom/Window/window-scroll-arguments-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomWindowwindowscrollargumentshtml">trunk/LayoutTests/fast/dom/Window/window-scroll-arguments.html</a></li>
<li><a href="#trunkLayoutTestsfastdomnonnumericvaluesnumericparametersexpectedtxt">trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomscripttestsnonnumericvaluesnumericparametersjs">trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMConverth">trunk/Source/WebCore/bindings/js/JSDOMConvert.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowh">trunk/Source/WebCore/page/DOMWindow.h</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowidl">trunk/Source/WebCore/page/DOMWindow.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/LayoutTests/ChangeLog        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-05-13 Chris Dumez <cdumez@apple.com>
+
+ Align window.scroll() / scrollTo() / scrollBy() with the CSSOM specification
+ https://bugs.webkit.org/show_bug.cgi?id=157666
+
+ Reviewed by Darin Adler.
+
+ Update / improve testing coverage for the API.
+
+ * fast/dom/Window/window-scroll-arguments-expected.txt:
+ * fast/dom/Window/window-scroll-arguments.html:
+ * fast/dom/non-numeric-values-numeric-parameters-expected.txt:
+ * fast/dom/script-tests/non-numeric-values-numeric-parameters.js:
+
</ins><span class="cx"> 2016-05-13 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><span class="cx"> cross-fade() rendering doesn't match expectation
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomWindowwindowscrollargumentsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Window/window-scroll-arguments-expected.txt (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Window/window-scroll-arguments-expected.txt        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/LayoutTests/fast/dom/Window/window-scroll-arguments-expected.txt        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-This test makes sure that calling the window scrolling methods with less than 2 arguments treats the missing arguments as 0.
</del><ins>+This tests calling the window scrolling with only 1 argument
</ins><span class="cx">
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="cx">
</span><span class="lines">@@ -9,9 +9,19 @@
</span><span class="cx"> Testing - scrollTo with 0 arguments
</span><span class="cx"> PASS window.scrollX is resetX
</span><span class="cx"> PASS window.scrollY is resetY
</span><del>-Testing - scrollTo with 1 argument
-PASS window.scrollX is resetX + x
</del><ins>+PASS window.scrollX is x
+PASS window.scrollY is y
+Testing - scrollTo with 1 non-dictionary argument
+PASS scrollTo(0) threw exception TypeError: Type error.
+Testing - scrollTo with 1 dictionary argument
+PASS window.scrollX is x
</ins><span class="cx"> PASS window.scrollY is resetY
</span><ins>+PASS window.scrollX is resetX
+PASS window.scrollY is y
+PASS window.scrollX is x
+PASS window.scrollY is y
+PASS window.scrollX is 0
+PASS window.scrollY is 0
</ins><span class="cx"> Testing - scrollTo with more than 2 arguments
</span><span class="cx"> PASS window.scrollX is x
</span><span class="cx"> PASS window.scrollY is y
</span><span class="lines">@@ -21,9 +31,19 @@
</span><span class="cx"> Testing - scroll with 0 arguments
</span><span class="cx"> PASS window.scrollX is resetX
</span><span class="cx"> PASS window.scrollY is resetY
</span><del>-Testing - scroll with 1 argument
-PASS window.scrollX is resetX + x
</del><ins>+PASS window.scrollX is x
+PASS window.scrollY is y
+Testing - scroll with 1 non-dictionary argument
+PASS scroll(0) threw exception TypeError: Type error.
+Testing - scroll with 1 dictionary argument
+PASS window.scrollX is x
</ins><span class="cx"> PASS window.scrollY is resetY
</span><ins>+PASS window.scrollX is resetX
+PASS window.scrollY is y
+PASS window.scrollX is x
+PASS window.scrollY is y
+PASS window.scrollX is 0
+PASS window.scrollY is 0
</ins><span class="cx"> Testing - scroll with more than 2 arguments
</span><span class="cx"> PASS window.scrollX is x
</span><span class="cx"> PASS window.scrollY is y
</span><span class="lines">@@ -33,9 +53,19 @@
</span><span class="cx"> Testing - scrollBy with 0 arguments
</span><span class="cx"> PASS window.scrollX is resetX
</span><span class="cx"> PASS window.scrollY is resetY
</span><ins>+PASS window.scrollX is x
+PASS window.scrollY is y
+Testing - scrollBy with 1 non-dictionary argument
+PASS scrollBy(0) threw exception TypeError: Type error.
</ins><span class="cx"> Testing - scrollBy with 1 argument
</span><span class="cx"> PASS window.scrollX is resetX + x
</span><span class="cx"> PASS window.scrollY is resetY
</span><ins>+PASS window.scrollX is resetX
+PASS window.scrollY is resetY + y
+PASS window.scrollX is resetX + x
+PASS window.scrollY is resetY + y
+PASS window.scrollX is resetX + x
+PASS window.scrollY is resetY + y
</ins><span class="cx"> Testing - scrollBy with more than 2 arguments
</span><span class="cx"> PASS window.scrollX is resetX + x
</span><span class="cx"> PASS window.scrollY is resetY + y
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomWindowwindowscrollargumentshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Window/window-scroll-arguments.html (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Window/window-scroll-arguments.html        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/LayoutTests/fast/dom/Window/window-scroll-arguments.html        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -24,8 +24,7 @@
</span><span class="cx">
</span><span class="cx"> reset();
</span><span class="cx">
</span><del>- description("This test makes sure that calling the window scrolling\
- methods with less than 2 arguments treats the missing arguments as 0.");
</del><ins>+ description("This tests calling the window scrolling with only 1 argument");
</ins><span class="cx">
</span><span class="cx"> // scrollTo /////////////////////////
</span><span class="cx"> debug('');
</span><span class="lines">@@ -37,12 +36,34 @@
</span><span class="cx"> shouldBe('window.scrollX', 'resetX');
</span><span class="cx"> shouldBe('window.scrollY', 'resetY');
</span><span class="cx"> reset();
</span><ins>+ window.scrollTo(x, y);
+ window.scrollTo();
+ shouldBe('window.scrollX', 'x');
+ shouldBe('window.scrollY', 'y');
+ reset();
</ins><span class="cx">
</span><del>- debug("Testing - scrollTo with 1 argument");
- window.scrollTo(x);
- shouldBe('window.scrollX', 'resetX + x');
</del><ins>+ debug("Testing - scrollTo with 1 non-dictionary argument");
+ shouldThrow("scrollTo(0)");
+ reset();
+
+ debug("Testing - scrollTo with 1 dictionary argument");
+ window.scrollTo({ left: x });
+ shouldBe('window.scrollX', 'x');
</ins><span class="cx"> shouldBe('window.scrollY', 'resetY');
</span><span class="cx"> reset();
</span><ins>+ window.scrollTo({ top: y });
+ shouldBe('window.scrollX', 'resetX');
+ shouldBe('window.scrollY', 'y');
+ reset();
+ window.scrollTo({ left: x, top: y });
+ shouldBe('window.scrollX', 'x');
+ shouldBe('window.scrollY', 'y');
+ reset();
+ window.scrollTo(x, y);
+ window.scrollTo({ left: NaN, top: NaN });
+ shouldBe('window.scrollX', '0');
+ shouldBe('window.scrollY', '0');
+ reset();
</ins><span class="cx">
</span><span class="cx"> debug("Testing - scrollTo with more than 2 arguments");
</span><span class="cx"> window.scrollTo(x, y, 200, "text");
</span><span class="lines">@@ -60,12 +81,34 @@
</span><span class="cx"> shouldBe('window.scrollX', 'resetX');
</span><span class="cx"> shouldBe('window.scrollY', 'resetY');
</span><span class="cx"> reset();
</span><ins>+ window.scroll(x, y);
+ window.scroll();
+ shouldBe('window.scrollX', 'x');
+ shouldBe('window.scrollY', 'y');
+ reset();
</ins><span class="cx">
</span><del>- debug("Testing - scroll with 1 argument");
- window.scroll(x);
- shouldBe('window.scrollX', 'resetX + x');
</del><ins>+ debug("Testing - scroll with 1 non-dictionary argument");
+ shouldThrow("scroll(0)");
+ reset();
+
+ debug("Testing - scroll with 1 dictionary argument");
+ window.scroll({ left: x });
+ shouldBe('window.scrollX', 'x');
</ins><span class="cx"> shouldBe('window.scrollY', 'resetY');
</span><span class="cx"> reset();
</span><ins>+ window.scroll({ top: y });
+ shouldBe('window.scrollX', 'resetX');
+ shouldBe('window.scrollY', 'y');
+ reset();
+ window.scroll({ left: x, top: y });
+ shouldBe('window.scrollX', 'x');
+ shouldBe('window.scrollY', 'y');
+ reset();
+ window.scroll(x, y);
+ window.scroll({ left: NaN, top: NaN });
+ shouldBe('window.scrollX', '0');
+ shouldBe('window.scrollY', '0');
+ reset();
</ins><span class="cx">
</span><span class="cx"> debug("Testing - scroll with more than 2 arguments");
</span><span class="cx"> window.scroll(x, y, 200, "text");
</span><span class="lines">@@ -83,12 +126,34 @@
</span><span class="cx"> shouldBe('window.scrollX', 'resetX');
</span><span class="cx"> shouldBe('window.scrollY', 'resetY');
</span><span class="cx"> reset();
</span><ins>+ window.scrollBy(x, y);
+ window.scrollBy();
+ shouldBe('window.scrollX', 'x');
+ shouldBe('window.scrollY', 'y');
+ reset();
</ins><span class="cx">
</span><ins>+ debug("Testing - scrollBy with 1 non-dictionary argument");
+ shouldThrow("scrollBy(0)");
+ reset();
+
</ins><span class="cx"> debug("Testing - scrollBy with 1 argument");
</span><del>- window.scrollBy(x);
</del><ins>+ window.scrollBy({ left: x });
</ins><span class="cx"> shouldBe('window.scrollX', 'resetX + x');
</span><span class="cx"> shouldBe('window.scrollY', 'resetY');
</span><span class="cx"> reset();
</span><ins>+ window.scrollBy({ top: y });
+ shouldBe('window.scrollX', 'resetX');
+ shouldBe('window.scrollY', 'resetY + y');
+ reset();
+ window.scrollBy({ left: x, top: y });
+ shouldBe('window.scrollX', 'resetX + x');
+ shouldBe('window.scrollY', 'resetY + y');
+ reset();
+ window.scrollBy(x, y);
+ window.scrollBy({ left: NaN, top: NaN });
+ shouldBe('window.scrollX', 'resetX + x');
+ shouldBe('window.scrollY', 'resetY + y');
+ reset();
</ins><span class="cx">
</span><span class="cx"> debug("Testing - scrollBy with more than 2 arguments");
</span><span class="cx"> window.scrollBy(x, y, 200, "text");
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomnonnumericvaluesnumericparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -66,11 +66,11 @@
</span><span class="cx"> PASS nonNumericPolicy('document.createTreeWalker(document, x, null, false)') is 'any type allowed'
</span><span class="cx"> PASS nonNumericPolicy('document.createEvent("UIEvent").initUIEvent("a", false, false, null, x)') is 'any type allowed'
</span><span class="cx"> PASS nonNumericPolicy('window.scrollBy(x, 0)') is 'any type allowed'
</span><del>-PASS nonNumericPolicy('window.scrollBy(0, x)') is 'any type allowed'
</del><ins>+PASS nonNumericPolicy('window.scrollBy(0, x)') is 'any type allowed (but not omitted)'
</ins><span class="cx"> PASS nonNumericPolicy('window.scrollTo(x, 0)') is 'any type allowed'
</span><del>-PASS nonNumericPolicy('window.scrollTo(0, x)') is 'any type allowed'
</del><ins>+PASS nonNumericPolicy('window.scrollTo(0, x)') is 'any type allowed (but not omitted)'
</ins><span class="cx"> PASS nonNumericPolicy('window.scroll(x, 0)') is 'any type allowed'
</span><del>-PASS nonNumericPolicy('window.scroll(0, x)') is 'any type allowed'
</del><ins>+PASS nonNumericPolicy('window.scroll(0, x)') is 'any type allowed (but not omitted)'
</ins><span class="cx"> PASS nonNumericPolicy('window.moveBy(x, 0)') is 'any type allowed'
</span><span class="cx"> PASS nonNumericPolicy('window.moveBy(0, x)') is 'any type allowed'
</span><span class="cx"> PASS nonNumericPolicy('window.moveTo(x, 0)') is 'any type allowed'
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomscripttestsnonnumericvaluesnumericparametersjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -344,11 +344,11 @@
</span><span class="cx"> // Window
</span><span class="cx">
</span><span class="cx"> shouldBe("nonNumericPolicy('window.scrollBy(x, 0)')", "'any type allowed'");
</span><del>-shouldBe("nonNumericPolicy('window.scrollBy(0, x)')", "'any type allowed'");
</del><ins>+shouldBe("nonNumericPolicy('window.scrollBy(0, x)')", "'any type allowed (but not omitted)'");
</ins><span class="cx"> shouldBe("nonNumericPolicy('window.scrollTo(x, 0)')", "'any type allowed'");
</span><del>-shouldBe("nonNumericPolicy('window.scrollTo(0, x)')", "'any type allowed'");
</del><ins>+shouldBe("nonNumericPolicy('window.scrollTo(0, x)')", "'any type allowed (but not omitted)'");
</ins><span class="cx"> shouldBe("nonNumericPolicy('window.scroll(x, 0)')", "'any type allowed'");
</span><del>-shouldBe("nonNumericPolicy('window.scroll(0, x)')", "'any type allowed'");
</del><ins>+shouldBe("nonNumericPolicy('window.scroll(0, x)')", "'any type allowed (but not omitted)'");
</ins><span class="cx"> shouldBe("nonNumericPolicy('window.moveBy(x, 0)')", "'any type allowed'");
</span><span class="cx"> shouldBe("nonNumericPolicy('window.moveBy(0, x)')", "'any type allowed'");
</span><span class="cx"> shouldBe("nonNumericPolicy('window.moveTo(x, 0)')", "'any type allowed'");
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/Source/WebCore/ChangeLog        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2016-05-13 Chris Dumez <cdumez@apple.com>
+
+ Align window.scroll() / scrollTo() / scrollBy() with the CSSOM specification
+ https://bugs.webkit.org/show_bug.cgi?id=157666
+
+ Reviewed by Darin Adler.
+
+ Align window.scroll() / scrollTo() / scrollBy() with Firefox and the CSSOM
+ specification:
+ https://drafts.csswg.org/cssom-view/#extensions-to-the-window-interface
+
+ In particular, the following changes were made:
+ 1. Make parameters to scroll() / scrollTo() / scrollBy() mandatory.
+ 2. Add overloads for scroll() / scrollTo() / scrollBy() that take an
+ optional ScrollToOptions dictionary.
+ 3. Update API to use "unrestricted double" typing for x/y instead of
+ "long". This matches the specification but it does not really change
+ our behavior at this point because the values are still casted to
+ int in our implementation.
+
+ Web-Exposed behavior changes:
+ 1. JS can now pass a dictionary to scroll() / scrollTo() / scrollBy().
+ This a new feature that Firefox already supports (Chrome does not).
+ 2. Passing only 1 parameter to scroll() / scrollTo() / scrollBy() that
+ is not a dictionary will now throw a TypeError. The compatibility
+ risky should be low because Firefox and Chrome already throw in this
+ case (Chrome has been throwing for 2 years and a half).
+ 3. Calling scrollTo() / scroll() without any parameter no longer
+ scrolls to 0. Instead we use the current viewport's x/y which means
+ we don't scroll at all. The new behavior matches Firefox, Chrome and
+ IE 11. This fixes scrolling on the following Website:
+ https://members.chosun.com/cms_subscribe/application/index.jsp
+
+ No new tests, extended existing testing.
+
+ * bindings/js/JSDOMConvert.h:
+ (WebCore::convert):
+ (WebCore::convertOptional):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (ShouldAllowNonFiniteForFloatingPointType):
+ (GenerateConversionRuleWithLeadingComma):
+ (GenerateDictionaryImplementationContent):
+ (JSValueToNative):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::convert<TestObj::Dictionary>):
+ * bindings/scripts/test/TestObj.idl:
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::scrollBy):
+ (WebCore::DOMWindow::scrollTo):
+ * page/DOMWindow.h:
+ * page/DOMWindow.idl:
+
</ins><span class="cx"> 2016-05-13 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r200894.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMConverth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMConvert.h (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -32,7 +32,7 @@
</span><span class="cx">
</span><span class="cx"> enum class ShouldAllowNonFinite { No, Yes };
</span><span class="cx">
</span><del>-template<typename T> struct Converter;
</del><ins>+template<typename T, typename Enable = void> struct Converter;
</ins><span class="cx">
</span><span class="cx"> template<typename T> T convert(JSC::ExecState&, JSC::JSValue);
</span><span class="cx"> template<typename T> T convert(JSC::ExecState&, JSC::JSValue, IntegerConversionConfiguration);
</span><span class="lines">@@ -41,6 +41,9 @@
</span><span class="cx"> template<typename T> typename Converter<T>::OptionalValue convertOptional(JSC::ExecState&, JSC::JSValue);
</span><span class="cx"> template<typename T, typename U> T convertOptional(JSC::ExecState&, JSC::JSValue, U&& defaultValue);
</span><span class="cx">
</span><ins>+template<typename T> typename Converter<T>::OptionalValue convertOptional(JSC::ExecState&, JSC::JSValue, ShouldAllowNonFinite);
+template<typename T, typename U> T convertOptional(JSC::ExecState&, JSC::JSValue, ShouldAllowNonFinite, U&& defaultValue);
+
</ins><span class="cx"> // This is where the implementation of the things declared above begins:
</span><span class="cx">
</span><span class="cx"> template<typename T> T convert(JSC::ExecState& state, JSC::JSValue value)
</span><span class="lines">@@ -56,10 +59,7 @@
</span><span class="cx"> template<typename T> inline T convert(JSC::ExecState& state, JSC::JSValue value, ShouldAllowNonFinite allow)
</span><span class="cx"> {
</span><span class="cx"> static_assert(std::is_same<T, float>::value || std::is_same<T, double>::value, "ShouldAllowNonFinite can only be used with float or double");
</span><del>- double number = value.toNumber(&state);
- if (allow == ShouldAllowNonFinite::No && UNLIKELY(!std::isfinite(number)))
- throwNonFiniteTypeError(state);
- return static_cast<T>(number);
</del><ins>+ return Converter<T>::convert(state, value, allow);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template<typename T> typename Converter<T>::OptionalValue inline convertOptional(JSC::ExecState& state, JSC::JSValue value)
</span><span class="lines">@@ -72,11 +72,21 @@
</span><span class="cx"> return value.isUndefined() ? std::forward<U>(defaultValue) : convert<T>(state, value);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+template<typename T> typename Converter<T>::OptionalValue inline convertOptional(JSC::ExecState& state, JSC::JSValue value, ShouldAllowNonFinite allow)
+{
+ return value.isUndefined() ? typename Converter<T>::OptionalValue() : convert<T>(state, value, allow);
+}
+
+template<typename T, typename U> inline T convertOptional(JSC::ExecState& state, JSC::JSValue value, ShouldAllowNonFinite allow, U&& defaultValue)
+{
+ return value.isUndefined() ? std::forward<U>(defaultValue) : convert<T>(state, value, allow);
+}
+
</ins><span class="cx"> template<typename T> struct DefaultConverter {
</span><span class="cx"> using OptionalValue = Optional<T>;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-template<typename T> struct Converter : DefaultConverter<T> {
</del><ins>+template<typename T, typename Enable> struct Converter : DefaultConverter<T> {
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<> struct Converter<bool> : DefaultConverter<bool> {
</span><span class="lines">@@ -228,4 +238,14 @@
</span><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+template<typename T> struct Converter<T, typename std::enable_if<std::is_floating_point<T>::value>::type> : DefaultConverter<T> {
+ static T convert(JSC::ExecState& state, JSC::JSValue value, ShouldAllowNonFinite allow)
+ {
+ double number = value.toNumber(&state);
+ if (allow == ShouldAllowNonFinite::No && UNLIKELY(!std::isfinite(number)))
+ throwNonFiniteTypeError(state);
+ return static_cast<T>(number);
+ }
+};
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -958,6 +958,25 @@
</span><span class="cx"> return $value;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+sub ShouldAllowNonFiniteForFloatingPointType
+{
+ my $type = shift;
+
+ die "Can only be called with floating point types" unless $codeGenerator->IsFloatingPointType($type);
+ return $type eq "unrestricted double" || $type eq "unrestricted float";
+}
+
+sub GenerateConversionRuleWithLeadingComma
+{
+ my ($interface, $member) = @_;
+
+ if ($codeGenerator->IsFloatingPointType($member->type)) {
+ return ", " . (ShouldAllowNonFiniteForFloatingPointType($member->type) ? "ShouldAllowNonFinite::Yes" : "ShouldAllowNonFinite::No");
+ }
+ # FIXME: Add support for integer types.
+ return "";
+}
+
</ins><span class="cx"> sub GenerateDefaultValueWithLeadingComma
</span><span class="cx"> {
</span><span class="cx"> my ($interface, $member) = @_;
</span><span class="lines">@@ -1011,9 +1030,9 @@
</span><span class="cx"> }
</span><span class="cx"> # FIXME: Eventually we will want this to share a lot more code with JSValueToNative.
</span><span class="cx"> my $function = $member->isOptional ? "convertOptional" : "convert";
</span><del>- my $defaultValueWithLeadingComma = $member->isOptional && defined $member->default ? ", " . $member->default : "";
</del><span class="cx"> $result .= " auto " . $member->name . " = " . $function . "<" . GetNativeTypeFromSignature($interface, $member) . ">"
</span><span class="cx"> . "(state, object->get(&state, Identifier::fromString(&state, \"" . $member->name . "\"))"
</span><ins>+ . GenerateConversionRuleWithLeadingComma($interface, $member)
</ins><span class="cx"> . GenerateDefaultValueWithLeadingComma($interface, $member) . ");\n";
</span><span class="cx"> $needExceptionCheck = 1;
</span><span class="cx"> }
</span><span class="lines">@@ -4425,11 +4444,9 @@
</span><span class="cx">
</span><span class="cx"> if ($codeGenerator->IsFloatingPointType($type)) {
</span><span class="cx"> AddToImplIncludes("JSDOMConvert.h");
</span><del>- return ("convert<double>(*state, $value, ShouldAllowNonFinite::No)", 1) if $type eq "double";
- return ("convert<double>(*state, $value, ShouldAllowNonFinite::Yes)", 1) if $type eq "unrestricted double";
- return ("convert<float>(*state, $value, ShouldAllowNonFinite::No)", 1) if $type eq "float";
- return ("convert<float>(*state, $value, ShouldAllowNonFinite::Yes)", 1) if $type eq "unrestricted float";
- die "Unhandled floating point type: " . $type;
</del><ins>+ my $allowNonFinite = ShouldAllowNonFiniteForFloatingPointType($type) ? "ShouldAllowNonFinite::Yes" : "ShouldAllowNonFinite::No";
+ my $nativeType = GetNativeType($interface, $type);
+ return ("convert<$nativeType>(*state, $value, $allowNonFinite)", 1);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return ("valueToDate(state, $value)", 1) if $type eq "Date";
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -455,7 +455,7 @@
</span><span class="cx"> template<> TestObj::Dictionary convert<TestObj::Dictionary>(ExecState& state, JSValue value)
</span><span class="cx"> {
</span><span class="cx"> if (value.isUndefinedOrNull())
</span><del>- return { { }, TestObj::EnumType::EnumValue1, TestObj::EnumType::EmptyString, "defaultString", { }, false, { }, { } };
</del><ins>+ return { { }, TestObj::EnumType::EnumValue1, TestObj::EnumType::EmptyString, "defaultString", { }, false, { }, { }, { }, { }, 0, 0, { }, { }, 0, 0 };
</ins><span class="cx"> auto* object = value.getObject();
</span><span class="cx"> if (UNLIKELY(!object || object->type() == RegExpObjectType)) {
</span><span class="cx"> throwTypeError(&state);
</span><span class="lines">@@ -483,7 +483,31 @@
</span><span class="cx"> if (UNLIKELY(state.hadException()))
</span><span class="cx"> return { };
</span><span class="cx"> auto sequenceOfStrings = convertOptional<Vector<String>>(state, object->get(&state, Identifier::fromString(&state, "sequenceOfStrings")));
</span><del>- return { WTFMove(enumerationValueWithoutDefault), WTFMove(enumerationValueWithDefault), WTFMove(enumerationValueWithEmptyStringDefault), WTFMove(stringWithDefault), WTFMove(stringWithoutDefault), WTFMove(booleanWithDefault), WTFMove(booleanWithoutDefault), WTFMove(sequenceOfStrings) };
</del><ins>+ if (UNLIKELY(state.hadException()))
+ return { };
+ auto restrictedDouble = convertOptional<double>(state, object->get(&state, Identifier::fromString(&state, "restrictedDouble")), ShouldAllowNonFinite::No);
+ if (UNLIKELY(state.hadException()))
+ return { };
+ auto unrestrictedDouble = convertOptional<double>(state, object->get(&state, Identifier::fromString(&state, "unrestrictedDouble")), ShouldAllowNonFinite::Yes);
+ if (UNLIKELY(state.hadException()))
+ return { };
+ auto restrictedDoubleWithDefault = convertOptional<double>(state, object->get(&state, Identifier::fromString(&state, "restrictedDoubleWithDefault")), ShouldAllowNonFinite::No, 0);
+ if (UNLIKELY(state.hadException()))
+ return { };
+ auto unrestrictedDoubleWithDefault = convertOptional<double>(state, object->get(&state, Identifier::fromString(&state, "unrestrictedDoubleWithDefault")), ShouldAllowNonFinite::Yes, 0);
+ if (UNLIKELY(state.hadException()))
+ return { };
+ auto restrictedFloat = convertOptional<float>(state, object->get(&state, Identifier::fromString(&state, "restrictedFloat")), ShouldAllowNonFinite::No);
+ if (UNLIKELY(state.hadException()))
+ return { };
+ auto unrestrictedFloat = convertOptional<float>(state, object->get(&state, Identifier::fromString(&state, "unrestrictedFloat")), ShouldAllowNonFinite::Yes);
+ if (UNLIKELY(state.hadException()))
+ return { };
+ auto restrictedFloatWithDefault = convertOptional<float>(state, object->get(&state, Identifier::fromString(&state, "restrictedFloatWithDefault")), ShouldAllowNonFinite::No, 0);
+ if (UNLIKELY(state.hadException()))
+ return { };
+ auto unrestrictedFloatWithDefault = convertOptional<float>(state, object->get(&state, Identifier::fromString(&state, "unrestrictedFloatWithDefault")), ShouldAllowNonFinite::Yes, 0);
+ return { WTFMove(enumerationValueWithoutDefault), WTFMove(enumerationValueWithDefault), WTFMove(enumerationValueWithEmptyStringDefault), WTFMove(stringWithDefault), WTFMove(stringWithoutDefault), WTFMove(booleanWithDefault), WTFMove(booleanWithoutDefault), WTFMove(sequenceOfStrings), WTFMove(restrictedDouble), WTFMove(unrestrictedDouble), WTFMove(restrictedDoubleWithDefault), WTFMove(unrestrictedDoubleWithDefault), WTFMove(restrictedFloat), WTFMove(unrestrictedFloat), WTFMove(restrictedFloatWithDefault), WTFMove(unrestrictedFloatWithDefault) };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template<> TestObj::DictionaryThatShouldNotTolerateNull convert<TestObj::DictionaryThatShouldNotTolerateNull>(ExecState& state, JSValue value)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -391,6 +391,14 @@
</span><span class="cx"> boolean booleanWithDefault = false;
</span><span class="cx"> boolean booleanWithoutDefault;
</span><span class="cx"> sequence<DOMString> sequenceOfStrings;
</span><ins>+ double restrictedDouble;
+ unrestricted double unrestrictedDouble;
+ double restrictedDoubleWithDefault = 0;
+ unrestricted double unrestrictedDoubleWithDefault = 0;
+ float restrictedFloat;
+ unrestricted float unrestrictedFloat;
+ float restrictedFloatWithDefault = 0;
+ unrestricted float unrestrictedFloatWithDefault = 0;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> dictionary TestDictionaryThatShouldNotTolerateNull {
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -1493,8 +1493,13 @@
</span><span class="cx"> return page->deviceScaleFactor();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void DOMWindow::scrollBy(int x, int y) const
</del><ins>+void DOMWindow::scrollBy(const ScrollToOptions& options) const
</ins><span class="cx"> {
</span><ins>+ return scrollBy(options.left.valueOr(0), options.top.valueOr(0));
+}
+
+void DOMWindow::scrollBy(double x, double y) const
+{
</ins><span class="cx"> if (!isCurrentlyDisplayedInFrame())
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -1504,12 +1509,27 @@
</span><span class="cx"> if (!view)
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ // Normalize non-finite values (https://drafts.csswg.org/cssom-view/#normalize-non-finite-values).
+ x = std::isfinite(x) ? x : 0;
+ y = std::isfinite(y) ? y : 0;
+
</ins><span class="cx"> IntSize scaledOffset(view->mapFromCSSToLayoutUnits(x), view->mapFromCSSToLayoutUnits(y));
</span><span class="cx"> view->setContentsScrollPosition(view->contentsScrollPosition() + scaledOffset);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void DOMWindow::scrollTo(int x, int y) const
</del><ins>+void DOMWindow::scrollTo(const ScrollToOptions& options) const
</ins><span class="cx"> {
</span><ins>+ RefPtr<FrameView> view = m_frame->view();
+ if (!view)
+ return;
+
+ double x = options.left ? options.left.value() : view->contentsScrollPosition().x();
+ double y = options.top ? options.top.value() : view->contentsScrollPosition().y();
+ return scrollTo(x, y);
+}
+
+void DOMWindow::scrollTo(double x, double y) const
+{
</ins><span class="cx"> if (!isCurrentlyDisplayedInFrame())
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -1517,6 +1537,10 @@
</span><span class="cx"> if (!view)
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ // Normalize non-finite values (https://drafts.csswg.org/cssom-view/#normalize-non-finite-values).
+ x = std::isfinite(x) ? x : 0;
+ y = std::isfinite(y) ? y : 0;
+
</ins><span class="cx"> if (!x && !y && view->contentsScrollPosition() == IntPoint(0, 0))
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.h (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.h        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/Source/WebCore/page/DOMWindow.h        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -248,10 +248,16 @@
</span><span class="cx"> void postMessageTimerFired(PostMessageTimer&);
</span><span class="cx"> void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event&, PassRefPtr<Inspector::ScriptCallStack>);
</span><span class="cx">
</span><del>- void scrollBy(int x, int y) const;
- void scrollTo(int x, int y) const;
- void scroll(int x, int y) const { scrollTo(x, y); }
</del><ins>+ struct ScrollToOptions {
+ Optional<double> left;
+ Optional<double> top;
+ };
</ins><span class="cx">
</span><ins>+ void scrollBy(const ScrollToOptions&) const;
+ void scrollBy(double x, double y) const;
+ void scrollTo(const ScrollToOptions&) const;
+ void scrollTo(double x, double y) const;
+
</ins><span class="cx"> void moveBy(float x, float y) const;
</span><span class="cx"> void moveTo(float x, float y) const;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.idl (200906 => 200907)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.idl        2016-05-14 02:03:10 UTC (rev 200906)
+++ trunk/Source/WebCore/page/DOMWindow.idl        2016-05-14 02:10:27 UTC (rev 200907)
</span><span class="lines">@@ -102,9 +102,16 @@
</span><span class="cx"> readonly attribute long pageXOffset;
</span><span class="cx"> readonly attribute long pageYOffset;
</span><span class="cx">
</span><del>- 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);
</del><ins>+ void scrollBy(unrestricted double x, unrestricted double y);
+ void scrollTo(unrestricted double x, unrestricted double y);
+ [ImplementedAs=scrollTo] void scroll(unrestricted double x, unrestricted double y);
+
+#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
+ void scrollBy(optional ScrollToOptions option);
+ void scrollTo(optional ScrollToOptions options);
+ [ImplementedAs=scrollTo] void scroll(optional ScrollToOptions options);
+#endif
+
</ins><span class="cx"> void moveBy(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: this should take longs not floats.
</span><span class="cx"> void moveTo(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: this should take longs not floats.
</span><span class="cx"> void resizeBy(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: this should take longs not floats.
</span><span class="lines">@@ -217,6 +224,12 @@
</span><span class="cx"> [NotEnumerable, Conditional=PROXIMITY_EVENTS] attribute EventHandler onwebkitdeviceproximity;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+// FIXME: Support ScrollBehavior.
+dictionary ScrollToOptions {
+ unrestricted double left;
+ unrestricted double top;
+};
+
</ins><span class="cx"> DOMWindow implements GlobalEventHandlers;
</span><span class="cx"> DOMWindow implements WindowBase64;
</span><span class="cx"> DOMWindow implements WindowEventHandlers;
</span></span></pre>
</div>
</div>
</body>
</html>