-
Notifications
You must be signed in to change notification settings - Fork 78
emulation.setViewportMetaOverride
#1073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6079,7 +6079,8 @@ EmulationCommand = ( | |||||
| emulation.SetScrollbarTypeOverride // | ||||||
| emulation.SetTimezoneOverride // | ||||||
| emulation.SetTouchOverride // | ||||||
| emulation.SetUserAgentOverride | ||||||
| emulation.SetUserAgentOverride // | ||||||
| emulation.SetViewportMetaOverride | ||||||
| ) | ||||||
|
|
||||||
| </pre> | ||||||
|
|
@@ -6094,7 +6095,8 @@ EmulationResult = ( | |||||
| emulation.SetScrollbarTypeOverrideResult / | ||||||
| emulation.SetTimezoneOverrideResult / | ||||||
| emulation.SetTouchOverrideResult / | ||||||
| emulation.SetUserAgentOverrideResult | ||||||
| emulation.SetUserAgentOverrideResult / | ||||||
| emulation.SetViewportMetaOverrideResult | ||||||
| ) | ||||||
| </pre> | ||||||
|
|
||||||
|
|
@@ -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><meta name=viewport></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=]. | ||||||
|
|
||||||
| 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=] | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should use trying to
Suggested change
|
||||||
| [=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. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||||||
|
|
@@ -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> | ||||||
|
|
||||||
There was a problem hiding this comment.
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.