Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e51baa87492f4d1d2fdefc0b7ca765772252b671
      
https://github.com/WebKit/WebKit/commit/e51baa87492f4d1d2fdefc0b7ca765772252b671
  Author: Aditya Keerthi <[email protected]>
  Date:   2025-05-05 (Mon, 05 May 2025)

  Changed paths:
    M Source/WebCore/PAL/pal/spi/mac/NSMenuSPI.h
    M Source/WebCore/en.lproj/Localizable.strings
    M Source/WebCore/page/ContextMenuController.cpp
    M Source/WebCore/platform/ContextMenuItem.cpp
    M Source/WebCore/platform/ContextMenuItem.h
    M Source/WebCore/platform/LocalizedStrings.cpp
    M Source/WebCore/platform/LocalizedStrings.h
    M Source/WebKit/Platform/mac/MenuUtilities.mm
    M Source/WebKit/Shared/API/c/WKContextMenuItemTypes.h
    M Source/WebKit/Shared/API/c/WKSharedAPICast.h
    M Source/WebKit/UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm
    M Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm

  Log Message:
  -----------
  [macOS][Writing Tools] Add support for top-level context menu items
https://bugs.webkit.org/show_bug.cgi?id=292546
rdar://149953289

Reviewed by Abrar Rahman Protyasha.

Add "Summarize", "Rewrite", and "Proofread" context menu items. Additionally,
the "Writing Tools" menu item is renamed to "Show Writing Tools", and no longer
has a submenu.

Update tests and remove unnecessary staging code.

* Source/WebCore/PAL/pal/spi/mac/NSMenuSPI.h:

Remove staging code, and an `#elif` branch that is never compiled since its
condition is the same as the `#if`.

* Source/WebCore/en.lproj/Localizable.strings:
* Source/WebCore/page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
(WebCore::ContextMenuController::populate):

"Summarize" is added for non-editable text. "Rewrite" and "Proofread" are added
for non-empty editable text.

(WebCore::ContextMenuController::checkOrEnableIfNeeded const):
* Source/WebCore/platform/ContextMenuItem.cpp:
(WebCore::isValidContextMenuAction):
* Source/WebCore/platform/ContextMenuItem.h:
* Source/WebCore/platform/LocalizedStrings.cpp:
(WebCore::contextMenuItemTagWritingTools):
(WebCore::contextMenuItemTagProofread):
(WebCore::contextMenuItemTagRewrite):
(WebCore::contextMenuItemTagSummarize):
* Source/WebCore/platform/LocalizedStrings.h:
* Source/WebKit/Platform/mac/MenuUtilities.mm:
(WebKit::symbolNameForAction):
* Source/WebKit/Shared/API/c/WKContextMenuItemTypes.h:
* Source/WebKit/Shared/API/c/WKSharedAPICast.h:
(WebKit::toAPI):
(WebKit::toImpl):
* Source/WebKit/UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm:
* Source/WebKit/UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::contextMenuItemSelected):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::menuItemIdentifier):
(WebKit::WebContextMenuProxyMac::getContextMenuFromItems):
(WebKit::WebContextMenuProxyMac::getContextMenuItem):

Remove staging code.

* Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::handleContextMenuWritingTools):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WritingTools.mm:

Update tests for the new behavior. Additionally, use a helper method to perform
the right click, and update the coordinates to right click over the element.

(TEST(WritingTools, APIWithBehaviorNone)):
(TEST(WritingTools, APIWithBehaviorDefault)):
(TEST(WritingTools, APIWithBehaviorComplete)):
(TEST(WritingTools, ContextMenuItemsNonEditable)):
(TEST(WritingTools, ContextMenuItemsEditable)):
(TEST(WritingTools, ContextMenuItemsEditableEmpty)):

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