compositor: Have viewport meta tag affect the layout viewport#40055
Merged
Conversation
mrobinson
approved these changes
Oct 21, 2025
Member
|
Isn't it what I did here : #39067 ? @mrobinson cc: @xiaochengh |
Member
I left a comment asking you to reopen the PR if it was still an issue (as the original bug was closed), but didn't see any activity. We were reading the specifications and stumbled on this issue independently. We'll add you as a co-author here. |
The CSS specifications defines two viewports, the "layout viewport" and the visual viewport. The layout viewport affects layout and the visual viewport is the result of applying pinch zoom. This changes makes it so that the initial-scale property of <meta type="viewport"> affects the layout viewport. Co-authored-by: Shubham Gupta <[email protected]> Co-authored-by: Martin Robinson <[email protected]> Signed-off-by: atbrakhi <[email protected]>
Member
Author
|
@shubhamg13 i have added you as co-author, sorry for the confusion. |
This was referenced Mar 10, 2026
pull Bot
pushed a commit
to Haofei/servo
that referenced
this pull request
May 5, 2026
Fixup: servo#40055 Instead of applying initial scale to page. - An `initial-scale` should directly affect the `visualviewport.scale`as it is layer that manages zoom factor w3c/csswg-drafts#9004 - `initial-scale` should be considered with `device_pixel_ratio` while calculating `layout_viewport` as per following spec gudelines. Specs: https://www.w3.org/TR/css-viewport-1/#the-viewport > This specification introduces a way of overriding the size of the viewport provided by the user agent (UA). Because of this, we need to introduce the difference between the initial viewport and the actual viewport. > > _initial viewport_ > This refers to the viewport before any UA or author styles have overridden the viewport given by the window or viewing area of the UA. Note that the initial viewport size will change with the size of the window or viewing area. > _actual viewport_ > This is the viewport you get after processing the viewport <meta> tag. Sample Page: [viewport_meta_with_style_2.html](https://github.com/user-attachments/files/26271786/viewport_meta_with_style_2.html) Testing: `tests/webview.rs`: `test_viewport_meta_tag_initial_scale` Fixes: servo#39002 --------- Signed-off-by: Shubham Gupta <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CSS specifications defines two viewports1, the "layout viewport" and the visual viewport. The layout viewport affects layout and the visual viewport is the result of applying pinch zoom. This changes makes it so that the initial-scale property of
<meta type="viewport">affects the layout viewport.Testing: Added a new unit test
Footnotes
https://www.w3.org/TR/css-viewport-1/#the-viewport ↩