-
Notifications
You must be signed in to change notification settings - Fork 711
[css-viewport] Behavior of segments
when there is only 1 segment
#11957
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
Comments
This has been discussed in the past unfortunately I can't find the discussion anymore. Semantically a segment is a part of something that is divided. If the viewport is not divided, then there are no segments. When the device is not folded there are no division therefore no segments. We don't want authors to write code against one segment because they should treat that case as the same as if there wasn't any split (meaning the device is used flat in the case of a foldable) or it's just a regular device. Furthermore, that one segment will return the same information as the viewport size bringing no useful information. We also don't want developer to feature check on this. Finally, not returning a single segment match the CSS part of this API where the MQs do not resolve for a value of one segment. In other words, MQs values are always >= 2 for the segments. |
It’s not about writing code against 1 segment, but about consistency when enumerating the segments. We keep saying “1 segment” but that does not rhyme with
Which MQ are you talking about? AFAIK there is only the I asked on social media (bsky, masto) what developers think about this:
There was an overwhelming for answer B: 1 segment. |
That's the thing, I don't want to talk about "1 segment" ever because it doesn't make sense conceptually IMHO.
https://www.w3.org/TR/mediaqueries-5/#mf-horizontal-viewport-segments
Well, I guess I'll need to update the implementation and the spec. |
In summary based on the various discussions on social websites we would be updating the specification to:
Other cases will behave the same as today, returning |
Slight tweak of the first proposed resolution, to match the PR’d spec change: “Return an array with just the 1 segment when the device is used flat or any other non-foldable device.” |
The CSSWG will automatically accept this resolution one week from now if no objections are raised here. Anyone can add an emoji to this comment to express support. If you do not support this resolution, please add a new comment. Proposed Resolution: Return an array with just one segment when the device is used flat or any other non-foldable device. |
RESOLVED: Return an array with just one segment when the device is used flat or any other non-foldable device. |
Per CSS resolution on w3c/csswg-drafts#11957, always return an array of one segment when a foldable device is used flat. This also applies to all non-foldable devices which means that we do not increase the risk of fingerprinting. This change also match the behavior of MQs (horizontal-viewport-segments for example). They always match at a value of 1 (see RenderWidgetHostImpl::GetVisualProperties()). This CL modifies the expected results of tests to reflect the new behavior. There is no compat issue with this change as the feature is not yet enabled by default. Bug: 414430842 Change-Id: Id3cd0fc8ee47a68aadd3ded8d33624d41233f589
Per CSS resolution on w3c/csswg-drafts#11957, always return an array of one segment when a foldable device is used flat. This also applies to all non-foldable devices which means that we do not increase the risk of fingerprinting. This change also match the behavior of MQs (horizontal-viewport-segments for example). They always match at a value of 1 (see RenderWidgetHostImpl::GetVisualProperties()). This CL modifies the expected results of tests to reflect the new behavior. There is no compat issue with this change as the feature is not yet enabled by default. Bug: 414430842 Change-Id: Id3cd0fc8ee47a68aadd3ded8d33624d41233f589 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6469455 Reviewed-by: David Bokan <[email protected]> Commit-Queue: Alexis Menard <[email protected]> Reviewed-by: Alex N. Jose <[email protected]> Cr-Commit-Position: refs/heads/main@{#1453468}
Per CSS resolution on w3c/csswg-drafts#11957, always return an array of one segment when a foldable device is used flat. This also applies to all non-foldable devices which means that we do not increase the risk of fingerprinting. This change also match the behavior of MQs (horizontal-viewport-segments for example). They always match at a value of 1 (see RenderWidgetHostImpl::GetVisualProperties()). This CL modifies the expected results of tests to reflect the new behavior. There is no compat issue with this change as the feature is not yet enabled by default. Bug: 414430842 Change-Id: Id3cd0fc8ee47a68aadd3ded8d33624d41233f589 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6469455 Reviewed-by: David Bokan <[email protected]> Commit-Queue: Alexis Menard <[email protected]> Reviewed-by: Alex N. Jose <[email protected]> Cr-Commit-Position: refs/heads/main@{#1453468}
Per CSS resolution on w3c/csswg-drafts#11957, always return an array of one segment when a foldable device is used flat. This also applies to all non-foldable devices which means that we do not increase the risk of fingerprinting. This change also match the behavior of MQs (horizontal-viewport-segments for example). They always match at a value of 1 (see RenderWidgetHostImpl::GetVisualProperties()). This CL modifies the expected results of tests to reflect the new behavior. There is no compat issue with this change as the feature is not yet enabled by default. Bug: 414430842 Change-Id: Id3cd0fc8ee47a68aadd3ded8d33624d41233f589 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6469455 Reviewed-by: David Bokan <[email protected]> Commit-Queue: Alexis Menard <[email protected]> Reviewed-by: Alex N. Jose <[email protected]> Cr-Commit-Position: refs/heads/main@{#1453468}
Per CSS resolution on w3c/csswg-drafts#11957, always return an array of one segment when a foldable device is used flat. This also applies to all non-foldable devices which means that we do not increase the risk of fingerprinting. This change also match the behavior of MQs (horizontal-viewport-segments for example). They always match at a value of 1 (see RenderWidgetHostImpl::GetVisualProperties()). This CL modifies the expected results of tests to reflect the new behavior. There is no compat issue with this change as the feature is not yet enabled by default. Bug: 414430842 Change-Id: Id3cd0fc8ee47a68aadd3ded8d33624d41233f589 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6469455 Reviewed-by: David Bokan <[email protected]> Commit-Queue: Alexis Menard <[email protected]> Reviewed-by: Alex N. Jose <[email protected]> Cr-Commit-Position: refs/heads/main@{#1453468}
Spec change landed and WPT test added |
The spec currently reads the following for the
segments
property ofwindow.viewport
This very counterintuitive when trying things out and I would have expected for 1 segment to reported, with its values at origin
0,0
and itswidth
/height
equal to theinnerWidth
andinnerHeight
respectively.Admittedly the fallback authors can do is pretty easy here, yet I still find it weird to return
null
as currently specced. That keyword is typically reserved to indicate that there is no value or there is no such thing, whereas there is definitely 1 segment here.Having it return 1 segment would also help distinguish the 1 segment situations vs “the document is currently not active” situation. The latter also returns
null
, as per spec:In summary, the proposed change is to return 1 segment instead of
null
when there is only 1 segment./cc @darktears
The text was updated successfully, but these errors were encountered: