Skip to content

Commit 9075850

Browse files
author
Simon Pieters
committed
[cssom-view] Make scroll/scrollTo/scrollBy take the dictionary as first argument.
1 parent 7fc9704 commit 9075850

2 files changed

Lines changed: 62 additions & 14 deletions

File tree

cssom-view/Overview.html

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,16 @@ <h2 id="extensions-to-the-window-interface"><span class="secno">5 </span>Extensi
527527
dictionary <dfn id="scrolloptions">ScrollOptions</dfn> {
528528
<a href="#scrollbehavior">ScrollBehavior</a> behavior = "auto";
529529
};
530+
dictionary <dfn id="scrolltooptions">ScrollToOptions</dfn> : <a href="#scrolloptions">ScrollOptions</a> {
531+
double left;
532+
double top;<!--
533+
double right;
534+
double bottom;
535+
double blockStart;
536+
double blockEnd;
537+
double inlineStart;
538+
double inlineEnd;-->
539+
};
530540

531541
partial interface <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#window">Window</a> {
532542
<a href="#mediaquerylist">MediaQueryList</a> <a href="#dom-window-matchmedia" title="dom-Window-matchMedia">matchMedia</a>(DOMString query);
@@ -547,9 +557,12 @@ <h2 id="extensions-to-the-window-interface"><span class="secno">5 </span>Extensi
547557
readonly attribute double <a href="#dom-window-pagexoffset" title="dom-Window-pageXOffset">pageXOffset</a>;
548558
readonly attribute double <a href="#dom-window-scrolly" title="dom-Window-scrollY">scrollY</a>;
549559
readonly attribute double <a href="#dom-window-pageyoffset" title="dom-Window-pageYOffset">pageYOffset</a>;
550-
void <a href="#dom-window-scroll" title="dom-Window-scroll">scroll</a>(unrestricted double x, unrestricted double y, optional <a href="#scrolloptions">ScrollOptions</a> options);
551-
void <a href="#dom-window-scrollto" title="dom-Window-scrollTo">scrollTo</a>(unrestricted double x, unrestricted double y, optional <a href="#scrolloptions">ScrollOptions</a> options);
552-
void <a href="#dom-window-scrollby" title="dom-Window-scrollBy">scrollBy</a>(unrestricted double x, unrestricted double y, optional <a href="#scrolloptions">ScrollOptions</a> options);
560+
void <a href="#dom-window-scroll" title="dom-Window-scroll">scroll</a>(optional <a href="#scrolltooptions">ScrollToOptions</a> options);
561+
void <a href="#dom-window-scroll" title="dom-Window-scroll">scroll</a>(unrestricted double x, unrestricted double y);
562+
void <a href="#dom-window-scrollto" title="dom-Window-scrollTo">scrollTo</a>(optional <a href="#scrolltooptions">ScrollToOptions</a> options);
563+
void <a href="#dom-window-scrollto" title="dom-Window-scrollTo">scrollTo</a>(unrestricted double x, unrestricted double y);
564+
void <a href="#dom-window-scrollby" title="dom-Window-scrollBy">scrollBy</a>(optional <a href="#scrolltooptions">ScrollToOptions</a> options);
565+
void <a href="#dom-window-scrollby" title="dom-Window-scrollBy">scrollBy</a>(unrestricted double x, unrestricted double y);
553566

554567
// client
555568
readonly attribute double <a href="#dom-window-screenx" title="dom-Window-screenX">screenX</a>;
@@ -671,10 +684,21 @@ <h2 id="extensions-to-the-window-interface"><span class="secno">5 </span>Extensi
671684
<p>The <dfn id="dom-window-pageyoffset" title="dom-Window-pageYOffset"><code>pageYOffset</code></dfn> attribute must return the value returned by the
672685
<code title="dom-Window-scrollY"><a href="#dom-window-scrolly">scrollY</a></code> attribute.</p>
673686

674-
<p>When the <dfn id="dom-window-scroll" title="dom-Window-scroll"><code>scroll(<var>x</var>, <var>y</var>, <var>options</var>)</code></dfn> method is invoked these
687+
<p>When the <dfn id="dom-window-scroll" title="dom-Window-scroll"><code>scroll()</code></dfn> method is invoked these
675688
steps must be run:</p>
676689
<ol>
677-
<li><p><a href="#normalize-non-finite-values">Normalize non-finite values</a> for <var>x</var> and <var>y</var>.
690+
<li><p>If invoked with one argument, follow these substeps:
691+
<ol>
692+
<li><p>Let <var>options</var> be the argument.
693+
<li><p>Let <var>x</var> be the value of the <code title="">left</code> dictionary member of <var>options</var>, if present, or the <a href="#viewport">viewport</a>'s current scroll position on the x axis otherwise.
694+
<li><p>Let <var>y</var> be the value of the <code title="">top</code> dictionary member of <var>options</var>, if present, or the <a href="#viewport">viewport</a>'s current scroll position on the y axis otherwise.
695+
</ol>
696+
<li><p>If invoked with two arguments, follow these substeps:
697+
<ol>
698+
<li><p>Let <var>options</var> be null <a href="#converted-to-an-idl-value" title="converted to an IDL value">converted</a> to a <code><a href="#scrolltooptions">ScrollToOptions</a></code> dictionary. <a href="#refsWEBIDL">[WEBIDL]</a>
699+
<li><p>Let <var>x</var> and <var>y</var> be the arguments, respectively.
700+
<li><p><a href="#normalize-non-finite-values">Normalize non-finite values</a> for <var>x</var> and <var>y</var>.
701+
</ol>
678702
<li><p>If there is no <a href="#viewport">viewport</a>, abort these steps.
679703
<li><p>Let <var>viewport width</var> be the width of the <a href="#viewport">viewport</a> excluding the width of the scroll bar, if any.
680704
<li><p>Let <var>viewport height</var> be the height of the <a href="#viewport">viewport</a> excluding the height of the scroll bar, if any.
@@ -713,10 +737,10 @@ <h2 id="extensions-to-the-window-interface"><span class="secno">5 </span>Extensi
713737
value of the <code title="">behavior</code> dictionary member of <var>options</var>.
714738
</ol>
715739

716-
<p>When the <dfn id="dom-window-scrollto" title="dom-Window-scrollTo"><code>scrollTo(<var>x</var>, <var>y</var>, <var>options</var>)</code></dfn> method is invoked, the
740+
<p>When the <dfn id="dom-window-scrollto" title="dom-Window-scrollTo"><code>scrollTo()</code></dfn> method is invoked, the
717741
user agent must act as if the <code title="dom-Window-scroll"><a href="#dom-window-scroll">scroll()</a></code> method was invoked with the same arguments.</p>
718742

719-
<p>When the <dfn id="dom-window-scrollby" title="dom-Window-scrollBy"><code>scrollBy(<var>x</var>, <var>y</var>, <var>options</var>)</code></dfn> method is invoked, the
743+
<p>When the <dfn id="dom-window-scrollby" title="dom-Window-scrollBy"><code>scrollBy()</code></dfn> method is invoked, the
720744
user agent must act as if the <code title="dom-Window-scroll"><a href="#dom-window-scroll">scroll()</a></code> method was invoked with
721745
<var>x</var> plus <code title="dom-Window-scrollX"><a href="#dom-window-scrollx">scrollX</a></code>
722746
as first argument and <var>y</var> plus

cssom-view/Overview.src.html

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,16 @@ <h2>Extensions to the <code title>Window</code> Interface</h2>
483483
dictionary <dfn>ScrollOptions</dfn> {
484484
<span>ScrollBehavior</span> behavior = "auto";
485485
};
486+
dictionary <dfn>ScrollToOptions</dfn> : <span>ScrollOptions</span> {
487+
double left;
488+
double top;<!--
489+
double right;
490+
double bottom;
491+
double blockStart;
492+
double blockEnd;
493+
double inlineStart;
494+
double inlineEnd;-->
495+
};
486496

487497
partial interface <span data-anolis-spec=html>Window</span> {
488498
<span>MediaQueryList</span> <span title=dom-Window-matchMedia>matchMedia</span>(DOMString query);
@@ -503,9 +513,12 @@ <h2>Extensions to the <code title>Window</code> Interface</h2>
503513
readonly attribute double <span title=dom-Window-pageXOffset>pageXOffset</span>;
504514
readonly attribute double <span title=dom-Window-scrollY>scrollY</span>;
505515
readonly attribute double <span title=dom-Window-pageYOffset>pageYOffset</span>;
506-
void <span title=dom-Window-scroll>scroll</span>(unrestricted double x, unrestricted double y, optional <span>ScrollOptions</span> options);
507-
void <span title=dom-Window-scrollTo>scrollTo</span>(unrestricted double x, unrestricted double y, optional <span>ScrollOptions</span> options);
508-
void <span title=dom-Window-scrollBy>scrollBy</span>(unrestricted double x, unrestricted double y, optional <span>ScrollOptions</span> options);
516+
void <span title=dom-Window-scroll>scroll</span>(optional <span>ScrollToOptions</span> options);
517+
void <span title=dom-Window-scroll>scroll</span>(unrestricted double x, unrestricted double y);
518+
void <span title=dom-Window-scrollTo>scrollTo</span>(optional <span>ScrollToOptions</span> options);
519+
void <span title=dom-Window-scrollTo>scrollTo</span>(unrestricted double x, unrestricted double y);
520+
void <span title=dom-Window-scrollBy>scrollBy</span>(optional <span>ScrollToOptions</span> options);
521+
void <span title=dom-Window-scrollBy>scrollBy</span>(unrestricted double x, unrestricted double y);
509522

510523
// client
511524
readonly attribute double <span title=dom-Window-screenX>screenX</span>;
@@ -627,10 +640,21 @@ <h2>Extensions to the <code title>Window</code> Interface</h2>
627640
<p>The <dfn title=dom-Window-pageYOffset><code>pageYOffset</code></dfn> attribute must return the value returned by the
628641
<code title=dom-Window-scrollY>scrollY</code> attribute.</p>
629642

630-
<p>When the <dfn title=dom-Window-scroll><code>scroll(<var>x</var>, <var>y</var>, <var>options</var>)</code></dfn> method is invoked these
643+
<p>When the <dfn title=dom-Window-scroll><code>scroll()</code></dfn> method is invoked these
631644
steps must be run:</p>
632645
<ol>
633-
<li><p><span>Normalize non-finite values</span> for <var>x</var> and <var>y</var>.
646+
<li><p>If invoked with one argument, follow these substeps:
647+
<ol>
648+
<li><p>Let <var>options</var> be the argument.
649+
<li><p>Let <var>x</var> be the value of the <code title>left</code> dictionary member of <var>options</var>, if present, or the <span>viewport</span>'s current scroll position on the x axis otherwise.
650+
<li><p>Let <var>y</var> be the value of the <code title>top</code> dictionary member of <var>options</var>, if present, or the <span>viewport</span>'s current scroll position on the y axis otherwise.
651+
</ol>
652+
<li><p>If invoked with two arguments, follow these substeps:
653+
<ol>
654+
<li><p>Let <var>options</var> be null <span title="converted to an IDL value">converted</span> to a <code>ScrollToOptions</code> dictionary. <span data-anolis-ref>WEBIDL</span>
655+
<li><p>Let <var>x</var> and <var>y</var> be the arguments, respectively.
656+
<li><p><span>Normalize non-finite values</span> for <var>x</var> and <var>y</var>.
657+
</ol>
634658
<li><p>If there is no <span>viewport</span>, abort these steps.
635659
<li><p>Let <var>viewport width</var> be the width of the <span>viewport</span> excluding the width of the scroll bar, if any.
636660
<li><p>Let <var>viewport height</var> be the height of the <span>viewport</span> excluding the height of the scroll bar, if any.
@@ -669,10 +693,10 @@ <h2>Extensions to the <code title>Window</code> Interface</h2>
669693
value of the <code title>behavior</code> dictionary member of <var>options</var>.
670694
</ol>
671695

672-
<p>When the <dfn title=dom-Window-scrollTo><code>scrollTo(<var>x</var>, <var>y</var>, <var>options</var>)</code></dfn> method is invoked, the
696+
<p>When the <dfn title=dom-Window-scrollTo><code>scrollTo()</code></dfn> method is invoked, the
673697
user agent must act as if the <code title=dom-Window-scroll>scroll()</code> method was invoked with the same arguments.</p>
674698

675-
<p>When the <dfn title=dom-Window-scrollBy><code>scrollBy(<var>x</var>, <var>y</var>, <var>options</var>)</code></dfn> method is invoked, the
699+
<p>When the <dfn title=dom-Window-scrollBy><code>scrollBy()</code></dfn> method is invoked, the
676700
user agent must act as if the <code title=dom-Window-scroll>scroll()</code> method was invoked with
677701
<var>x</var> plus <code title='dom-Window-scrollX'>scrollX</code>
678702
as first argument and <var>y</var> plus

0 commit comments

Comments
 (0)