You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]>
@@ -1322,7 +1329,7 @@ it is observed via WebDriver, so we avoid using this terminology.
1322
1329
A [=user context=] has a <dfn export for="user context">user context id</dfn>,
1323
1330
which is a unique string set upon the user context creation.
1324
1331
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
1326
1333
context=].
1327
1334
1328
1335
When a new [=/top-level traversable=] is created its [=associated user context=]
@@ -2274,6 +2281,9 @@ BrowsingContextEvent = (
2274
2281
)
2275
2282
</pre>
2276
2283
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
+
2277
2287
### Types ### {#module-browsingcontext-types}
2278
2288
2279
2289
#### The browsingContext.BrowsingContext Type #### {#type-browsingContext-Browsingcontext}
@@ -3927,19 +3937,42 @@ The [=remote end steps=] with |command parameters| are:
3927
3937
1. Otherwise, set the |context|'s [=layout viewport=] to the
3928
3938
implementation-defined default.
3929
3939
3940
+
1. Run the [[cssom-view-1#resizing-viewports]] steps.
3941
+
3930
3942
1. If |command parameters| [=map/contains=] the <code>devicePixelRatio</code> field:
3931
3943
3932
3944
1. Let |device pixel ratio| be the |command
3933
3945
parameters|["<code>devicePixelRatio</code>"].
3934
3946
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=]:
3938
3948
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=].
3941
3951
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|.
3943
3976
3944
3977
1. Return [=success=] with data null.
3945
3978
@@ -10665,3 +10698,12 @@ Other specifications can define <dfn>console steps</dfn>.
10665
10698
arguments |name|, |printerArgs| and |options| (which is undefined if the
10666
10699
argument is not provided), call any [=console steps=] defined in
10667
10700
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