renderer: Have the viewport meta element establish the initial zoom of new pages (#37315)

This patch contains 2 components: 

1. Instead of passing `self.pinch_zoom_level().get()` while checking
`zoom_result`, initialize it in `combined_magnification`. Ideally, this
part shouldn't have any effect on behavior.

2. Separates the logic for PinchZoom and ViewportZoom. So, when a new
page is opened, it will start with its own viewport zoom scale (rather
than the previous scale multiples).
i.e `self.pinch_zoom_level().get() * 1.0 * magnification`
```rust
        let mut combined_magnification = 1.0;
        ... 
                ScrollZoomEvent::ViewportZoom(magnification) => {
                    combined_magnification *= magnification
                },
        ...        
        let pinch_zoom_result = match self.set_pinch_zoom_level(self.pinch_zoom_level().get() * combined_magnification)
``` 





Testing: This change adds a new WPT test.
Fixes: #37314

---------

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
This commit is contained in:
Shubham Gupta 2025-07-15 21:54:05 +08:00 committed by GitHub
parent 547ce67514
commit 34829dfce7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 83 additions and 11 deletions

View file

@ -373460,6 +373460,21 @@
}
}
},
"visual-viewport": {
"viewport-apply-initial-scale-after-navigation.html": [
"ec03c380d6d27ed0b486a26203d441dc101fd39f",
[
null,
[
[
"/visual-viewport/viewport-apply-initial-scale-after-navigation-ref.html",
"=="
]
],
{}
]
]
},
"web-animations": {
"animation-model": {
"keyframe-effects": {
@ -522286,6 +522301,16 @@
"c036b16ec87bc7e562c4040ad1923c5a8b483cec",
[]
],
"resource": {
"viewport-apply-initial-scale-after-navigation-inner.html": [
"edbf5dbb70aa916363ff32eab847f2d03562d4f5",
[]
]
},
"viewport-apply-initial-scale-after-navigation-ref.html": [
"904d370d6b464ef526b79e3974532d3f2c57d13b",
[]
],
"viewport_support.js": [
"a82bd2b028010e053199e55bd7bb357361581e6f",
[]