Skip to content

Commit bb939cc

Browse files
committed
Allow ignoring position or dimensions in set window rect
Previously it was unclear if it was acceptable to return without error from set window rect if the implementation is unable to set some of the properties. This updates the spec so that: * It's unambiguously OK to run the command even if you don't support some aspects of the functionality on the current platform / configuration (you are expected to continue to return an error if you don't support any aspect of the functionality). * It's clear that both position and dimension properties are best effort, and even if you are able to adjust them there's no guarantee that you get the exact requested values. * It's clear what to do if you get just an x coordinate but not y, or just width but not height, or vice-versa. Previously this was undefined.
1 parent af51973 commit bb939cc

File tree

1 file changed

+50
-41
lines changed

1 file changed

+50
-41
lines changed

index.html

Lines changed: 50 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4044,25 +4044,23 @@

Set Window Rect

40444044
<ol>
40454045
<li><p>Let <var>widthvar> be the result of
40464046
<a>getting a propertya> named "<code>widthcode>"
4047-
from <var>parametersvar>, else let it be <a><code>nullcode>a>.
4047+
from <var>parametersvar>a>.
40484048

40494049
<li><p>Let <var>heightvar> be the result of
40504050
<a>getting a propertya> named "<code>heightcode>"
4051-
from <var>parametersvar>, else let it be <a><code>nullcode>a>.
4051+
from <var>parametersvar>.
40524052

40534053
<li><p>Let <var>xvar> be the result of <a>getting a propertya>
4054-
named "<code>xcode>" from <var>parametersvar>,
4055-
else let it be <a><code>nullcode>a>.
4054+
named "<code>xcode>" from <var>parametersvar>.
40564055

40574056
<li><p>Let <var>yvar> be the result of <a>getting a propertya>
4058-
named "<code>ycode>" from <var>parametersvar>,
4059-
else let it be <a><code>nullcode>a>.
4057+
named "<code>ycode>" from <var>parametersvar>.
40604058

4061-
<li><p>If <var>widthvar> or <var>heightvar> is neither <a><code>nullcode>a>
4059+
<li><p>If <var>widthvar> or <var>heightvar> is neither <a>undefineda>
40624060
nor a <a>Numbera> from 0 to 2<sup>31sup> − 1,
40634061
return <a>errora> with <a>error codea> <a>invalid argumenta>.
40644062

4065-
<li><p>If <var>xvar> or <var>yvar> is neither <a><code>nullcode>a>
4063+
<li><p>If <var>xvar> or <var>yvar> is neither <a>undefineda>
40664064
nor a <a>Numbera> from −(2<sup>31sup>) to 2<sup>31sup> − 1,
40674065
return <a>errora> with <a>error codea> <a>invalid argumenta>.
40684066

@@ -4071,6 +4069,11 @@

Set Window Rect

40714069
<var>sessionvar>'s <a>current top-level browsing contexta> for any reason,
40724070
return <a>errora> with <a>error codea> <a>unsupported operationa>.
40734071

4072+
<p class="note">In case the <a>Set Window Recta> command is
4073+
partially supported (i.e. some combinations of arguments are
4074+
supported but not others), the implmentation is expected to continue
4075+
with the remaining steps.
4076+
40744077
<li><p>If <var>sessionvar>'s <a>current top-level browsing
40754078
contexta> is <a>no longer opena>, return <a>errora>
40764079
with <a>error codea> <a>no such windowa>.
@@ -4082,21 +4085,25 @@

Set Window Rect

40824085

40834086
<li><p><a>Restore the windowa>.
40844087

4085-
<li><p>If <var>widthvar> and <var>heightvar> are not <a><code>nullcode>a>:
4088+
<li><p>Let <var>windowvar> be the operating system window containing
4089+
<var>sessionvar>'s <a>current top-level browsing contexta>
4090+
4091+
<li><p>If the implementation is able to set the dimensions
4092+
of <var>windowvar>:
40864093

40874094
<ol>
4088-
<li><p>Set the width, in <a>CSS pixelsa>,
4089-
of the operating system window containing
4090-
<var>sessionvar>'s <a>current top-level browsing contexta>,
4091-
including any <a>browser chromea> and externally drawn window decorations
4095+
<li><p>If <var>widthvar> is not <a>undefineda>, set the width,
4096+
in <a>CSS pixelsa>, of <var>windowvar>, including
4097+
any <a>browser chromea> and externally drawn window decorations,
40924098
to a value that is as close as possible to <var>widthvar>.
40934099

4094-
<li><p>Set the height, in <a>CSS pixelsa>,
4095-
of the operating system window containing
4096-
<var>sessionvar>'s <a>current top-level browsing contexta>,
4097-
including any <a>browser chromea> and externally drawn window decorations
4100+
<li><p>If <var>heightvar> is not <a>undefineda>, set the height,
4101+
in <a>CSS pixelsa>, of <var>windowvar>, including
4102+
any <a>browser chromea> and externally drawn window decorations,
40984103
to a value that is as close as possible to <var>heightvar>.
40994104

4105+
ol>
4106+
41004107
<aside class=note>
41014108
<p>The specification does not guarantee
41024109
that the resulting window size will exactly match that which was requested.
@@ -4116,35 +4123,37 @@

Set Window Rect

41164123
of <a>outerHeighta> should be as close as possible
41174124
to <var>heightvar>.
41184125
aside>
4119-
ol>
41204126

4121-
<li><p>If <var>xvar> and <var>yvar> are not <a><code>nullcode>a>:
4127+
<li><p>If the implementation is able to set the position of <var>windowvar>:
41224128

41234129
<ol>
4124-
<li><p>Run the implementation-specific steps to set the position of
4125-
the operating system level window
4126-
containing <var>sessionvar>'s <a>current top-level browsing
4127-
contexta> to the position given by the <var>xvar>
4128-
and <var>yvar> coordinates.
4129-
4130-
<aside class=note>
4131-
<p>Note that this step is similar to calling the <a>moveTo(x,
4132-
y)a> method on the <a><code>WindowProxycode>a> object
4133-
associated with <var>sessionvar>'s <a>current top-level browsing
4134-
contexta>, but without the
4135-
<a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/moveTo>security
4136-
restrictionsa> that you
4137-
4138-
<ol type=a>
4139-
<li>cannot move a window or tab
4140-
that was not created by <code>window.opencode>.
4141-
4142-
<li>cannot move a window or tab
4143-
when it is in a window with more than one tab.
4144-
ol>
4145-
aside>
4130+
<li><p>If <var>xvar> is not <a>undefineda>, run specific
4131+
steps set the x-coordinate of the left edge of <var>windowvar>
4132+
to a value that is as close as possible to <var>xvar>.
4133+
4134+
<li><p>If <var>yvar> is not <a>undefineda>, run specific
4135+
steps set the y-coordinate of the top edge of <var>windowvar> to
4136+
a value that is as close as possible to <var>yvar>.
41464137
ol>
41474138

4139+
<aside class=note>
4140+
<p>The specification does not guarantee
4141+
that the resulting window position will match that which was requested.
4142+
4143+
<p>This step is similar to calling the <a>moveTo(x,
4144+
y)a> method on the <a><code>WindowProxycode>a> object
4145+
associated with <var>sessionvar>'s <a>current top-level browsing
4146+
contexta>, but without the
4147+
<a href=https://developer.mozilla.org/en-US/docs/Web/API/Window/moveTo>security
4148+
restrictionsa> that you
4149+
4150+
<ol type=a>
4151+
<li>cannot move a window or tab that was not created by <code>window.opencode>.
4152+
4153+
<li>cannot move a window or tab when it is in a window with more than one tab.
4154+
ol>
4155+
aside>
4156+
41484157
<li><p>Return <a>successa> with data set to the <a>WindowRect
41494158
objecta> for the <var>sessionvar>'s <a>current top-level browsing
41504159
contexta>.

0 commit comments

Comments
 (0)