-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UnifiedPDF] Cursor should update correctly over text and annotations
https://bugs.webkit.org/show_bug.cgi?id=265866 rdar://118550951 Reviewed by Tim Horton. UnifiedPDFPlugin has the plumbing in place to send cursor updates to the UI process, but does not actually know what annotations/text (or other PDF elements of interest) exist under a given point in a PDF page. This patch builds up our hit-testing logic to imbibe UnifiedPDFPlugin with this knowledge. The logic to build up our set of PDF elements under a point is fairly straightforward as we consult (and map) the type of the annotation at a given point reported by PDFKit. As for text and images, which are not annotations, we have to call into CoreGraphics' PDFPageLayout SPI that returns a bitset indicating the presence of text and images under a given page point. Note that we only do so for tagged PDFs, since the SPI in question does not return any information for PDFs that are not tagged. * Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h: Provide declarations required to call into `CGPDFDocumentIsTaggedPDF` and `CGPDFPageLayoutGetAreaOfInterestAtPoint`. * Source/WebKit/Platform/spi/Cocoa/PDFKitSPI.h: Renamed from Source/WebKit/Platform/spi/ios/PDFKitSPI.h. Move to a Cocoa subdirectory since this SPI declaration header is now required in UnifiedPDFPlugin.mm. Also, provide a declaration to be able to obtain a PDFPage object's corresponding CGPDFPageLayout instance. * Source/WebKit/Shared/Cocoa/PDFKitSoftLink.h: * Source/WebKit/Shared/Cocoa/PDFKitSoftLink.mm: Soft-link more PDFAnnotation-adjacent classes used for type equality checks in our hit-testing logic. Also, drive-by fix that sorts the PDFKit symbols alphabetically. * Source/WebKit/WebKit.xcodeproj/project.pbxproj: In addition to moving PDFKitSPI.h around, also added WebKit target membership for the file. * Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h: * Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm: (WebKit::toWebCoreCursorType): Some drive-by ergonomics nicety to avoid having to type out the `UniversalPDFPlugin::` prefix. (WebKit::UnifiedPDFPlugin::isTaggedPDF const): Add a method to query whether the PDFDocument is tagged. (WebKit::UnifiedPDFPlugin::pdfElementTypesForPluginPoint const): The bulk of the logic described in the commit message is implemented here. * Tools/TestWebKitAPI/Configurations/Base.xcconfig: Since PDFKitSPI.h was moved to a Cocoa subdirectory, include said path in the cocoatouch header search path. Canonical link: https://commits.webkit.org/271650@main
- Loading branch information
Showing
8 changed files
with
94 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters