Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 58e49293f4769eeeed2a72d5694e5a080f8c02a2
      
https://github.com/WebKit/WebKit/commit/58e49293f4769eeeed2a72d5694e5a080f8c02a2
  Author: Abrar Rahman Protyasha <[email protected]>
  Date:   2024-12-18 (Wed, 18 Dec 2024)

  Changed paths:
    M Source/WebKit/Shared/EditorState.cpp
    M Source/WebKit/Shared/EditorState.h
    M Source/WebKit/Shared/EditorState.serialization.in
    M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
    M Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm
    M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm

  Log Message:
  -----------
  [UnifiedPDF] [iOS] Do not offer Writing Tools as a context menu action on 
text selections
https://bugs.webkit.org/show_bug.cgi?id=284782
rdar://141568926

Reviewed by Aditya Keerthi.

The requisite WritingToolsController machinery for the Writing Tools
flow with text selections in the PDF plugin is not available yet. As
such, the Writing Tools context menu action is currently not usable.

This patch opts to disable the Writing Tools action - virtue of
WritingToolsBehaviorNone - when the active selection came from a plugin.
We will walk back this behavior once we fully support Writing Tools for
text selections in the PDF plugin, c.f. rdar://141604977.

To signal "when the active selection came from a plugin", we make the
`isInPlugin` field of `EditorState` platform agnostic, and set the flag
to true whenever we have a non-null text selection in the PDF plugin.

Tests: WritingTools.PDFTextSelections

* Source/WebKit/Shared/EditorState.cpp:
(WebKit::operator<<):
* Source/WebKit/Shared/EditorState.h:
* Source/WebKit/Shared/EditorState.serialization.in:
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::writingToolsBehavior const):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm:
(WebKit::PDFPluginBase::populateEditorStateIfNeeded const):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::handleEditingCommand):
(WebKit::UnifiedPDFPlugin::isEditingCommandEnabled):
  Drive-by fix to make editing command handling case agnostic. Without
  this fix, we drop the `SelectAll` editing command on the floor when
  using `selectAll:` in the added test.

(WebKit::UnifiedPDFPlugin::platformPopulateEditorStateIfNeeded const):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm:
(TEST(WritingTools, PDFTextSelections)):

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