Diff
Modified: trunk/Source/WebKit/ChangeLog (291252 => 291253)
--- trunk/Source/WebKit/ChangeLog 2022-03-14 21:59:31 UTC (rev 291252)
+++ trunk/Source/WebKit/ChangeLog 2022-03-14 22:02:04 UTC (rev 291253)
@@ -1,3 +1,22 @@
+2022-03-14 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [Mail Compose] Spelling and grammar context menu items need custom identifiers
+ https://bugs.webkit.org/show_bug.cgi?id=237804
+ rdar://90124049
+
+ Reviewed by Aditya Keerthi.
+
+ Introduce several new context menu item identifier strings that correspond to the default spelling and grammar
+ menu items that appear when showing the context menu for editable content, such that Mail can replace or
+ customize behaviors around these items in compose, via WKUIDelegate.
+
+ Test: ContextMenuTests.ProposedMenuContainsSpellingMenu
+
+ * UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm:
+ * UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h:
+ * UIProcess/mac/WebContextMenuProxyMac.mm:
+ (WebKit::menuItemIdentifier):
+
2022-03-14 Antoine Quint <grao...@webkit.org>
[model] <model interactive> doesn't allow model to be rotated on iOS
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm (291252 => 291253)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm 2022-03-14 21:59:31 UTC (rev 291252)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKMenuItemIdentifiers.mm 2022-03-14 22:02:04 UTC (rev 291253)
@@ -58,3 +58,9 @@
NSString * const _WKMenuItemIdentifierTranslate = @"WKMenuItemIdentifierTranslate";
NSString * const _WKMenuItemIdentifierCopyCroppedImage = @"WKMenuItemIdentifierCopyCroppedImage";
+
+NSString * const _WKMenuItemIdentifierSpellingMenu = @"WKMenuItemIdentifierSpellingMenu";
+NSString * const _WKMenuItemIdentifierShowSpellingPanel = @"WKMenuItemIdentifierShowSpellingPanel";
+NSString * const _WKMenuItemIdentifierCheckSpelling = @"WKMenuItemIdentifierCheckSpelling";
+NSString * const _WKMenuItemIdentifierCheckSpellingWhileTyping = @"WKMenuItemIdentifierCheckSpellingWhileTyping";
+NSString * const _WKMenuItemIdentifierCheckGrammarWithSpelling = @"WKMenuItemIdentifierCheckGrammarWithSpelling";
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h (291252 => 291253)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h 2022-03-14 21:59:31 UTC (rev 291252)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKMenuItemIdentifiersPrivate.h 2022-03-14 22:02:04 UTC (rev 291253)
@@ -60,3 +60,9 @@
WK_EXPORT extern NSString * const _WKMenuItemIdentifierTranslate WK_API_AVAILABLE(macos(12.0), ios(15.0));
WK_EXPORT extern NSString * const _WKMenuItemIdentifierCopyCroppedImage WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
+WK_EXPORT extern NSString * const _WKMenuItemIdentifierSpellingMenu WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+WK_EXPORT extern NSString * const _WKMenuItemIdentifierShowSpellingPanel WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+WK_EXPORT extern NSString * const _WKMenuItemIdentifierCheckSpelling WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+WK_EXPORT extern NSString * const _WKMenuItemIdentifierCheckSpellingWhileTyping WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+WK_EXPORT extern NSString * const _WKMenuItemIdentifierCheckGrammarWithSpelling WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
Modified: trunk/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm (291252 => 291253)
--- trunk/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm 2022-03-14 21:59:31 UTC (rev 291252)
+++ trunk/Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm 2022-03-14 22:02:04 UTC (rev 291253)
@@ -545,6 +545,21 @@
case ContextMenuItemTagSpeechMenu:
return _WKMenuItemIdentifierSpeechMenu;
+ case ContextMenuItemTagSpellingMenu:
+ return _WKMenuItemIdentifierSpellingMenu;
+
+ case ContextMenuItemTagShowSpellingPanel:
+ return _WKMenuItemIdentifierShowSpellingPanel;
+
+ case ContextMenuItemTagCheckSpelling:
+ return _WKMenuItemIdentifierCheckSpelling;
+
+ case ContextMenuItemTagCheckSpellingWhileTyping:
+ return _WKMenuItemIdentifierCheckSpellingWhileTyping;
+
+ case ContextMenuItemTagCheckGrammarWithSpelling:
+ return _WKMenuItemIdentifierCheckGrammarWithSpelling;
+
default:
return nil;
}
Modified: trunk/Tools/ChangeLog (291252 => 291253)
--- trunk/Tools/ChangeLog 2022-03-14 21:59:31 UTC (rev 291252)
+++ trunk/Tools/ChangeLog 2022-03-14 22:02:04 UTC (rev 291253)
@@ -1,3 +1,18 @@
+2022-03-14 Wenson Hsieh <wenson_hs...@apple.com>
+
+ [Mail Compose] Spelling and grammar context menu items need custom identifiers
+ https://bugs.webkit.org/show_bug.cgi?id=237804
+ rdar://90124049
+
+ Reviewed by Aditya Keerthi.
+
+ Add a new API test to exercise the new identifiers.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/mac/ContextMenuTests.mm: Added.
+ (-[NSMenu itemWithIdentifier:]):
+ (TestWebKitAPI::TEST):
+
2022-03-10 Jonathan Bedard <jbed...@apple.com>
[EWS] Clean up PR branches and remotes
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (291252 => 291253)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2022-03-14 21:59:31 UTC (rev 291252)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2022-03-14 22:02:04 UTC (rev 291253)
@@ -1080,6 +1080,7 @@
F46128B7211C8ED500D9FADB /* DragAndDropSimulatorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46128B6211C8ED500D9FADB /* DragAndDropSimulatorMac.mm */; };
F46128CB211D475100D9FADB /* TestDraggingInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46128CA211D475100D9FADB /* TestDraggingInfo.mm */; };
F46128D4211E40FD00D9FADB /* link-in-iframe-and-input.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F46128D1211E2D2500D9FADB /* link-in-iframe-and-input.html */; };
+ F4613F1D27DC2EDD007CCDE6 /* ContextMenuTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4613F1C27DC2EDD007CCDE6 /* ContextMenuTests.mm */; };
F464AF9220BB66EA007F9B18 /* RenderingProgressTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F464AF9120BB66EA007F9B18 /* RenderingProgressTests.mm */; };
F46849BE1EEF58E400B937FE /* UIPasteboardTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46849BD1EEF58E400B937FE /* UIPasteboardTests.mm */; };
F46849C01EEF5EF300B937FE /* rich-and-plain-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F46849BF1EEF5EDC00B937FE /* rich-and-plain-text.html */; };
@@ -3101,6 +3102,7 @@
F46128D1211E2D2500D9FADB /* link-in-iframe-and-input.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "link-in-iframe-and-input.html"; sourceTree = "<group>"; };
F46128D6211E489C00D9FADB /* DragAndDropTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = DragAndDropTests.mm; sourceTree = "<group>"; };
F46128D8211E496300D9FADB /* full-page-dropzone.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "full-page-dropzone.html"; sourceTree = "<group>"; };
+ F4613F1C27DC2EDD007CCDE6 /* ContextMenuTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuTests.mm; sourceTree = "<group>"; };
F464AF9120BB66EA007F9B18 /* RenderingProgressTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderingProgressTests.mm; sourceTree = "<group>"; };
F46849BD1EEF58E400B937FE /* UIPasteboardTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = UIPasteboardTests.mm; sourceTree = "<group>"; };
F46849BF1EEF5EDC00B937FE /* rich-and-plain-text.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "rich-and-plain-text.html"; sourceTree = "<group>"; };
@@ -4886,6 +4888,7 @@
A1146A8A1D2D704F000FE710 /* ContentFiltering.mm */,
5142B2701517C88B00C32B19 /* ContextMenuCanCopyURL.mm */,
37FB72951DB2E82F00E41BE4 /* ContextMenuDefaultItemsHaveTags.mm */,
+ F4613F1C27DC2EDD007CCDE6 /* ContextMenuTests.mm */,
7AEAD47C1E20113800416EFE /* CrossPartitionFileSchemeAccess.mm */,
E5AA8D1C25151CC60051CC45 /* DateInputTests.mm */,
939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */,
@@ -5564,6 +5567,7 @@
8349D3C21DB96DDE004A9F65 /* ContextMenuDownload.mm in Sources */,
CD0BD0A61F79924D001AB2CF /* ContextMenuImgWithVideo.mm in Sources */,
A1C142C224AA7B2E00444207 /* ContextMenuMouseEvents.mm in Sources */,
+ F4613F1D27DC2EDD007CCDE6 /* ContextMenuTests.mm in Sources */,
F4034FA1275D5402003A81F8 /* CookieConsent.mm in Sources */,
510A667B27D301AC00D22629 /* CoreMediaUtilities.mm in Sources */,
7CCE7EAC1A411A3400447C4C /* Counters.cpp in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/mac/ContextMenuTests.mm (0 => 291253)
--- trunk/Tools/TestWebKitAPI/Tests/mac/ContextMenuTests.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/ContextMenuTests.mm 2022-03-14 22:02:04 UTC (rev 291253)
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "Test.h"
+
+#if PLATFORM(MAC)
+
+#import "TestUIDelegate.h"
+#import "TestWKWebView.h"
+#import "Utilities.h"
+#import <WebKit/WKMenuItemIdentifiersPrivate.h>
+#import <WebKit/WKUIDelegatePrivate.h>
+
+@interface NSMenu (ContextMenuTests)
+- (NSMenuItem *)itemWithIdentifier:(NSString *)identifier;
+@end
+
+@implementation NSMenu (ContextMenuTests)
+
+- (NSMenuItem *)itemWithIdentifier:(NSString *)identifier
+{
+ for (NSInteger index = 0; index < self.numberOfItems; ++index) {
+ NSMenuItem *item = [self itemAtIndex:index];
+ if ([item.identifier isEqualToString:identifier])
+ return item;
+ }
+ return nil;
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(ContextMenuTests, ProposedMenuContainsSpellingMenu)
+{
+ auto delegate = adoptNS([[TestUIDelegate alloc] init]);
+
+ __block RetainPtr<NSMenu> proposedMenu;
+ __block bool gotProposedMenu = false;
+ [delegate setGetContextMenuFromProposedMenu:^(NSMenu *menu, _WKContextMenuElementInfo *, id<NSSecureCoding>, void (^completion)(NSMenu *)) {
+ proposedMenu = menu;
+ completion(nil);
+ gotProposedMenu = true;
+ }];
+
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 400, 400)]);
+ [webView setUIDelegate:delegate.get()];
+ [webView _setEditable:YES];
+ [webView synchronouslyLoadTestPageNamed:@"simple"];
+ [webView mouseDownAtPoint:NSMakePoint(10, 10) simulatePressure:NO withFlags:0 eventType:NSEventTypeRightMouseDown];
+ [webView mouseUpAtPoint:NSMakePoint(10, 10) withFlags:0 eventType:NSEventTypeRightMouseUp];
+ Util::run(&gotProposedMenu);
+
+ NSMenuItem *spellingMenuItem = [proposedMenu itemWithIdentifier:_WKMenuItemIdentifierSpellingMenu];
+ NSMenu *spellingSubmenu = spellingMenuItem.submenu;
+ EXPECT_NOT_NULL(spellingMenuItem);
+ EXPECT_NOT_NULL([spellingSubmenu itemWithIdentifier:_WKMenuItemIdentifierShowSpellingPanel]);
+ EXPECT_NOT_NULL([spellingSubmenu itemWithIdentifier:_WKMenuItemIdentifierCheckSpelling]);
+ EXPECT_NOT_NULL([spellingSubmenu itemWithIdentifier:_WKMenuItemIdentifierCheckSpellingWhileTyping]);
+ EXPECT_NOT_NULL([spellingSubmenu itemWithIdentifier:_WKMenuItemIdentifierCheckGrammarWithSpelling]);
+}
+
+} // namespace TestWebKitAPI
+
+#endif // PLATFORM(MAC)