@@ -4892,6 +4892,12 @@ TODO: Move it as a hook in the html spec instead.
4892
4892
1. If [=geolocation overrides map=] [=map/contains=] |user context|,
4893
4893
[=set emulated position data=] with |navigable| and [=geolocation overrides map=] [|user context|] .
4894
4894
4895
+ 1. If [=forced colors mode theme overrides map=] [=map/contains=] |user context|:
4896
+
4897
+ 1. Let |theme| be [=forced colors mode theme overrides map=] [|user context|] .
4898
+
4899
+ 1. [=Set emulated forced colors theme data=] with |navigable| and |theme|.
4900
+
4895
4901
1. If [=screen orientation overrides map=] [=map/contains=] |user context|,
4896
4902
[=set emulated screen orientation=] with |navigable| and
4897
4903
[=screen orientation overrides map=] [|user context|] .
@@ -5813,13 +5819,17 @@ relating to emulation of browser APIs.
5813
5819
5814
5820
<pre class="cddl" data-cddl-module="remote-cddl">
5815
5821
EmulationCommand = (
5822
+ emulation.SetForcedColorsModeThemeOverride //
5816
5823
emulation.SetGeolocationOverride //
5817
5824
emulation.SetLocaleOverride //
5818
5825
emulation.SetScreenOrientationOverride //
5819
5826
emulation.SetTimezoneOverride
5820
5827
)
5821
5828
</pre>
5822
5829
5830
+ A [=remote end=] has a <dfn>forced colors mode theme overrides map</dfn> which is a weak map
5831
+ between [=user contexts=] and string or null.
5832
+
5823
5833
A <dfn>geolocation override</dfn> is a [=struct=] with:
5824
5834
* [=struct/item=] named <dfn attribute for="geolocation override">latitude</dfn> which is a float;
5825
5835
* [=struct/item=] named <dfn attribute for="geolocation override">longitude</dfn> which is a float;
@@ -5840,6 +5850,81 @@ A [=remote end=] has a <dfn>screen orientation overrides map</dfn> which is a we
5840
5850
map between [=user contexts=] and [=screen orientation override=] .
5841
5851
5842
5852
### Commands ### {#module-emulation-commands}
5853
+ #### The emulation.setForcedColorsModeThemeOverride Command #### {#command-emulation-setForcedColorsModeThemeOverride}
5854
+
5855
+ The <dfn export for=commands>emulation.setForcedColorsModeThemeOverride</dfn> command modifies
5856
+ [=forced colors mode=] theming characteristics on the given top-level traversables or user contexts.
5857
+
5858
+ <dl>
5859
+ <dt> Command Type</dt>
5860
+ <dd>
5861
+ <pre class="cddl" data-cddl-module="remote-cddl">
5862
+ emulation.SetForcedColorsModeThemeOverride = (
5863
+ method: "emulation.setForcedColorsModeThemeOverride",
5864
+ params: emulation.SetForcedColorsModeThemeOverrideParameters
5865
+ )
5866
+
5867
+ emulation.SetForcedColorsModeThemeOverrideParameters = {
5868
+ theme: emulation.ForcedColorsModeTheme / null,
5869
+ ? contexts: [+browsingContext.BrowsingContext] ,
5870
+ ? userContexts: [+browser.UserContext] ,
5871
+ }
5872
+
5873
+ emulation.ForcedColorsModeTheme = "light" / "dark"
5874
+ </pre>
5875
+ </dd>
5876
+ <dt> Result Type</dt>
5877
+ <dd>
5878
+ <code>
5879
+ EmptyResult
5880
+ </code>
5881
+ </dd>
5882
+ </dl>
5883
+
5884
+ Note: Check out the {{ForcedColorsModeAutomationTheme}} for the corresponding enum mapping in the CSS specification.
5885
+
5886
+ <div algorithm="remote end steps for emulation.setForcedColorsModeThemeOverride">
5887
+
5888
+ The [=remote end steps=] with |command parameters| are:
5889
+
5890
+ 1. If |command parameters| [=map/contains=] "<code> userContexts</code> "
5891
+ and |command parameters| [=map/contains=] "<code> contexts</code> ",
5892
+ return [=error=] with [=error code=] [=invalid argument=] .
5893
+
5894
+ 1. If |command parameters| doesn't [=map/contain=] "<code> userContexts</code> "
5895
+ and |command parameters| doesn't [=map/contain=] "<code> contexts</code> ",
5896
+ return [=error=] with [=error code=] [=invalid argument=] .
5897
+
5898
+ 1. Let |theme| be |command parameters|["<code>theme</code>"] .
5899
+
5900
+ 1. If |theme| is null, set |theme| to "<code> none</code> ".
5901
+
5902
+ 1. Let |navigables| be a [=/set=] .
5903
+
5904
+ 1. If the <code> contexts</code> field of |command parameters| is present:
5905
+
5906
+ 1. Let |navigables| be the result of [=trying=] to [=get valid top-level traversables by ids=] with |command parameters|["<code>contexts</code>"] .
5907
+
5908
+ 1. Otherwise:
5909
+
5910
+ 1. Let |user contexts| be the result of [=trying=] to [=get valid user contexts=] with |command parameters|["<code>userContexts</code>"] .
5911
+
5912
+ 1. For each |user context| of |user contexts|:
5913
+
5914
+ 1. [=map/Set=] [=forced colors mode theme overrides map=] [|user context|] to |theme|.
5915
+
5916
+ 1. [=list/For each=] |top-level traversable| of the list of all [=/top-level traversables=]
5917
+ whose [=associated user context=] is |user context|:
5918
+
5919
+ 1. [=list/Append=] |top-level traversable| to |navigables|.
5920
+
5921
+ 1. For each |navigable| of |navigables|:
5922
+
5923
+ 1. [=Set emulated forced colors theme data=] with |navigable| and |theme|.
5924
+
5925
+ 1. Return [=success=] with data null.
5926
+
5927
+ </div>
5843
5928
5844
5929
#### The emulation.setGeolocationOverride Command #### {#command-emulation-setGeolocationOverride}
5845
5930
0 commit comments