[webkit-changes] [WebKit/WebKit] d7aeb8: UnifiedPDF: Support links to pages and points in p...

Tim Horton noreply at github.com
Fri Feb 9 17:52:21 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d7aeb8ea51ef96fdc6d6d5e648edaa2c66aee89b
      https://github.com/WebKit/WebKit/commit/d7aeb8ea51ef96fdc6d6d5e648edaa2c66aee89b
  Author: Tim Horton <timothy_horton at apple.com>
  Date:   2024-02-09 (Fri, 09 Feb 2024)

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

  Log Message:
  -----------
  UnifiedPDF: Support links to pages and points in pages
https://bugs.webkit.org/show_bug.cgi?id=269118
rdar://118550821

Reviewed by Simon Fraser.

Support in-document PDF links (which have PDFDestinations instead of URLs).

* Source/WebKit/Shared/Cocoa/PDFKitSoftLink.h:
* Source/WebKit/Shared/Cocoa/PDFKitSoftLink.mm:
Soft link kPDFDestinationUnspecifiedValue.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
(WebKit::AnnotationTrackingState::trackedAnnotation const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::convertFromPageToContents const):
Add page->contents space conversion method.

(WebKit::annotationIsLinkWithDestination):
Factor "is this a link annotation" check out, and also add a condition that
it must have a destination, otherwise we'll ignore it for clicking and cursor
updates and selection blocking.

(WebKit::UnifiedPDFPlugin::pdfElementTypesForPluginPoint const):
Adopt annotationIsLinkWithDestination.

(WebKit::UnifiedPDFPlugin::handleMouseEvent):
If the annotation under the mouse doesn't handle mouse events, we should allow
a selection to start when clicking on it.

Adopt annotationIsLinkWithDestination. Rename didClickLinkAnnotation to followLinkAnnotation.

(WebKit::UnifiedPDFPlugin::followLinkAnnotation):
Forward the annotation to scrollToPDFDestination if it has one.

(WebKit::UnifiedPDFPlugin::scrollToPDFDestination):
Compute the point and page for the given PDFDestination.

(WebKit::UnifiedPDFPlugin::scrollToPointInPDF):
Scroll to the given point in a page.

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




More information about the webkit-changes mailing list