Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4f4133c103f56f6f60b2e5f3ddcd29711ebde341
      
https://github.com/WebKit/WebKit/commit/4f4133c103f56f6f60b2e5f3ddcd29711ebde341
  Author: Wenson Hsieh <[email protected]>
  Date:   2024-12-13 (Fri, 13 Dec 2024)

  Changed paths:
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Source/WebKit/WebProcess/Plugins/PluginView.cpp
    M Source/WebKit/WebProcess/Plugins/PluginView.h
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

  Log Message:
  -----------
  [UnifiedPDF] [iOS] Text selection should clear when tapping outside of the 
selection
https://bugs.webkit.org/show_bug.cgi?id=284604
rdar://141325055

Reviewed by Abrar Rahman Protyasha.

Clear the selection when tapping outside of the current selection, when unified 
PDF is enabled. The
way this works in normal web content is that we'll clear the selection by 
default if the synthetic
tap gesture is not handled — however, on iOS, tapping over the full-document 
`embed` (i.e. a
platform `Widget`) causes us to always handle the mouse press event resulting 
from the synthetic
click. Account for this by adding logic to call into the plugin view to dismiss 
the selection, when
this happens.

When tapping over the selection highlight, existing logic inside 
`-_shouldToggleEditMenuAfterTapAt:`
will prevent the synthetic click from committing altogether, thereby allowing 
the system text
interaction to toggle the edit menu.

* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::clearSelection):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::setCurrentSelection):
(WebKit::UnifiedPDFPlugin::clearSelection):

Add plumbing to clear the selection on the PDF plugin.

(WebKit::UnifiedPDFPlugin::platformPopulateEditorStateIfNeeded const):

Make a small adjustment here to ensure that when the selection is null, we 
still send a valid
(i.e. "post-layout") editor state. This is necessary to ensure that we'll 
actually tell UIKit to
update the selection, rather than wait for the next editor state with 
post-layout data.

* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::clearSelection):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::commitPotentialTap):
(WebKit::WebPage::clearSelectionAfterTapIfNeeded):
(WebKit::WebPage::clearSelection):

Defer to the focused frame's plugin in several places, to clear the PDF's text 
selection.

Canonical link: https://commits.webkit.org/287791@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to