Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 8099f94806f156869d7f806084efb542ea1658c9 https://github.com/WebKit/WebKit/commit/8099f94806f156869d7f806084efb542ea1658c9 Author: Abrar Rahman Protyasha <a_protya...@apple.com> Date: 2024-02-08 (Thu, 08 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] Context menu events should update selections https://bugs.webkit.org/show_bug.cgi?id=268951 rdar://122503367 Reviewed by Tim Horton and Simon Fraser. This patch introduces support for selection updates based on context menu events (right click or ctrl-click). It does so by adding some logic for context menu events that shortcuts the rest of our selection tracking operation. Specifically, we call into updateCurrentSelectionForContextMenuEventIfNeeded, which generates a text selection for the word under which the click is produced, unless of course the click location already intersects with an existing selection. Furthermore, we add a lastHandledEventWasContextMenuEvent flag to our selection tracking data, which we consult when determining whether selections should be painted with an active or inactive appearance. This is relevant because interacting with context menus causes selections to go inactive in shipping macOS. Finally, we make some drive-by fixes where we opt to pass enumeration values such as WebEventType by value and not as const references, since they are POD types. * Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h: * Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm: (WebKit::UnifiedPDFPlugin::windowActivityDidChange): (WebKit::UnifiedPDFPlugin::paintPDFContent): (WebKit::isContextMenuEvent): (WebKit::UnifiedPDFPlugin::handleMouseEvent): (WebKit::UnifiedPDFPlugin::handleContextMenuEvent): (WebKit::UnifiedPDFPlugin::extendCurrentSelectionIfNeeded): (WebKit::UnifiedPDFPlugin::beginTrackingSelection): (WebKit::UnifiedPDFPlugin::updateCurrentSelectionForContextMenuEventIfNeeded): (WebKit::UnifiedPDFPlugin::repaintOnSelectionActiveStateChangeIfNeeded): (WebKit::UnifiedPDFPlugin::isSelectionActiveAfterContextMenuInteraction const): (WebKit::UnifiedPDFPlugin::setCurrentSelection): (WebKit::AnnotationTrackingState::startAnnotationTracking): (WebKit::AnnotationTrackingState::finishAnnotationTracking): Canonical link: https://commits.webkit.org/274347@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes