Skip to content

libservo: Rename WebView::set_pinch_zoom to WebView::pinch_zoom - #39868

Merged
atbrakhi merged 1 commit into
servo:mainfrom
mrobinson:make-pinch-zoom-make-more-sense
Oct 14, 2025
Merged

atbrakhi merged 1 commit into
servo:mainfrom
mrobinson:make-pinch-zoom-make-more-sense

Conversation

@mrobinson

Copy link
Copy Markdown
Member

This change is meant to make it more obvious that adjusting the pinch
zoom of a WebView works differently than adjusting the page zoom.
New pinch zoom values are always zoom deltas, that is they are always
multiplied by the current pinch zoom value. This is due to the way that
system APIs and Servo's internal touch handler provide values.

In addition, stop clamping the pinch zoom by the page zoom clamp values.
They aren't meant for that. Instead set up some reasonable clamping
values for pinch zoom in the compositor.

Also add more rustdoc for public API.

Testing: The changes to API naming do not really need tests, and the changes to
behavior (the clamping) can't be easily tested now as there is no way currently
to read the current pinch zoom level of the WebView. This requires more API in
the renderer.

This change is meant to make it more obvious that adjusting the pinch
zoom of a `WebView` works differently than adjusting the page zoom.
New pinch zoom values are *always* zoom deltas, that is they are always
multiplied by the current pinch zoom value. This is due to the way that
system APIs and Servo's internal touch handler provide values.

In addition, stop clamping the pinch zoom by the page zoom clamp values.
They aren't meant for that. Instead set up some reasonable clamping
values for pinch zoom in the compositor.

Also add more rustdoc for public API.

Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Oct 14, 2025
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Oct 14, 2025
@atbrakhi
atbrakhi enabled auto-merge October 14, 2025 14:34

@yezhizhen yezhizhen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New pinch zoom values are always zoom deltas, that is they are always
multiplied by the current pinch zoom value.

Why is it called delta? delta sounds more like addition/subtraction.

@atbrakhi
atbrakhi added this pull request to the merge queue Oct 14, 2025
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 14, 2025
Merged via the queue into servo:main with commit 1489de1 Oct 14, 2025
31 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Oct 14, 2025
@mrobinson
mrobinson deleted the make-pinch-zoom-make-more-sense branch October 15, 2025 06:22
@mrobinson

Copy link
Copy Markdown
Member Author

Why is it called delta? delta sounds more like addition/subtraction.

Good point. We should consider a new name.

}

fn set_pinch_zoom_level(&mut self, mut zoom: f32) -> bool {
if let Some(viewport) = self.viewport_description.as_ref() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect deletion logic; it should be restricted using self.viewport_description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants