Skip to content
Open
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
49c74f3
stored configuration
sadym-chromium Jan 20, 2026
f37f1ee
`emulation.setScrollbarTypeOverride`
sadym-chromium Jan 20, 2026
81ffe34
rename
sadym-chromium Jan 20, 2026
801a1bd
move setting to remote end
sadym-chromium Feb 5, 2026
43108d9
remove deprecated endpoint
sadym-chromium Feb 5, 2026
2b43d31
update scrollbar type override on new navigable
sadym-chromium Feb 5, 2026
df3cab1
Update index.bs
sadym-chromium Feb 9, 2026
3d59948
remote end configuration
sadym-chromium Feb 9, 2026
2aa7e4b
add a note
sadym-chromium Feb 9, 2026
b5d97cf
"stored remote end configuration"
sadym-chromium Feb 9, 2026
6301b81
"[=remote end configuration=]"
sadym-chromium Feb 9, 2026
8fbb426
docs: Clarify that scrollbar type override is applied for a specific …
sadym-chromium Feb 12, 2026
694e64b
`store remote end config`
sadym-chromium Feb 12, 2026
92b9183
whitespace
sadym-chromium Feb 12, 2026
97b36c3
`emulation.setMediaFeaturesOverride`
sadym-chromium Feb 16, 2026
27f8016
update types
sadym-chromium Feb 16, 2026
13da3aa
fixes
sadym-chromium Feb 16, 2026
2baf4d5
refactor
sadym-chromium Feb 17, 2026
3c71c7b
rename
sadym-chromium Feb 17, 2026
8b902f1
format
sadym-chromium Feb 17, 2026
efd4fdd
Update index.bs
sadym-chromium Feb 17, 2026
ecf7cbf
WebDriver configuration/unset
sadym-chromium Feb 17, 2026
0fb4a75
WebDriver configuration/store
sadym-chromium Feb 17, 2026
fe4e633
assert
sadym-chromium Feb 17, 2026
55325be
comment
sadym-chromium Feb 17, 2026
7a75b6d
note
sadym-chromium Feb 17, 2026
c373238
fix
sadym-chromium Feb 17, 2026
abb4e1a
fix
sadym-chromium Feb 17, 2026
45bb310
reorder
sadym-chromium Feb 17, 2026
6da5727
assert
sadym-chromium Feb 17, 2026
80f80bd
classic" / "overlay"
sadym-chromium Feb 17, 2026
555180b
fixes
sadym-chromium Feb 17, 2026
e10e4eb
omitted
sadym-chromium Feb 17, 2026
c6511ae
WebDriver configuration scoped to remote end
sadym-chromium Feb 17, 2026
03ab6df
remove export
sadym-chromium Feb 17, 2026
42ef86d
Revert "WebDriver configuration scoped to remote end"
sadym-chromium Feb 17, 2026
a2eba0f
updat
sadym-chromium Feb 17, 2026
4cb48eb
Merge branch 'main' into sadym/scrollbar-3
sadym-chromium Feb 17, 2026
6d0c419
Merge branch 'sadym/scrollbar-3' into sadym/emulation.setMediaFeature…
sadym-chromium Feb 17, 2026
21a5a68
Merge branch 'main' into sadym/emulation.setMediaFeaturesOverride
sadym-chromium Feb 19, 2026
a2a4053
fix merge
sadym-chromium Feb 19, 2026
fa4e3da
add css patch
sadym-chromium Feb 23, 2026
bdb0af4
fix build
sadym-chromium Feb 23, 2026
a4cba20
allow for setting and cleaning meadia features one-by-one.
sadym-chromium Feb 25, 2026
06de83e
Update index.bs
sadym-chromium Feb 25, 2026
312ce41
extend with https://drafts.csswg.org/mediaqueries-5/#valdef-media-poi…
sadym-chromium Mar 2, 2026
3a1ec08
"nav-controls": "none"
sadym-chromium Mar 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 161 additions & 1 deletion index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ spec: MEDIAQUERIES4; urlPrefix: https://drafts.csswg.org/mediaqueries-4/
type: dfn
text: resolution media feature; url: #resolution
text: media type; url: #media-type
text: media feature; url: #media-features
text: mf-name; url: #typedef-mf-name
spec: RFC9110; urlPrefix: https://httpwg.org/specs/rfc9110.html
type: dfn
text: field-name token; url: #fields.names
Expand Down Expand Up @@ -6113,6 +6115,7 @@ EmulationCommand = (
emulation.SetForcedColorsModeThemeOverride //
emulation.SetGeolocationOverride //
emulation.SetLocaleOverride //
emulation.SetMediaFeaturesOverride //
emulation.SetNetworkConditions //
emulation.SetScreenOrientationOverride //
emulation.SetScreenSettingsOverride //
Expand All @@ -6130,6 +6133,7 @@ EmulationResult = (
emulation.SetForcedColorsModeThemeOverrideResult /
emulation.SetGeolocationOverrideResult /
emulation.SetLocaleOverrideResult /
emulation.SetMediaFeaturesOverrideResult /
emulation.SetScreenOrientationOverrideResult /
emulation.SetScriptingEnabledResult /
emulation.SetScrollbarTypeOverrideResult /
Expand Down Expand Up @@ -6475,7 +6479,142 @@ The [=remote end steps=] with |command parameters| are:

</div>

#### The emulation.setNetworkConditions Command #### {#command-emulation-setNetworkConditions}
#### The emulation.setMediaFeaturesOverride Command #### {#command-emulation-setMediaFeaturesOverride}

The <dfn export for=commands>emulation.setMediaFeaturesOverride</dfn> command
allows overriding the values of various media features.

<dl>
<dt>Command Type</dt>
<dd>
<pre class="cddl" data-cddl-module="remote-cddl">
emulation.SetMediaFeaturesOverride = (
method: "emulation.setMediaFeaturesOverride",
params: emulation.SetMediaFeaturesOverrideParameters
)

emulation.SetMediaFeaturesOverrideParameters = {
features: emulation.MediaFeatures / null,
? contexts: [+browsingContext.BrowsingContext],
? userContexts: [+browser.UserContext],
}

emulation.MediaFeatures = {
Copy link
Copy Markdown
Contributor

@OrKoN OrKoN Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a fan of this API as it requires changing WebDriver BiDi spec whenever there is a new media feature available in the underlying browser.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since media query features generally support unknown values, e.g., in CSS rules or in the matchMedia API, I think it might be beneficial to just pass a list of media features to the browser without re-listing all possible feature names in the WebDriver BiDi's CDDL. WDYT @jgraham ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lutien WDYT about this proposal?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can ensure interoperability between the browsers if we don't specify the supported media features here, and we have to write wpt tests anyway for every feature.

? "any-hover": "none" / "hover" / null,
? "any-pointer": "none" / "coarse" / "fine" / null,
? "color": js-uint / null,
? "color-gamut": "srgb" / "p3" / "rec2020" / null,
? "color-index": js-uint / null,
? "display-mode": "fullscreen" / "standalone" / "minimal-ui" / "browser" / "picture-in-picture" / null,
? "dynamic-range": "standard" / "high" / null,
? "environment-blending": "opaque" / "additive" / "subtractive" / null,
? "forced-colors": "none" / "active" / null,
? "grid": 0 / 1 / null,
? "horizontal-viewport-segments": js-uint / null,
? "hover": "none" / "hover" / null,
? "inverted-colors": "none" / "inverted" / null,
? "monochrome": js-uint / null,
? "nav-controls": "none" / "back" / null,
? "overflow-block": "none" / "scroll" / "optional-paged" / "paged" / null,
? "overflow-inline": "none" / "scroll" / null,
? "pointer": "none" / "coarse" / "fine" / null,
? "prefers-color-scheme": "light" / "dark" / null,
? "prefers-contrast": "no-preference" / "more" / "less" / "custom" / null,
? "prefers-reduced-data": "no-preference" / "reduce" / null,
? "prefers-reduced-motion": "no-preference" / "reduce" / null,
? "prefers-reduced-transparency": "no-preference" / "reduce" / null,
? "scan": "interlace" / "progressive" / null,
? "scripting": "none" / "initial-only" / "enabled" / null,
? "update": "none" / "slow" / "fast" / null,
? "vertical-viewport-segments": js-uint / null,
? "video-color-gamut": "srgb" / "p3" / "rec2020" / null,
? "video-dynamic-range": "standard" / "high" / null,
}
</pre>
</dd>
<dt>Return Type</dt>
<dd>
<pre class="cddl" data-cddl-module="local-cddl">
emulation.SetMediaFeaturesOverrideResult = EmptyResult
</pre>
</dd>
</dl>

A [=remote end=] has a <dfn>media features override configurations map</dfn>, which is a [=/map=]
between string and [=WebDriver configuration=].

<div algorithm>
To get <dfn export>WebDriver BiDi media feature value</dfn> for [=/Document=] |document| and media
feature name |name|:

1. Let |navigable| be |document|'s [=/node navigable=].

1. If [=media features override configurations map=] does not [=map/contain=] |name|,
return null.

1. Let |media feature override| be the result of [=get WebDriver configuration value=] of
[=media features override configurations map=][|name|] for |navigable|.

1. If |media feature override| is [=WebDriver configuration/unset=], return null.

1. Return |media feature override|.

</div>

<div algorithm="remote end steps for emulation.setMediaFeaturesOverride">

The [=remote end steps=] with |command parameters| are:

1. Let |media features override| be |command parameters|["<code>features</code>"].

1. If |media features override| is null:

Note: to remove all the media feature emulations at once, we need a list of media features names.
We use keys of the [=media features override configurations map=], as it contains all the media
features that were ever used.

1. Set |media features override| to a new [=/map=].

1. For each |media feature name| of the result of [=map/get the keys=] of
[=media features override configurations map=]:

1. [=map/Set=] |media features override|[|media feature name|] to null.

1. For each |media feature name| of the result of [=map/get the keys=] of |media features override|:

1. If the implementation is unable to emulate [=media feature=] |media feature name| with
value of |media features override|[|media feature name|] for any reason, return [=error=] with
[=error code=] [=unsupported operation=].

1. Let |affected navigables| be a new [=/set=].

1. For each |media feature name| of the result of [=map/get the keys=] of |media features override|:

1. If [=media features override configurations map=] does not [=map/contain=]
|media feature name|, [=map/set=]
[=media features override configurations map=][|media feature name|] to a new
[=WebDriver configuration=] with [=WebDriver configuration/associated type=] string or
integer.

1. Let |media feature override| be |media features override|[|media feature name|].

1. If |media feature override| is null, set |media feature override| to
[=WebDriver configuration/unset=].

1. Set |affected navigables| to the [=set/union=] of |affected navigables| and the result of
[=trying=] to [=store WebDriver configuration=]
[=media features override configurations map=][|media feature name|] |media feature override|
for |command parameters|.

1. For each |navigable| of |affected navigables|:
1. [=list/For each=] |document| currently loaded in |navigable| or its [=descendant navigables=]:
1. Run [=evaluate media queries and report changes=] for |document|.

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

</div>

#### The emulation.setNetworkConditions Command #### {#command-emulation-setNetworkConditions}

The <dfn export for=commands>emulation.setNetworkConditions</dfn> command
emulates specific network conditions for the given browsing context or for a user
Expand Down Expand Up @@ -14989,6 +15128,27 @@ Insert the following steps at the start of the [=determine the device pixel rati

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=]].

### Evaluating Media Queries ### {#patchs-evaluating-media-queries}

Issue: Remove after https://github.com/w3c/csswg-drafts/pull/13549 is merged.

The <dfn export>evaluate media feature</dfn> algorithm is modified to support WebDriver BiDi
overrides. Replace the step "The result is the result of evaluating the specified media feature" to:

<div algorithm="evaluate media feature">
To get the result of evaluating a [=media feature=] |media feature| in the given [=/Document=] |document|:

1. Let |media feature name| be the |media feature|'s [=mf-name=].

1. Let |emulated value| be the result of getting [=WebDriver BiDi media feature value=] for the
|document| and |media feature name|.

1. If |emulated value| is not null, return |emulated value|.

1. Otherwise, return the result of evaluating the specified |media feature|.

</div>

# Appendices # {#appendices}

<em>This section is non-normative.</em>
Expand Down