Skip to content

Commit 48c88c2

Browse files
authored
[cssom-view] Move tokenizing of window.open's features arg to HTML
See whatwg/html#2476 Also change the behavior for left=foo to act as if left=0 to align with the behavior of at least WebKit and Chromium. Tests: web-platform-tests/wpt#5306 web-platform-tests/wpt#5390
1 parent 0a9e282 commit 48c88c2

File tree

2 files changed

+58
-50
lines changed

2 files changed

+58
-50
lines changed

cssom-view/Overview.bs

Lines changed: 57 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Status: ED
1313
Work Status: Revising
1414
Shortname: cssom-view
1515
Level: 1
16-
Editor: Simon Pieters, Opera Software ASA http://www.opera.com, simonp@opera.com
16+
Editor: Simon Pieters, Opera Software AS http://www.opera.com, simonp@opera.com
1717
Former Editor: Glenn Adams, Cox Communications, Inc. http://www.cox.com, glenn.adams@cos.com, http://www.w3.org/wiki/User:Gadams
1818
Former Editor: Anne van Kesteren, Opera Software ASA http://www.opera.com, annevk@annevk.nl, https://annevankesteren.nl/
1919
!Legacy issues list: <a href="https://www.w3.org/Bugs/Public/buglist.cgi?product=CSS&amp;component=CSSOM%20View&amp;resolution=---">Bugzilla</a>
@@ -377,6 +377,9 @@ The <dfn export>Web-exposed available screen area</dfn> is one of the following:
377377
Common Infrastructure {#common-infrastructure}
378378
==============================================
379379

380+
This specification depends on the WHATWG Infra standard. [[!INFRA]]
381+
382+
380383
Scrolling {#scrolling}
381384
----------------------
382385

@@ -655,56 +658,61 @@ The <dfn attribute for=Window>devicePixelRatio</dfn> attribute must return the r
655658
1. Return the result of dividing <var>CSS pixel size</var> by <var>device pixel size</var>.
656659

657660

658-
The <var>features</var> argument to the {{Window/open()}} method {#the-features-argument-to-the-open()-method}
661+
The <var ignore>features</var> argument to the {{Window/open()}} method {#the-features-argument-to-the-open()-method}
659662
--------------------------------------------------------------------------------------------------------------
660663

661-
HTML defines the {{Window/open()}} method but has no defined effect for the third argument, <var>features</var>.
662-
[[!HTML]]
663-
664-
This specification defines the effect of the <var>features</var> argument for user agents that do not opt to ignore it, as follows:
665-
666-
1. If the method does not result in a new <a>auxiliary browsing context</a> being created, terminate these steps.
667-
1. Let <var>target</var> be the new <a>auxiliary browsing context</a>.
668-
1. Let <var>tokens</var> be the result of <a lt="split a string on commas">splitting <var>features</var> on commas</a>.
669-
1. Let <var>parsed features</var> be a new empty dictionary.
670-
1. <i>Token loop</i>: For each token <var>token</var> in <var>tokens</var>, follow these substeps:
671-
1. Let <var>input</var> be <var>token</var>.
672-
1. Let <var>position</var> point at the first character of <var>input</var>.
673-
1. <a>Skip whitespace</a>.
674-
1. <a>Collect a sequence of characters</a> that are not <a>space characters</a> nor "<code>=</code>" (U+003D).
675-
Let <var>name</var> be the collected characters, <a>converted to ASCII lowercase</a>.
676-
1. If <var>name</var> is in <var>parsed features</var> or if <var>name</var> is not a <a>supported <code>open()</code> feature name</a>,
677-
continue <i>token loop</i>.
678-
1. <a>Skip whitespace</a>.
679-
1. If the character at <var>position</var> is not "<code>=</code>" (U+003D), continue <i>token loop</i>.
680-
1. Advance <var>position</var> by one.
681-
1. If <var>position</var> is past the end of <var>input</var>, continue <i>token loop</i>.
682-
1. <a>Collect a sequence of characters</a> that are any characters. Let <var>raw value</var> be the collected characters.
683-
1. Let <var>value</var> be the result of invoking the <a>rules for parsing integers</a> on <var>raw value</var>.
684-
1. If <var>value</var> is an error, continue <i>token loop</i>.
685-
1. Set <var>name</var> in <var>parsed features</var> to <var>value</var>.
686-
1. If <a for="supported open() feature name">left</a> is present in <var>parsed features</var>, follow these substeps:
687-
1. Let <var>x</var> be the value of <a for="supported open() feature name">left</a>.
688-
1. Optionally, clamp <var>x</var> in a user-agent-defined manner so that the window does not move outside the available space.
689-
1. Optionally, move <var>target</var>'s window such that the window's left edge is at the horizontal coordinate <var>x</var> relative to the left edge of
690-
the output device, measured in CSS pixels of <var>target</var>. The positive axis is rightward.
691-
1. If <a for="supported open() feature name">top</a> is present in <var>parsed features</var>, follow these substeps:
692-
1. Let <var>y</var> be the value of <a for="supported open() feature name">top</a>.
693-
1. Optionally, clamp <var>y</var> in a user-agent-defined manner so that the window does not move outside the available space.
694-
1. Optionally, move <var>target</var>'s window such that the window's top edge is at the vertical coordinate <var>y</var> relative to the top edge of
695-
the output device, measured in CSS pixels of <var>target</var>. The positive axis is downward.
696-
1. If <a for="supported open() feature name">width</a> is present in <var>parsed features</var>, follow these substeps:
697-
1. Let <var>x</var> be the value of <a for="supported open() feature name">width</a>.
698-
1. Optionally, clamp <var>x</var> in a user-agent-defined manner so that the window does not get too small or bigger than the available space.
699-
1. Optionally, size <var>target</var>'s window by moving its right edge such that the distance between the left and right edges of the viewport are
700-
<var>x</var> CSS pixels of <var>target</var>.
701-
1. Optionally, move <var>target</var>'s window in a user-agent-defined manner so that it does not grow outside the available space.
702-
1. If <a for="supported open() feature name">height</a> is present in <var>parsed features</var>, follow these substeps:
703-
1. Let <var>y</var> be the value of <a for="supported open() feature name">height</a>.
704-
1. Optionally, clamp <var>y</var> in a user-agent-defined manner so that the window does not get too small or bigger than the available space.
705-
1. Optionally, size <var>target</var>'s window by moving its bottom edge such that the distance between the top and bottom edges of the viewport are
706-
<var>y</var> CSS pixels of <var>target</var>.
707-
1. Optionally, move <var>target</var>'s window in a user-agent-defined manner so that it does not grow outside the available space.
664+
HTML defines the {{Window/open()}} method. This section defines behavior for position and size given
665+
in the <var ignore>features</var> argument. [[!HTML]]
666+
667+
To <dfn export>set up browsing context features</dfn> for a browsing context <var>target</var> given a
668+
<a>map</a> <var>tokenizedFeatures</var>:
669+
670+
1. Let <var>x</var> be null.
671+
1. Let <var>y</var> be null.
672+
1. If <var>tokenizedFeatures</var>["<a for="supported open() feature name">left</a>"]
673+
<a for=map>exists</a>:
674+
1. Set <var>x</var> to the result of invoking the <a>rules for parsing integers</a> on
675+
<var>tokenizedFeatures</var>["<a for="supported open() feature name">left</a>"].
676+
1. If <var>x</var> is an error, set <var>x</var> to 0.
677+
1. Optionally, clamp <var>x</var> in a user-agent-defined manner so that the window does not
678+
move outside the available space.
679+
1. Optionally, move <var>target</var>'s window such that the window's left edge is at the
680+
horizontal coordinate <var>x</var> relative to the left edge of the output device, measured
681+
in CSS pixels of <var>target</var>. The positive axis is rightward.
682+
1. If <var>tokenizedFeatures</var>["<a for="supported open() feature name">top</a>"]
683+
<a for=map>exists</a>:
684+
1. Set <var>y</var> to the result of invoking the <a>rules for parsing integers</a> on
685+
<var>tokenizedFeatures</var>["<a for="supported open() feature name">top</a>"].
686+
1. If <var>y</var> is an error, set <var>y</var> to 0.
687+
1. Optionally, clamp <var>y</var> in a user-agent-defined manner so that the window does not
688+
move outside the available space.
689+
1. Optionally, move <var>target</var>'s window such that the window's top edge is at the
690+
vertical coordinate <var>y</var> relative to the top edge of the output device, measured in
691+
CSS pixels of <var>target</var>. The positive axis is downward.
692+
1. If <var>tokenizedFeatures</var>["<a for="supported open() feature name">width</a>"]
693+
<a for=map>exists</a>:
694+
1. Set <var>x</var> to the result of invoking the <a>rules for parsing integers</a> on
695+
<var>tokenizedFeatures</var>["<a for="supported open() feature name">width</a>"].
696+
1. If <var>x</var> is an error, set <var>x</var> to 0.
697+
1. Optionally, clamp <var>x</var> in a user-agent-defined manner so that the window does not get
698+
too small or bigger than the available space.
699+
1. Optionally, size <var>target</var>'s window by moving its right edge such that the distance
700+
between the left and right edges of the viewport are <var>x</var> CSS pixels of
701+
<var>target</var>.
702+
1. Optionally, move <var>target</var>'s window in a user-agent-defined manner so that it does
703+
not grow outside the available space.
704+
1. If <var>tokenizedFeatures</var>["<a for="supported open() feature name">height</a>"]
705+
<a for=map>exists</a>:
706+
1. Set <var>y</var> to the result of invoking the <a>rules for parsing integers</a> on
707+
<var>tokenizedFeatures</var>["<a for="supported open() feature name">height</a>"].
708+
1. If <var>y</var> is an error, set <var>y</var> to 0.
709+
1. Optionally, clamp <var>y</var> in a user-agent-defined manner so that the window does not get
710+
too small or bigger than the available space.
711+
1. Optionally, size <var>target</var>'s window by moving its bottom edge such that the distance
712+
between the top and bottom edges of the viewport are <var>y</var> CSS pixels of
713+
<var>target</var>.
714+
1. Optionally, move <var>target</var>'s window in a user-agent-defined manner so that it does
715+
not grow outside the available space.
708716

709717
A <dfn export>supported <code>open()</code> feature name</dfn> is one of the following:
710718

cssom/Overview.bs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Status: ED
1111
Work Status: Exploring
1212
Shortname: cssom
1313
Level: 1
14-
Editor: Simon Pieters, Opera Software ASA http://www.opera.com, simonp@opera.com
14+
Editor: Simon Pieters, Opera Software AS http://www.opera.com, simonp@opera.com
1515
Editor: Daniel Glazman, Disruptive Innovations http://disruptive-innovations.com/, daniel.glazman@disruptive-innovations.com
1616
Former Editor: Glenn Adams, Cox Communications&#44; Inc. http://www.cox.com, glenn.adams@cos.com, http://www.w3.org/wiki/User:Gadams
1717
Former Editor: Anne van Kesteren, Opera Software ASA http://www.opera.com, annevk@annevk.nl, https://annevankesteren.nl/

0 commit comments

Comments
 (0)