Use own ViewportDescription to clamp() initial_scale (#37337)

Use own `ViewportDescription` to `clamp()` initial_scale.

If use `self` it will use current module `ViewportDescription`, which is
old one because new `ViewportDescription` is not set yet.

Testing: Tested Locally
Fixes: #37338

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
This commit is contained in:
Shubham Gupta 2025-06-11 13:31:05 +08:00 committed by GitHub
parent 73361d0f5f
commit f1767e6c1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1048,9 +1048,8 @@ impl WebViewRenderer {
pub fn set_viewport_description(&mut self, viewport_description: ViewportDescription) {
self.pending_scroll_zoom_events
.push(ScrollZoomEvent::ViewportZoom(
self.viewport_description
viewport_description
.clone()
.unwrap_or_default()
.clamp_zoom(viewport_description.initial_scale.get()),
));
self.viewport_description = Some(viewport_description);