[webkit-changes] [WebKit/WebKit] 81962d: [UnifiedPDF] Refactor annotation tracking logic in...

Sammy Gill noreply at github.com
Mon Feb 5 06:34:38 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 81962dc8143b9e02da51e61edd07e9c8761454ad
      https://github.com/WebKit/WebKit/commit/81962dc8143b9e02da51e61edd07e9c8761454ad
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2024-02-05 (Mon, 05 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] Refactor annotation tracking logic into its own class.
https://bugs.webkit.org/show_bug.cgi?id=268670
rdar://problem/122211531

Reviewed by Simon Fraser and Tim Horton.

Instead of haphazardly modifying and keeping track of the logic needed
to track annotations through mouse events, we can refactor this logic
into its own class and make the rest of the UnifiedPDFPlugin logic
simpler. Whenever we need to actually modify any annotation tracking
state, the calling code will do so by using startAnnotationTracking or
finishAnnotationTracking. The state will be modified by taking into
consideration the type of annotation, the mouse event type, and mouse
event button.

The annotation that is being tracked can be accessed via
trackedAnnotation(). If any other state needs to be kept and queried
in the future (e.g. state that helps know if annotation is being
hovered that I plan on adding), it can be done by adding extra fields
to this class.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
(WebKit::AnnotationTrackingState::trackedAnnotation const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::handleMouseEvent):
(WebKit::AnnotationTrackingState::startAnnotationTracking):
(WebKit::AnnotationTrackingState::finishAnnotationTracking):
(WebKit::AnnotationTrackingState::handleMouseDraggedOffTrackedAnnotation):
(WebKit::UnifiedPDFPlugin::startAnnotationTracking): Deleted.
(WebKit::UnifiedPDFPlugin::finishAnnotationTracking): Deleted.
(WebKit::UnifiedPDFPlugin::handleMouseDraggedOffTrackedAnnotation): Deleted.

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




More information about the webkit-changes mailing list