[webkit-changes] [WebKit/WebKit] 3a5275: [UnifiedPDF] Can't drag-scroll (autoscroll) in mai...

Abrar Rahman Protyasha noreply at github.com
Tue Apr 16 12:26:51 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3a5275e3072b335f164864694b212a6f6da75393
      https://github.com/WebKit/WebKit/commit/3a5275e3072b335f164864694b212a6f6da75393
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-04-16 (Tue, 16 Apr 2024)

  Changed paths:
    M Source/WebCore/page/AutoscrollController.cpp
    M Source/WebCore/page/AutoscrollController.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm

  Log Message:
  -----------
  [UnifiedPDF] Can't drag-scroll (autoscroll) in main frame PDFs
https://bugs.webkit.org/show_bug.cgi?id=272668
rdar://125636987

Reviewed by Simon Fraser.

This patch implements autoscrolling behavior in PDFs. We do so by
drawing inspiration from the methods exposed by
WebCore::AutoscrollController.

Specifically, we maintain a timer that starts repeating whenever we drag
across a selection, and if we have dragged outside of the plugin's
bounds, we update our scroll offset to reflect the drag-scroll behavior.

* Source/WebCore/page/AutoscrollController.cpp:
* Source/WebCore/page/AutoscrollController.h:

Expose the autoscroll delay as a constexpr value in the WebCore
namespace, so as to provide a consistent experience in Unified PDF
autoscrolling.

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

Make state cleanup for selection and autoscrolling more ergonomic by
providing the work as a scope exit conditioned behind if the mouse event
to be handled is a MouseUp event. We do so because handleMouseEvent has
many exit paths, and we want to reset selection/autoscroll state in
all of them (if we are handling a MouseUp event).

(WebKit::UnifiedPDFPlugin::continueTrackingSelection):
(WebKit::UnifiedPDFPlugin::rectForSelectionInRootView const):
(WebKit::UnifiedPDFPlugin::beginAutoscroll):
(WebKit::UnifiedPDFPlugin::autoscrollTimerFired):
(WebKit::UnifiedPDFPlugin::continueAutoscroll):
(WebKit::UnifiedPDFPlugin::stopAutoscroll):
(WebKit::UnifiedPDFPlugin::scrollWithDelta):

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