[webkit-changes] [WebKit/WebKit] 2817e2: Stop using deprecated PDFAnnotation subclasses, pa...

Abrar Rahman Protyasha noreply at github.com
Fri Dec 6 23:24:56 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2817e279dde1de080ac9044f30a44f998debf36b
      https://github.com/WebKit/WebKit/commit/2817e279dde1de080ac9044f30a44f998debf36b
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-12-06 (Fri, 06 Dec 2024)

  Changed paths:
    M Source/WebKit/Shared/Cocoa/PDFKitSoftLink.h
    M Source/WebKit/Shared/Cocoa/PDFKitSoftLink.mm
    M Source/WebKit/UIProcess/mac/WKPrintingView.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFAnnotationTypeHelpers.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFAnnotationTypeHelpers.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm

  Log Message:
  -----------
  Stop using deprecated PDFAnnotation subclasses, part 2
https://bugs.webkit.org/show_bug.cgi?id=284156
rdar://141039815

Reviewed by Tim Horton and Wenson Hsieh.

The PDFAnnotation[Link|Text|Popup] subclasses are deprecated on macOS
and unavailable on the iOS family. For the latter group of platforms,
this means that our annotation type checks were not meaningful.

In this patch, we migrate from directly using these deprecated classes
and instead leaning into key-value lookups on PDFAnnotation instances
using the PDFAnnotationSubType-and-adjacent interfaces. We also use the
new `URL` property exposed on the PDFAnnotation class (through a new
category in the PDFAnnotationUtilities.h), which should _just work_ for
link annotations, meaning we do not need to explicitly cast annotation
instances anymore.

This allows us to make our annotation type checks correct on all
platforms, as well as remove deprecation warning supressors in a few
places.

* Source/WebKit/Shared/Cocoa/PDFKitSoftLink.h:
* Source/WebKit/Shared/Cocoa/PDFKitSoftLink.mm:
* Source/WebKit/UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView _drawPDFDocument:page:atPoint:]):
(-[WKPrintingView drawRect:]):
* Source/WebKit/WebProcess/Plugins/PDF/PDFAnnotationTypeHelpers.h:
* Source/WebKit/WebProcess/Plugins/PDF/PDFAnnotationTypeHelpers.mm:
(WebKit::PDFAnnotationTypeHelpers::widgetType):
(WebKit::PDFAnnotationTypeHelpers::annotationType):
(WebKit::PDFAnnotationTypeHelpers::annotationCheckerInternal):
(WebKit::PDFAnnotationTypeHelpers::annotationIsOfType):
(WebKit::PDFAnnotationTypeHelpers::annotationIsWidgetOfType):
(WebKit::PDFAnnotationTypeHelpers::annotationIsWidget): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::textForImmediateActionHitTestAtPoint):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::annotationIsExternalLink):
(WebKit::annotationIsLinkWithDestination):
(WebKit::UnifiedPDFPlugin::pdfElementTypesForPluginPoint const):
(WebKit::UnifiedPDFPlugin::repaintRequirementsForAnnotation):
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::drawPDFPage):

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