[webkit-changes] [WebKit/WebKit] 375ade: [UnifiedPDF] Stop using deprecated PDFAnnotation s...

Abrar Rahman Protyasha noreply at github.com
Tue Sep 17 15:21:05 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 375adeb78a3cbc278b08b358ad950805be8692d9
      https://github.com/WebKit/WebKit/commit/375adeb78a3cbc278b08b358ad950805be8692d9
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-09-17 (Tue, 17 Sep 2024)

  Changed paths:
    M Source/WebKit/Shared/Cocoa/PDFKitSoftLink.h
    M Source/WebKit/Shared/Cocoa/PDFKitSoftLink.mm
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    R Source/WebKit/WebProcess/Plugins/PDF/PDFAnnotationTextWidgetDetails.h
    A Source/WebKit/WebProcess/Plugins/PDF/PDFAnnotationTypeHelpers.h
    A Source/WebKit/WebProcess/Plugins/PDF/PDFAnnotationTypeHelpers.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFScrollingPresentationController.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/TextAnimationController.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebCookieJarCocoa.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm

  Log Message:
  -----------
  [UnifiedPDF] Stop using deprecated PDFAnnotation subclasses
https://bugs.webkit.org/show_bug.cgi?id=279807
rdar://136120943

Reviewed by Sammy Gill and Aditya Keerthi.

To interact with the various widget subtypes (button, choice, text), we
were directly casting to (and calling into) sublasses of PDFAnnotation,
namely PDFAnnotation[Button|Choice|Text]Widget. These subclasses are
deprecated and (more importantly) unavailable in iOS. The latter issue
stands in the way of making PDFPluginAnnotation a cross-platform
concept, which we need to do in anticipation of password-protected PDF
support for the iOS family.

As such, this patch moves us away from the deprecated subclasses to
instead query widget types through the key-based interface defined by
PDFAnnotation[Key|[Widget]Subtype]. Moreover, it uses appropriate
replacement methods defined in the PDFAnnotationUtilities protocol
category.

* Source/WebKit/Shared/Cocoa/PDFKitSoftLink.h:
* Source/WebKit/Shared/Cocoa/PDFKitSoftLink.mm:

Stop soft linking the deprecated PDFAnnotation subclasses.
Start soft linking the keys of interest.

* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

* Source/WebKit/WebProcess/Plugins/PDF/PDFAnnotationTypeHelpers.h: Renamed from Source/WebKit/WebProcess/Plugins/PDF/PDFAnnotationTextWidgetDetails.h.
* Source/WebKit/WebProcess/Plugins/PDF/PDFAnnotationTypeHelpers.mm: Added.
(WebKit::PDFAnnotationTypeHelpers::widgetType):
(WebKit::PDFAnnotationTypeHelpers::annotationIsWidget):
(WebKit::PDFAnnotationTypeHelpers::annotationIsWidgetOfType):

Make PDF annotation (widget) type querying ergonomic through a set of
helper functions.

* Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::setActiveAnnotation):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginAnnotation.mm:
(WebKit::PDFPluginAnnotation::create):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.h:
(WebKit::PDFPluginChoiceAnnotation::choiceAnnotation): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginChoiceAnnotation.mm:
(WebKit::PDFPluginChoiceAnnotation::create):
(WebKit::PDFPluginChoiceAnnotation::updateGeometry):
(WebKit::PDFPluginChoiceAnnotation::commit):
(WebKit::PDFPluginChoiceAnnotation::createAnnotationElement):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.h:
(WebKit::PDFPluginTextAnnotation::textAnnotation const): Deleted.
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:
(WebKit::PDFPluginTextAnnotation::create):
(WebKit::PDFPluginTextAnnotation::createAnnotationElement):
(WebKit::PDFPluginTextAnnotation::updateGeometry):
(WebKit::PDFPluginTextAnnotation::commit):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFPresentationController.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/PDFScrollingPresentationController.mm:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::pageIndexWithHoveredAnnotation const):
(WebKit::UnifiedPDFPlugin::pdfElementTypesForPluginPoint const):
(WebKit::UnifiedPDFPlugin::handleMouseEvent):
(WebKit::UnifiedPDFPlugin::repaintRequirementsForAnnotation):
(WebKit::findFirstTextAnnotationStartingAtIndex):
(WebKit::UnifiedPDFPlugin::setActiveAnnotation):
(WebKit::AnnotationTrackingState::startAnnotationTracking):
(WebKit::AnnotationTrackingState::finishAnnotationTracking):

* Source/WebKit/WebProcess/WebPage/Cocoa/TextAnimationController.mm:
* Source/WebKit/WebProcess/WebPage/Cocoa/WebCookieJarCocoa.mm:
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:

Unified sources fixes.

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