Skip to content

Commit f3f93f5

Browse files
lutienjuliandescottesOrKoN
authored
Update handling of "devicePixelRatio" argument in "browsingContext.setViewport" command. (#693)
* Update handling of "devicePixelRatio" argument in "browsingContext.setViewport" command. * Update index.bs Co-authored-by: Julian Descottes <[email protected]> * Update index.bs Co-authored-by: Alex Rudenko <[email protected]> * Update index.bs Co-authored-by: Alex Rudenko <[email protected]> * Replace 'descendant traversables' with 'descendant navigables'. * Use a weak map to override 'determine the device pixel ratio' algorithm. * Add a note with the link to the spec override. * Move evaluation of media queries outside of condition branches. --------- Co-authored-by: Julian Descottes <[email protected]> Co-authored-by: Alex Rudenko <[email protected]>
1 parent b5167bb commit f3f93f5

File tree

1 file changed

+49
-7
lines changed

1 file changed

+49
-7
lines changed

index.bs

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
194194
text: create a new browsing context; url: browsers.html#creating-a-new-browsing-context
195195
text: default classic script fetch options; url: webappapis.html#default-classic-script-fetch-options
196196
text: default view; url: nav-history-apis.html#dom-document-defaultview
197+
text: descendant navigables; utl: document-sequences.html#descendant-navigables
197198
text: environment settings object's Realm; url: webappapis.html#environment-settings-object's-realm
198199
text: focused area of the document; url: document-sequences.html#focused-area-of-the-document
199200
text: getting all used history steps; url:browsing-the-web.html#getting-all-used-history-steps
@@ -202,6 +203,7 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
202203
text: history handling behavior; url: browsing-the-web.html#history-handling-behavior
203204
text: innerText getter steps; url:dom.html#dom-innertext
204205
text: input type; url: input.html#dom-input-type
206+
text: navigable; for:window; url: document-sequences.html#window-navigable
205207
text: navigables; url: document-sequences.html#navigables
206208
text: navigation id; url: browsing-the-web.html#navigation-id
207209
text: origin-clean; url: canvas.html#concept-canvas-origin-clean
@@ -212,6 +214,7 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/
212214
text: report an error; url: webappapis.html#report-the-error
213215
text: run the animation frame callbacks; url: imagebitmap-and-animations.html#run-the-animation-frame-callbacks
214216
text: same origin domain; url: browsers.html#same-origin-domain
217+
text: select an image source from a source set; url: images.html#select-an-image-source-from-a-source-set
215218
text: selected files; url: input.html#concept-input-type-file-selected
216219
text: session history entry; url: browsing-the-web.html#session-history-entry
217220
text: session history traversal queue; url: document-sequences.html#tn-session-history-traversal-queue
@@ -243,6 +246,7 @@ spec: CSS-VALUES-3; urlPrefix: https://drafts.csswg.org/css-values-3/
243246
spec: CSSOM-VIEW; urlPrefix: https://drafts.csswg.org/cssom-view/
244247
type: dfn
245248
text: CSS pixel; url: #dom-window-devicepixelratio
249+
text: evaluate media queries and report changes; url: #evaluate-media-queries-and-report-changes
246250
text: layout viewport; url: #layout-viewport
247251
text: scroll height; url: #dom-element-scrollheight
248252
text: scroll width; url: #dom-element-scrollwidth
@@ -275,6 +279,9 @@ spec: ACCNAME; urlPrefix:https://www.w3.org/TR/accname-1.2
275279
spec: CORE-AAM; urlPrefix:https://www.w3.org/TR/core-aam-1.2
276280
type: dfn
277281
text: computed role; url: /#roleMappingComputedRole
282+
spec: MEDIAQUERIES4; urlPrefix: https://drafts.csswg.org/mediaqueries-4/
283+
type: dfn
284+
text: resolution media feature; url: #resolution
278285
</pre>
279286

280287
<pre class="biblio">
@@ -1322,7 +1329,7 @@ it is observed via WebDriver, so we avoid using this terminology.
13221329
A [=user context=] has a <dfn export for="user context">user context id</dfn>,
13231330
which is a unique string set upon the user context creation.
13241331

1325-
A [=navigable=] has an <dfn export>associated user context</dfn>, which is a [=user
1332+
A [=/navigable=] has an <dfn export>associated user context</dfn>, which is a [=user
13261333
context=].
13271334

13281335
When a new [=/top-level traversable=] is created its [=associated user context=]
@@ -2274,6 +2281,9 @@ BrowsingContextEvent = (
22742281
)
22752282
</pre>
22762283

2284+
A [=remote end=] has a <dfn>device pixel ratio overrides</dfn> which is a weak map
2285+
between [=navigables=] and device pixel ratio overrides. It is initially empty.
2286+
22772287
### Types ### {#module-browsingcontext-types}
22782288

22792289
#### The browsingContext.BrowsingContext Type #### {#type-browsingContext-Browsingcontext}
@@ -3927,19 +3937,42 @@ The [=remote end steps=] with |command parameters| are:
39273937
1. Otherwise, set the |context|'s [=layout viewport=] to the
39283938
implementation-defined default.
39293939

3940+
1. Run the [[cssom-view-1#resizing-viewports]] steps.
3941+
39303942
1. If |command parameters| [=map/contains=] the <code>devicePixelRatio</code> field:
39313943

39323944
1. Let |device pixel ratio| be the |command
39333945
parameters|["<code>devicePixelRatio</code>"].
39343946

3935-
1. If |device pixel ratio| is not null, change the size of the [=CSS Pixel=]
3936-
in |context|'s [=layout viewport=] such that it corresponds to |device
3937-
pixel ratio| in device pixels.
3947+
1. For the |context| and all [=descendant navigables=]:
39383948

3939-
1. Otherwise, set the size of the [=CSS Pixel=] in |context|'s [=layout
3940-
viewport=] to the implementation-defined default.
3949+
1. Let |navigable| be the [=/navigable=] whose [=navigable/active document=] is
3950+
|context|'s [=browsing context/active document=].
39413951

3942-
1. Run the [[cssom-view-1#resizing-viewports]] steps.
3952+
1. If |device pixel ratio| is not null:
3953+
3954+
1. When the [=select an image source from a source set=] are run, act as if
3955+
the implementation's pixel density was set to |device pixel ratio| when selecting an image.
3956+
3957+
1. For the purposes of the [=resolution media feature=], act as if
3958+
the implementation's resolution is |device pixel ratio| dppx scaled by the page zoom.
3959+
3960+
1. [=map/Set=] [=device pixel ratio overrides=][|navigable|] to |device pixel ratio|.
3961+
3962+
Note: This will take an effect because of the patch of [[#patchs-determine-the-device-pixel-ratio]].
3963+
3964+
1. Otherwise:
3965+
3966+
1. When the [=select an image source from a source set=] steps are run, use the implementation's default behavior,
3967+
without any changes made by previous invocations of these steps.
3968+
3969+
1. For the purposes of the [=resolution media feature=], use the implementation's default behavior,
3970+
without any changes made by previous invocations of these steps.
3971+
3972+
1. [=map/Remove=] |navigable| from [=device pixel ratio overrides=].
3973+
3974+
1. Run [=evaluate media queries and report changes=] for [=document=] currently loaded
3975+
in a specified |context|.
39433976

39443977
1. Return [=success=] with data null.
39453978

@@ -10665,3 +10698,12 @@ Other specifications can define <dfn>console steps</dfn>.
1066510698
arguments |name|, |printerArgs| and |options| (which is undefined if the
1066610699
argument is not provided), call any [=console steps=] defined in
1066710700
external specification with arguments |name|, |printerArgs|, and |options|.
10701+
10702+
10703+
## CSS ## {#patchs-css}
10704+
10705+
### Determine the device pixel ratio ### {#patchs-determine-the-device-pixel-ratio}
10706+
10707+
Insert the following steps at the start of the [=determine the device pixel ratio=] algorithm:
10708+
10709+
1. If [=device pixel ratio overrides=] [=map/contains=] <var ignore>window</var>'s [=window/navigable=], return [=device pixel ratio overrides=][<var ignore>window</var>'s [=window/navigable=]].

0 commit comments

Comments
 (0)