[webkit-changes] [WebKit/WebKit] 17182b: [UnifiedPDF] Going from continuous to discrete lay...

Sammy Gill noreply at github.com
Mon May 6 13:39:06 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 17182bac125549892aa4d01a30e3c35b22b2f5df
      https://github.com/WebKit/WebKit/commit/17182bac125549892aa4d01a30e3c35b22b2f5df
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2024-05-06 (Mon, 06 May 2024)

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

  Log Message:
  -----------
  [UnifiedPDF] Going from continuous to discrete layout modes lands the user in a different page number.
https://bugs.webkit.org/show_bug.cgi?id=273779
rdar://127445845

Reviewed by Abrar Rahman Protyasha and Simon Fraser.

In order to leverage our scroll snapping mechanisms we create various
structures to represent all of the scroll snap areas and offsets and
pass them as state to the scroll snapping logic for use later.

The issue is that we determine the geometry of the pages using
`pageBoundsInContentsSpace` (which is actually returning values in
something close to scrolled contents space but I plan to address that
separately), but this is problematic since this factors in the page
scale while the scroll snap logic takes the current scroll offset and
factors it out when looking at the provided geometry of the scroll
offsets/areas.

To factor out the page scale we can use our helper conversion functions
to convert from document space to actual contents space. We also need
to do the same thing in our logic that attempts to determine the
the currently snapped page since that uses the scroll offset.

Finally, we attempt hook into the resnapping logic when we switch
layout modes, but this is also an issue because it seems to keep the
page scale factored into the scroll offset while looking at the snap
areas geometries. Instead, let's just scroll to the currently snapped
page since we determined this ourselves anyway.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::updateSnapOffsets):
(WebKit::UnifiedPDFPlugin::determineCurrentlySnappedPage):
(WebKit::UnifiedPDFPlugin::setDisplayModeAndUpdateLayout):

Canonical link: https://commits.webkit.org/278421@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