[webkit-changes] [WebKit/WebKit] 4353d6: [UnifiedPDF] When zoomed out, "Next Page" context ...

Abrar Rahman Protyasha noreply at github.com
Fri Jan 24 13:09:00 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4353d6d58c5b2cc2d063b67935dda360775793ca
      https://github.com/WebKit/WebKit/commit/4353d6d58c5b2cc2d063b67935dda360775793ca
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2025-01-24 (Fri, 24 Jan 2025)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [UnifiedPDF] When zoomed out, "Next Page" context menu option jumps multiple pages at once in continuous display modes
https://bugs.webkit.org/show_bug.cgi?id=286465
rdar://143556772

Reviewed by Tim Horton.

Similar to the root cause in 289337 at main, the "Next Page" context menu
option would feel like a no-op (or even, would navigate backwards) at
certain scales because we would get the index of the page "currently"
in view, i.e. center-most page, and only navigate forward by a row.
When zoomed out far enough, this center-most page and the pages offset
by a row are all roughly in the middle of the page, so we don't end up
invoking revealPage() on the appropriate index.

This patch tries to be smarter about which page we land on with the
context menu option. We ideally want to end up on the first page under
the bottom edge of the root view, but this does not translate well to
discrete display modes because you only ever have one row visible in
the root view. Thus, we either go one row ahead of the page "currently"
in view, or use the metric I just mentioned.

Moreover, when zoomed out far enough, if the bottom edge of a page
perfectly aligns with the root view's edge, then our new metric makes us
land on said page consistently, taking us back to no-op-like navigation.
To avoid this, we teach the plugin to consult the return value of the
ScrollableArea helpers it uses under revealPage(). If we don't
successfully scroll during the reveal operation, we move forward one row
and try again.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::performContextMenuAction):

Canonical link: https://commits.webkit.org/289362@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list