[webkit-changes] [WebKit/WebKit] 85b7b3: [UnifiedPDF] Track text selections on mouse drag

Abrar Rahman Protyasha noreply at github.com
Fri Feb 2 19:23:55 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 85b7b3c02480754c7629094106730e68d9c36c7a
      https://github.com/WebKit/WebKit/commit/85b7b3c02480754c7629094106730e68d9c36c7a
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-02-02 (Fri, 02 Feb 2024)

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

  Log Message:
  -----------
  [UnifiedPDF] Track text selections on mouse drag
https://bugs.webkit.org/show_bug.cgi?id=268654
rdar://122200693

Reviewed by Tim Horton.

This patch introduces support for tracking text selections on mouse
drag. It does so by keeping a record of the state of selections in the
plugin, through the currentSelection and selectionTrackingData objects.

Selections are initiated on a left button mousedown, and end when a
corresponding mouseup is received.

We additionally provide support for marquee selections, where a
mouse drag gesture with an active alt-key modifier generates a selection
within the rect dragged by the gesture.

Finally, we also add unimplemented codepaths for tracking selections at
different granularities, which is relevant if the user double clicks or
triple clicks, and for extending selections with shift-click.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::annotationForRootViewPoint const):
(WebKit::UnifiedPDFPlugin::handleMouseEvent):
(WebKit::UnifiedPDFPlugin::selectionGranularityForMouseEvent const):
(WebKit::UnifiedPDFPlugin::beginTrackingSelection):
(WebKit::computeMarqueeSelectionRect):
(WebKit::UnifiedPDFPlugin::continueTrackingSelection):
(WebKit::UnifiedPDFPlugin::setCurrentSelection):
(WebKit::UnifiedPDFPlugin::commitCurrentSelection):
(WebKit::UnifiedPDFPlugin::getSelectionString const):

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




More information about the webkit-changes mailing list