Skip to content
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

Use pageZoom instead of magnification when adjusting web view zoom level #455

Merged
merged 1 commit into from
Mar 7, 2022

Conversation

ayoy
Copy link
Collaborator

@ayoy ayoy commented Mar 4, 2022

Task/Issue URL: https://app.asana.com/0/1177771139624306/1200398379892840/f
Tech Design URL:
CC:

Description:
I updated zoom level manipulation methods to operate on WKWebView.pageZoom instead of WKWebView.magnification where possible (i.e. >=macOS 11). According to the docs, pageZoom adjusts CSS zoom attribute which is what we want here, while magnification applies a scale transform to the canvas (which is appropriate e.g. for pinch zooming). This change gives us the behavior similar to Safari.

Steps to test this PR:

  1. Open any webpage (I was testing with GitHub)
  2. Zoom out using ⌘- and notice that the canvas size stays the same while the webpage components become smaller
  3. Zoom in using ⌘+ and notice that the canvas size stays the same while the webpage components become larger

Testing checklist:

  • Test with Release configuration

Internal references:

Software Engineering Expectations
Technical Design Template
When ready for review, remember to post the PR in MM

WKWebView.pageZoom adjusts layout instead of canvas, but is only available
on macOS >11, so the fix does not cover macOS 10.15.
@tomasstrba tomasstrba self-requested a review March 4, 2022 12:46
@tomasstrba tomasstrba self-assigned this Mar 4, 2022
Copy link
Contributor

@tomasstrba tomasstrba left a comment

Choose a reason for hiding this comment

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

LGTM! 👍 💯 🎖️

@tomasstrba tomasstrba assigned ayoy and unassigned tomasstrba Mar 7, 2022
@ayoy ayoy merged commit 9d2725e into develop Mar 7, 2022
@ayoy ayoy deleted the bugfix/dominik/page-zoom branch March 7, 2022 14:26
samsymons added a commit that referenced this pull request Mar 8, 2022
# By Dominik Kapusta (2) and others
# Via GitHub
* develop:
  Animate dashboard resizing (#454)
  Dashboard in background tabs (#458)
  Fix resubmitting search with spaces (#456)
  Use smarter encryption feature from the BSK (#441)
  Use pageZoom instead of magnification when adjusting web view zoom level (#455)
  Version 0.19.2

# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
samsymons added a commit that referenced this pull request Mar 10, 2022
* develop:
  Advance content scope scripts forwards (#453)
  Animate dashboard resizing (#454)
  Dashboard in background tabs (#458)
  Fix resubmitting search with spaces (#456)
  Use smarter encryption feature from the BSK (#441)
  Use pageZoom instead of magnification when adjusting web view zoom level (#455)
  Version 0.19.2
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.

2 participants