Skip to content
Open
Changes from 1 commit
Commits
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
86 changes: 84 additions & 2 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6079,7 +6079,8 @@ EmulationCommand = (
emulation.SetScrollbarTypeOverride //
emulation.SetTimezoneOverride //
emulation.SetTouchOverride //
emulation.SetUserAgentOverride
emulation.SetUserAgentOverride //
emulation.SetViewportMetaOverride
)

</pre>
Expand All @@ -6094,7 +6095,8 @@ EmulationResult = (
emulation.SetScrollbarTypeOverrideResult /
emulation.SetTimezoneOverrideResult /
emulation.SetTouchOverrideResult /
emulation.SetUserAgentOverrideResult
emulation.SetUserAgentOverrideResult /
emulation.SetViewportMetaOverrideResult
)
</pre>

Expand Down Expand Up @@ -6909,6 +6911,74 @@ The [=remote end steps=] given |session| and |command parameters| are:

</div>

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

The <dfn export for=commands>emulation.setViewportMetaOverride</dfn> command modifies whether the browser respects
the <code>&lt;meta name=viewport&gt;</code> tag.

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

emulation.SetViewportMetaOverrideParameters = {
viewportMeta: true / null,
? contexts: [+browsingContext.BrowsingContext],
? userContexts: [+browser.UserContext],
}
</pre>
</dd>
<dt>Return Type</dt>
<dd>
<pre class="cddl" data-cddl-module="local-cddl">
emulation.SetViewportMetaOverrideResult = EmptyResult
</pre>
</dd>
</dl>

A [=remote end=] has a <dfn>viewport meta override configuration</dfn>, which is
[=WebDriver configuration=] with [=WebDriver configuration/associated type=] boolean.

<div algorithm>

The <dfn export>WebDriver BiDi viewport meta state</dfn> steps given
[=/Document=] |document| are:

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

Comment on lines +6951 to +6952

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.

I guess we don't really care about retrieving the top level navigable here, since the viewport meta is only relevant for top level documents? We could still do it for consistency though.

1. Let |viewport meta override| be the result of [=get WebDriver configuration value=] of
[=viewport meta override configuration=] for |navigable|.

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

1. Return |viewport meta override|.

</div>

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

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

1. Let |viewport meta override| be |command parameters|["<code>viewportMeta</code>"].

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

1. Let |affected navigables| be the result of [=store WebDriver configuration=]

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.

This should use trying to

Suggested change
1. Let |affected navigables| be the result of [=store WebDriver configuration=]
1. Let |affected navigables| be the result of [=trying=] to [=store WebDriver configuration=]

[=viewport meta override configuration=] |viewport meta override| for |command parameters|.

Note: no need to update the |affected navigables|, as |viewport meta override| takes affect
only after the next navigation.

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 think it's clear that we have to trigger reflow somehow for the viewport meta tag to take effect. And I guess navigation is the only way to do it now (?). But I'm not sure if it's fine to just delay it to the next navigation. So tagging @jgraham and @juliandescottes to get their opinions.

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.

I'm not sure if it's only about a reflow, or if handling the viewport meta is only something that happens at navigation time. If it only requires a reflow, it sounds like we could try to apply this dynamically and maybe the spec should reflect that.

If not, if it's really something that can only be applied after navigation, it might be good to expose this to a user via an additional parameter that allows to reload impacted contexts? Otherwise if you want to set the emulation and make sure all impacted contexts are applying it you'd need to set the emulation, then get all the contexts, and then send individual reload commands.

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.

Agree. I updated the algorithm to trigger "evaluate media queries and report changes" which should be sufficient to re-calculate the viewport changes.


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

</div>


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

The <dfn export for=commands>emulation.setScriptingEnabled</dfn> command emulates
Expand Down Expand Up @@ -14917,6 +14987,18 @@ 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=]].

### The viewport meta element ### {#patches-viewport-meta-element}

Issue: remove after https://github.com/w3c/csswg-drafts/pull/13548 is merged.

The 'Viewport meta element' section of the [[!CSS-VIEWPORT-1]] specification is modified to verify the
[=WebDriver BiDi viewport meta state=].

If [=WebDriver BiDi viewport meta state=] given the `viewport` meta element's
[=node document=] is true, the user agent MUST use the `viewport` meta element.

Otherwise, the user agent MAY use the `viewport` meta element.

# Appendices # {#appendices}

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