[webkit-changes] [WebKit/WebKit] c4b0e9: [UnifiedPDF] Force-clicking text in a link in a PD...

Abrar Rahman Protyasha noreply at github.com
Thu Aug 15 15:17:03 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c4b0e95acb7006714ae7e04bb18dc63a9a58c6b0
      https://github.com/WebKit/WebKit/commit/c4b0e95acb7006714ae7e04bb18dc63a9a58c6b0
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-08-15 (Thu, 15 Aug 2024)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/page/EventHandler.h
    A Source/WebCore/page/ImmediateActionStage.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
    M Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm

  Log Message:
  -----------
  [UnifiedPDF] Force-clicking text in a link in a PDF follows the link
https://bugs.webkit.org/show_bug.cgi?id=278161
rdar://133913833

Reviewed by Tim Horton.

EventHandler maintains some state that tells us which stage of immediate
action we are in. When deep clicking over a link in web content, we
correctly return early from mouse release handling so as to prevent any
unwanted default behaviors, such as navigating to the link under the
deep touch.

Unfortunately, the PDF plugin is not aware of the immediate action
stage, and eventually when default event handling for a mouse release
event bubbles up to the plugin, it simply follows a link annotation it
thinks it clicked on.

In this patch, we teach the plugin to consult the ImmediateActionStage
flag maintained by EventHandler, and only navigates to a link if it
thinks the mouse release event it is currently handling has _not_
resulted from an immediate action gesture, i.e. force click.

* Source/WebCore/WebCore.xcodeproj/project.pbxproj:

* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseReleaseEvent):
* Source/WebCore/page/EventHandler.h:

We reset the immediate action stage after DOM event handling, and not
before, to ensure that downstream callees can query for the correct
immediate action stage.

* Source/WebCore/page/ImmediateActionStage.h: Added.
(WebCore::immediateActionBeganOrWasCompleted):

For ease of organization, we split out the ImmediateActionStage enum
class and an associated helper utility into its own header.

* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::handleMouseEvent):
(WebKit::UnifiedPDFPlugin::handlePDFActionForAnnotation):
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
* Source/WebKitLegacy/mac/WebView/WebImmediateActionController.mm:

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