Title: [261320] trunk
Revision
261320
Author
[email protected]
Date
2020-05-07 11:37:33 -0700 (Thu, 07 May 2020)

Log Message

Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code
https://bugs.webkit.org/show_bug.cgi?id=211525

Reviewed by Anders Carlsson.

Source/WebCore:

* editing/mac/TextUndoInsertionMarkupMac.h: Remove
NSTextInputContext_Private.h usage. Moving to NSTextInputContextSPI.h
instead. Also remove #pragma once since this is an Objective-C-only
header, not for cross-platform use.

* editing/mac/TextUndoInsertionMarkupMac.mm: Above, plus move
NSUndoManager_Private.h to NSUndoManagerSPI.h.

Source/WebCore/PAL:

* PAL.xcodeproj/project.pbxproj: Added NSTextInputContextSPI.h and NSUndoManagerSPI.h.
* pal/PlatformMac.cmake: Ditto.
* pal/spi/mac/NSTextInputContextSPI.h: Added.
* pal/spi/mac/NSUndoManagerSPI.h: Added.

Source/WebKit:

* UIProcess/Cocoa/WebViewImpl.mm: Use NSTextInputContextSPI.h.
(WebKit::WebViewImpl::validAttributesForMarkedText): Removed
USE(INSERTION_UNDO_GROUPING) from the macOS-specific code here.
(WebKit::WebViewImpl::insertText): Ditto.
* UIProcess/PageClient.h: Ditto.
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::registerInsertionUndoGrouping): Deleted.
This function is not needed at all on iOS.
* UIProcess/mac/PageClientImplMac.h: Removed USE(INSERTION_UNDO_GROUPING).
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::registerInsertionUndoGrouping): Ditto.

Source/WebKitLegacy/mac:

* WebView/WebHTMLView.mm: Use NSTextInputContextSPI.h.
(-[WebHTMLView validAttributesForMarkedText]): Removed USE(INSERTION_UNDO_GROUPING).
(-[WebHTMLView insertText:]): Ditto.

Tools:

* DumpRenderTree/mac/TextInputControllerMac.m: Use NSTextInputContextSPI.h.
(-[TextInputController stringWithUndoGroupingInsertion:]): Removed
SUPPORT_INSERTION_UNDO_GROUPING.
* DumpRenderTree/mac/UIScriptControllerMac.mm: Use NSTextInputContextSPI.h.
* TestRunnerShared/spi/AppKitTestSPI.h: Removed
NSTextInputContext_Private.h, clients can use NSTextInputContextSPI.h.
* TestWebKitAPI/Tests/TestWebKitAPI/mac/AppKitSPI.h: Ditto.
* TestWebKitAPI/Tests/mac/CandidateTests.mm: Use NSTextInputContextSPI.h.
* TestWebKitAPI/Tests/mac/WKWebViewMacEditingTests.mm: Ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261319 => 261320)


--- trunk/Source/WebCore/ChangeLog	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebCore/ChangeLog	2020-05-07 18:37:33 UTC (rev 261320)
@@ -1,3 +1,18 @@
+2020-05-07  Darin Adler  <[email protected]>
+
+        Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code
+        https://bugs.webkit.org/show_bug.cgi?id=211525
+
+        Reviewed by Anders Carlsson.
+
+        * editing/mac/TextUndoInsertionMarkupMac.h: Remove
+        NSTextInputContext_Private.h usage. Moving to NSTextInputContextSPI.h
+        instead. Also remove #pragma once since this is an Objective-C-only
+        header, not for cross-platform use.
+
+        * editing/mac/TextUndoInsertionMarkupMac.mm: Above, plus move
+        NSUndoManager_Private.h to NSUndoManagerSPI.h.
+
 2020-05-07  Sergio Villar Senin  <[email protected]>
 
         [Conditional=] not working for operations in WebGLRenderingContextBase.idl

Modified: trunk/Source/WebCore/PAL/ChangeLog (261319 => 261320)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-05-07 18:37:33 UTC (rev 261320)
@@ -1,3 +1,15 @@
+2020-05-07  Darin Adler  <[email protected]>
+
+        Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code
+        https://bugs.webkit.org/show_bug.cgi?id=211525
+
+        Reviewed by Anders Carlsson.
+
+        * PAL.xcodeproj/project.pbxproj: Added NSTextInputContextSPI.h and NSUndoManagerSPI.h.
+        * pal/PlatformMac.cmake: Ditto.
+        * pal/spi/mac/NSTextInputContextSPI.h: Added.
+        * pal/spi/mac/NSUndoManagerSPI.h: Added.
+
 2020-05-05  Chris Dumez  <[email protected]>
 
         Drop code path using the legacy CFNetwork cookie change notification SPI

Modified: trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj (261319 => 261320)


--- trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj	2020-05-07 18:37:33 UTC (rev 261320)
@@ -136,6 +136,8 @@
 		63C7EDC721AFAE04006A7B99 /* NSProgressSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 63E369F921AFA83F001C14BC /* NSProgressSPI.h */; };
 		7A36D0F9223AD9AB00B0522E /* CommonCryptoSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A36D0F8223AD9AB00B0522E /* CommonCryptoSPI.h */; };
 		7A3A6A8020CADB4700317AAE /* NSImageSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A3A6A7F20CADB4600317AAE /* NSImageSPI.h */; };
+		93DB7D3724626BCD004BD8A3 /* NSTextInputContextSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 93DB7D3624626BCC004BD8A3 /* NSTextInputContextSPI.h */; };
+		93DB7D3A24626F86004BD8A3 /* NSUndoManagerSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 93DB7D3924626F86004BD8A3 /* NSUndoManagerSPI.h */; };
 		A10265891F56747A00B4C844 /* HIToolboxSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10265881F56747A00B4C844 /* HIToolboxSPI.h */; };
 		A102658E1F567E9D00B4C844 /* HIServicesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A102658D1F567E9D00B4C844 /* HIServicesSPI.h */; };
 		A10826F11F573BCA004772AC /* NSResponderSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = A10826F01F573BCA004772AC /* NSResponderSPI.h */; };
@@ -315,6 +317,8 @@
 		63E369F921AFA83F001C14BC /* NSProgressSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSProgressSPI.h; sourceTree = "<group>"; };
 		7A36D0F8223AD9AB00B0522E /* CommonCryptoSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonCryptoSPI.h; sourceTree = "<group>"; };
 		7A3A6A7F20CADB4600317AAE /* NSImageSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSImageSPI.h; sourceTree = "<group>"; };
+		93DB7D3624626BCC004BD8A3 /* NSTextInputContextSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSTextInputContextSPI.h; sourceTree = "<group>"; };
+		93DB7D3924626F86004BD8A3 /* NSUndoManagerSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSUndoManagerSPI.h; sourceTree = "<group>"; };
 		93E5909C1F93BF1E0067F8CF /* UnencodableHandling.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UnencodableHandling.h; sourceTree = "<group>"; };
 		A10265881F56747A00B4C844 /* HIToolboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HIToolboxSPI.h; sourceTree = "<group>"; };
 		A102658D1F567E9D00B4C844 /* HIServicesSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HIServicesSPI.h; sourceTree = "<group>"; };
@@ -522,6 +526,8 @@
 				0C7785801F45130F00F4EBB6 /* NSSharingServiceSPI.h */,
 				0C7785811F45130F00F4EBB6 /* NSSpellCheckerSPI.h */,
 				0C7785821F45130F00F4EBB6 /* NSTextFinderSPI.h */,
+				93DB7D3624626BCC004BD8A3 /* NSTextInputContextSPI.h */,
+				93DB7D3924626F86004BD8A3 /* NSUndoManagerSPI.h */,
 				0C7785831F45130F00F4EBB6 /* NSViewSPI.h */,
 				0C7785841F45130F00F4EBB6 /* NSWindowSPI.h */,
 				0C7785851F45130F00F4EBB6 /* PIPSPI.h */,
@@ -817,7 +823,9 @@
 				0C77859A1F45130F00F4EBB6 /* NSSpellCheckerSPI.h in Headers */,
 				0C2DA1501F3BEB4900DBC317 /* NSStringSPI.h in Headers */,
 				0C77859B1F45130F00F4EBB6 /* NSTextFinderSPI.h in Headers */,
+				93DB7D3724626BCD004BD8A3 /* NSTextInputContextSPI.h in Headers */,
 				0C2DA1511F3BEB4900DBC317 /* NSTouchBarSPI.h in Headers */,
+				93DB7D3A24626F86004BD8A3 /* NSUndoManagerSPI.h in Headers */,
 				0C2DA1521F3BEB4900DBC317 /* NSURLConnectionSPI.h in Headers */,
 				0C2DA1531F3BEB4900DBC317 /* NSURLDownloadSPI.h in Headers */,
 				0C2DA1541F3BEB4900DBC317 /* NSURLFileTypeMappingsSPI.h in Headers */,

Modified: trunk/Source/WebCore/PAL/pal/PlatformMac.cmake (261319 => 261320)


--- trunk/Source/WebCore/PAL/pal/PlatformMac.cmake	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebCore/PAL/pal/PlatformMac.cmake	2020-05-07 18:37:33 UTC (rev 261320)
@@ -94,6 +94,8 @@
     spi/mac/NSSharingServiceSPI.h
     spi/mac/NSSpellCheckerSPI.h
     spi/mac/NSTextFinderSPI.h
+    spi/mac/NSTextInputContextSPI.h
+    spi/mac/NSUndoManagerSPI.h
     spi/mac/NSViewSPI.h
     spi/mac/NSWindowSPI.h
     spi/mac/PIPSPI.h

Copied: trunk/Source/WebCore/PAL/pal/spi/mac/NSTextInputContextSPI.h (from rev 261319, trunk/Tools/TestRunnerShared/spi/AppKitTestSPI.h) (0 => 261320)


--- trunk/Source/WebCore/PAL/pal/spi/mac/NSTextInputContextSPI.h	                        (rev 0)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/NSTextInputContextSPI.h	2020-05-07 18:37:33 UTC (rev 261320)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#if PLATFORM(MAC)
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <AppKit/NSTextInputContext_Private.h>
+
+#else
+
+@interface NSTextInputContext ()
+- (void)handleEvent:(NSEvent *)event completionHandler:(void(^)(BOOL handled))completionHandler;
+- (void)handleEventByInputMethod:(NSEvent *)event completionHandler:(void(^)(BOOL handled))completionHandler;
+- (BOOL)handleEventByKeyboardLayout:(NSEvent *)event;
+@end
+
+#endif
+
+APPKIT_EXTERN NSString *NSTextInsertionUndoableAttributeName;
+APPKIT_EXTERN NSString *NSTextInputReplacementRangeAttributeName;
+
+#endif // PLATFORM(MAC)

Copied: trunk/Source/WebCore/PAL/pal/spi/mac/NSUndoManagerSPI.h (from rev 261319, trunk/Tools/TestRunnerShared/spi/AppKitTestSPI.h) (0 => 261320)


--- trunk/Source/WebCore/PAL/pal/spi/mac/NSUndoManagerSPI.h	                        (rev 0)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/NSUndoManagerSPI.h	2020-05-07 18:37:33 UTC (rev 261320)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#if PLATFORM(MAC)
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <Foundation/NSUndoManager_Private.h>
+
+#else
+
+@interface NSUndoManager ()
+- (void)_processEndOfEventNotification:(id)arg;
+@end
+
+#endif
+
+#endif // PLATFORM(MAC)

Modified: trunk/Source/WebCore/editing/mac/TextUndoInsertionMarkupMac.h (261319 => 261320)


--- trunk/Source/WebCore/editing/mac/TextUndoInsertionMarkupMac.h	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebCore/editing/mac/TextUndoInsertionMarkupMac.h	2020-05-07 18:37:33 UTC (rev 261320)
@@ -23,23 +23,13 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#pragma once
-
 #if USE(INSERTION_UNDO_GROUPING)
 
-#if USE(APPLE_INTERNAL_SDK)
-#import <AppKit/NSTextInputContext_Private.h>
-#else
-extern "C" NSString *NSTextInsertionUndoableAttributeName;
-#endif
+namespace WebCore {
+    
+WEBCORE_EXPORT bool shouldRegisterInsertionUndoGroup(NSAttributedString *);
+WEBCORE_EXPORT void registerInsertionUndoGroupingWithUndoManager(NSUndoManager *);
 
-#endif // USE(INSERTION_UNDO_GROUPING)
+} // namespace WebCore
 
-namespace WebCore {
-    
-#if USE(INSERTION_UNDO_GROUPING)
-WEBCORE_EXPORT bool shouldRegisterInsertionUndoGroup(NSAttributedString*);
-WEBCORE_EXPORT void registerInsertionUndoGroupingWithUndoManager(NSUndoManager*);
 #endif
-    
-} // namespace WebCore

Modified: trunk/Source/WebCore/editing/mac/TextUndoInsertionMarkupMac.mm (261319 => 261320)


--- trunk/Source/WebCore/editing/mac/TextUndoInsertionMarkupMac.mm	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebCore/editing/mac/TextUndoInsertionMarkupMac.mm	2020-05-07 18:37:33 UTC (rev 261320)
@@ -26,29 +26,24 @@
 #import "config.h"
 #import "TextUndoInsertionMarkupMac.h"
 
-#if USE(APPLE_INTERNAL_SDK)
-#import <Foundation/NSUndoManager_Private.h>
-#else
-@interface NSUndoManager (WebCorePrivate)
-- (void)_processEndOfEventNotification:(id)arg;
-@end
-#endif
+#if USE(INSERTION_UNDO_GROUPING)
 
+#import <pal/spi/mac/NSTextInputContextSPI.h>
+#import <pal/spi/mac/NSUndoManagerSPI.h>
+
 namespace WebCore {
     
-#if USE(INSERTION_UNDO_GROUPING)
-
-bool shouldRegisterInsertionUndoGroup(NSAttributedString* string)
+bool shouldRegisterInsertionUndoGroup(NSAttributedString *string)
 {
     return [string attribute:NSTextInsertionUndoableAttributeName atIndex:0 effectiveRange:nil];
 }
     
-void registerInsertionUndoGroupingWithUndoManager(NSUndoManager* undoManager)
+void registerInsertionUndoGroupingWithUndoManager(NSUndoManager *undoManager)
 {
     if ([undoManager groupingLevel])
         [undoManager _processEndOfEventNotification:nil];
 }
     
+}
+
 #endif
-
-}

Modified: trunk/Source/WebKit/ChangeLog (261319 => 261320)


--- trunk/Source/WebKit/ChangeLog	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebKit/ChangeLog	2020-05-07 18:37:33 UTC (rev 261320)
@@ -1,3 +1,22 @@
+2020-05-07  Darin Adler  <[email protected]>
+
+        Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code
+        https://bugs.webkit.org/show_bug.cgi?id=211525
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/Cocoa/WebViewImpl.mm: Use NSTextInputContextSPI.h.
+        (WebKit::WebViewImpl::validAttributesForMarkedText): Removed
+        USE(INSERTION_UNDO_GROUPING) from the macOS-specific code here.
+        (WebKit::WebViewImpl::insertText): Ditto.
+        * UIProcess/PageClient.h: Ditto.
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::registerInsertionUndoGrouping): Deleted.
+        This function is not needed at all on iOS.
+        * UIProcess/mac/PageClientImplMac.h: Removed USE(INSERTION_UNDO_GROUPING).
+        * UIProcess/mac/PageClientImplMac.mm:
+        (WebKit::PageClientImpl::registerInsertionUndoGrouping): Ditto.
+
 2020-05-07  Chris Dumez  <[email protected]>
 
         Drop dead platformPrepareToSuspend / platformProcessDidResume in NetworkProcess

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (261319 => 261320)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2020-05-07 18:37:33 UTC (rev 261320)
@@ -116,6 +116,7 @@
 #import <pal/spi/mac/NSScrollerImpSPI.h>
 #import <pal/spi/mac/NSSpellCheckerSPI.h>
 #import <pal/spi/mac/NSTextFinderSPI.h>
+#import <pal/spi/mac/NSTextInputContextSPI.h>
 #import <pal/spi/mac/NSViewSPI.h>
 #import <pal/spi/mac/NSWindowSPI.h>
 #import <sys/stat.h>
@@ -145,13 +146,6 @@
 - (void)stopSpeaking:(id)sender;
 @end
 
-// FIXME: Move to an SPI header.
-@interface NSTextInputContext (WKNSTextInputContextDetails)
-- (void)handleEvent:(NSEvent *)event completionHandler:(void(^)(BOOL handled))completionHandler;
-- (void)handleEventByInputMethod:(NSEvent *)event completionHandler:(void(^)(BOOL handled))completionHandler;
-- (BOOL)handleEventByKeyboardLayout:(NSEvent *)event;
-@end
-
 #if HAVE(TOUCH_BAR) && ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
 // FIXME: Remove this once -setCanShowMediaSelectionButton: is declared in an SDK used by Apple's buildbot.
 @interface AVTouchBarScrubber ()
@@ -4708,9 +4702,7 @@
             NSUnderlineColorAttributeName,
             NSMarkedClauseSegmentAttributeName,
             NSTextAlternativesAttributeName,
-#if USE(INSERTION_UNDO_GROUPING)
             NSTextInsertionUndoableAttributeName,
-#endif
         ];
         // NSText also supports the following attributes, but it's
         // hard to tell which are really required for text input to
@@ -4847,9 +4839,7 @@
     bool registerUndoGroup = false;
     if (isAttributedString) {
         WebCore::collectDictationTextAlternatives(string, dictationAlternatives);
-#if USE(INSERTION_UNDO_GROUPING)
         registerUndoGroup = WebCore::shouldRegisterInsertionUndoGroup(string);
-#endif
         // FIXME: We ignore most attributes from the string, so for example inserting from Character Palette loses font and glyph variation data.
         text = [string string];
     } else

Modified: trunk/Source/WebKit/UIProcess/PageClient.h (261319 => 261320)


--- trunk/Source/WebKit/UIProcess/PageClient.h	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebKit/UIProcess/PageClient.h	2020-05-07 18:37:33 UTC (rev 261320)
@@ -386,9 +386,7 @@
 
     virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) = 0;
 
-#if USE(INSERTION_UNDO_GROUPING)
     virtual void registerInsertionUndoGrouping() = 0;
-#endif
 
     virtual void setEditableElementIsFocused(bool) = 0;
 #endif // PLATFORM(MAC)

Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (261319 => 261320)


--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2020-05-07 18:37:33 UTC (rev 261320)
@@ -336,13 +336,6 @@
         [undoManager setActionName:(NSString *)actionName];
 }
 
-#if USE(INSERTION_UNDO_GROUPING)
-void PageClientImpl::registerInsertionUndoGrouping()
-{
-    notImplemented();
-}
-#endif
-
 void PageClientImpl::clearAllEditCommands()
 {
     [[m_contentView undoManager] removeAllActionsWithTarget:m_undoTarget.get()];

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h (261319 => 261320)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.h	2020-05-07 18:37:33 UTC (rev 261320)
@@ -184,9 +184,7 @@
 
     void setEditableElementIsFocused(bool) override;
 
-#if USE(INSERTION_UNDO_GROUPING)
     void registerInsertionUndoGrouping() override;
-#endif
 
     // Auxiliary Client Creation
 #if ENABLE(FULLSCREEN_API)

Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm (261319 => 261320)


--- trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImplMac.mm	2020-05-07 18:37:33 UTC (rev 261320)
@@ -341,12 +341,10 @@
     m_impl->registerEditCommand(WTFMove(command), undoOrRedo);
 }
 
-#if USE(INSERTION_UNDO_GROUPING)
 void PageClientImpl::registerInsertionUndoGrouping()
 {
     registerInsertionUndoGroupingWithUndoManager([m_view undoManager]);
 }
-#endif
 
 void PageClientImpl::clearAllEditCommands()
 {

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (261319 => 261320)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-05-07 18:37:33 UTC (rev 261320)
@@ -1,3 +1,14 @@
+2020-05-07  Darin Adler  <[email protected]>
+
+        Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code
+        https://bugs.webkit.org/show_bug.cgi?id=211525
+
+        Reviewed by Anders Carlsson.
+
+        * WebView/WebHTMLView.mm: Use NSTextInputContextSPI.h.
+        (-[WebHTMLView validAttributesForMarkedText]): Removed USE(INSERTION_UNDO_GROUPING).
+        (-[WebHTMLView insertText:]): Ditto.
+
 2020-05-06  Darin Adler  <[email protected]>
 
         Eliminate checks of USE(DICTATION_ALTERNATIVES) in Cocoa-specific code

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (261319 => 261320)


--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm	2020-05-07 18:37:33 UTC (rev 261320)
@@ -158,6 +158,7 @@
 #import <AppKit/NSAccessibility.h>
 #import <WebCore/PlatformEventFactoryMac.h>
 #import <pal/spi/mac/NSMenuSPI.h>
+#import <pal/spi/mac/NSTextInputContextSPI.h>
 #endif
 
 #if PLATFORM(IOS_FAMILY)
@@ -718,9 +719,6 @@
         wtfCallIMP<id>(oldSetCursorForMouseLocationIMP, self, cmd, point);
 }
 
-// FIXME: Get this from <AppKit/NSTextInputContext_Private.h> using a NSTextInputContextSPI.h header instead of defining it here.
-extern "C" NSString *NSTextInputReplacementRangeAttributeName;
-
 #endif // PLATFORM(MAC)
 
 @interface NSView ()
@@ -6256,9 +6254,7 @@
         NSMarkedClauseSegmentAttributeName,
         NSTextInputReplacementRangeAttributeName,
         NSTextAlternativesAttributeName,
-#if USE(INSERTION_UNDO_GROUPING)
         NSTextInsertionUndoableAttributeName,
-#endif
         nil];
     LOG(TextInput, "validAttributesForMarkedText -> (...)");
     return validAttributes;
@@ -6636,9 +6632,7 @@
         collectDictationTextAlternatives(string, textAlternatives);
         if (!textAlternatives.isEmpty())
             [[self _webView] _getWebCoreDictationAlternatives:dictationAlternativeLocations fromTextAlternatives:textAlternatives];
-#if USE(INSERTION_UNDO_GROUPING)
         registerUndoGroup = WebCore::shouldRegisterInsertionUndoGroup(string);
-#endif
         // FIXME: We ignore most attributes from the string, so for example inserting from Character Palette loses font and glyph variation data.
         // It does not look like any input methods ever use insertText: with attributes other than NSTextInputReplacementRangeAttributeName.
         text = [string string];

Modified: trunk/Tools/ChangeLog (261319 => 261320)


--- trunk/Tools/ChangeLog	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Tools/ChangeLog	2020-05-07 18:37:33 UTC (rev 261320)
@@ -1,3 +1,20 @@
+2020-05-07  Darin Adler  <[email protected]>
+
+        Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code
+        https://bugs.webkit.org/show_bug.cgi?id=211525
+
+        Reviewed by Anders Carlsson.
+
+        * DumpRenderTree/mac/TextInputControllerMac.m: Use NSTextInputContextSPI.h.
+        (-[TextInputController stringWithUndoGroupingInsertion:]): Removed
+        SUPPORT_INSERTION_UNDO_GROUPING.
+        * DumpRenderTree/mac/UIScriptControllerMac.mm: Use NSTextInputContextSPI.h.
+        * TestRunnerShared/spi/AppKitTestSPI.h: Removed
+        NSTextInputContext_Private.h, clients can use NSTextInputContextSPI.h.
+        * TestWebKitAPI/Tests/TestWebKitAPI/mac/AppKitSPI.h: Ditto.
+        * TestWebKitAPI/Tests/mac/CandidateTests.mm: Use NSTextInputContextSPI.h.
+        * TestWebKitAPI/Tests/mac/WKWebViewMacEditingTests.mm: Ditto.
+
 2020-05-07  Aakash Jain  <[email protected]>
 
         Delete code for old commit queue

Modified: trunk/Tools/DumpRenderTree/mac/TextInputControllerMac.m (261319 => 261320)


--- trunk/Tools/DumpRenderTree/mac/TextInputControllerMac.m	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Tools/DumpRenderTree/mac/TextInputControllerMac.m	2020-05-07 18:37:33 UTC (rev 261320)
@@ -34,14 +34,6 @@
 #import "DumpRenderTreeMac.h"
 #import <AppKit/NSInputManager.h>
 #import <AppKit/NSTextAlternatives.h>
-
-#define SUPPORT_INSERTION_UNDO_GROUPING
-#if __has_include(<AppKit/NSTextInputContext_Private.h>)
-#import <AppKit/NSTextInputContext_Private.h>
-#else
-NSString *NSTextInsertionUndoableAttributeName;
-#endif
-
 #import <WebKit/WebDocument.h>
 #import <WebKit/WebFrame.h>
 #import <WebKit/WebFramePrivate.h>
@@ -51,6 +43,7 @@
 #import <WebKit/WebTypesInternal.h>
 #import <WebKit/WebView.h>
 #import <WebKit/WebViewPrivate.h>
+#import <pal/spi/mac/NSTextInputContextSPI.h>
 
 @interface TextInputController (DumpRenderTreeInputMethodHandler)
 - (BOOL)interpretKeyEvents:(NSArray *)eventArray withSender:(WebHTMLView *)sender;
@@ -455,20 +448,16 @@
     return [[[NSMutableAttributedString alloc] initWithString:@" " attributes:[webView typingAttributes]] autorelease];
 }
 
-- (NSMutableAttributedString *)attributedStringWithString:(NSString *)aString
+- (NSMutableAttributedString *)attributedStringWithString:(NSString *)string
 {
-    return [[[NSMutableAttributedString alloc] initWithString:aString] autorelease];
+    return [[[NSMutableAttributedString alloc] initWithString:string] autorelease];
 }
 
-- (NSMutableAttributedString*)stringWithUndoGroupingInsertion:(NSString*)aString
+- (NSMutableAttributedString *)stringWithUndoGroupingInsertion:(NSString *)string
 {
-#if defined(SUPPORT_INSERTION_UNDO_GROUPING)
-    NSMutableAttributedString* attributedString = [self dictatedStringWithPrimaryString:aString alternative:@"test" alternativeOffset:0 alternativeLength:1];
+    NSMutableAttributedString* attributedString = [self dictatedStringWithPrimaryString:string alternative:@"test" alternativeOffset:0 alternativeLength:1];
     [attributedString addAttribute:NSTextInsertionUndoableAttributeName value:@YES range:NSMakeRange(0, [attributedString length])];
     return attributedString;
-#else
-    return nil;
-#endif
 }
 
 - (NSMutableAttributedString*)dictatedStringWithPrimaryString:(NSString*)aString alternative:(NSString*)alternative alternativeOffset:(int)offset alternativeLength:(int)length

Modified: trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm (261319 => 261320)


--- trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm	2020-05-07 18:37:33 UTC (rev 261320)
@@ -26,6 +26,8 @@
 #import "config.h"
 #import "UIScriptControllerMac.h"
 
+#if PLATFORM(MAC)
+
 #import "DumpRenderTree.h"
 #import "UIScriptContext.h"
 #import <_javascript_Core/JSContext.h>
@@ -34,12 +36,9 @@
 #import <_javascript_Core/OpaqueJSString.h>
 #import <WebKit/WebPreferences.h>
 #import <WebKit/WebViewPrivate.h>
+#import <pal/spi/mac/NSTextInputContextSPI.h>
 #import <wtf/BlockPtr.h>
 
-#if PLATFORM(MAC)
-
-#import "AppKitTestSPI.h"
-
 namespace WTR {
 
 Ref<UIScriptController> UIScriptController::create(UIScriptContext& context)

Modified: trunk/Tools/TestRunnerShared/spi/AppKitTestSPI.h (261319 => 261320)


--- trunk/Tools/TestRunnerShared/spi/AppKitTestSPI.h	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Tools/TestRunnerShared/spi/AppKitTestSPI.h	2020-05-07 18:37:33 UTC (rev 261320)
@@ -25,19 +25,10 @@
 
 #if PLATFORM(MAC)
 
-#if USE(APPLE_INTERNAL_SDK)
+#import <AppKit/NSDraggingItem.h>
 
-#import <AppKit/NSTextInputContext_Private.h>
-
-#else
-
-extern "C" {
-extern NSString *NSTextInputReplacementRangeAttributeName;
-}
-
-#endif
-
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
+// FIXME: Move this to PlatformHave.h.
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
 #define HAVE_NSDRAGGINGITEM_INITWITHITEM 1
 #endif
 
@@ -50,4 +41,3 @@
 @end
 
 #endif // PLATFORM(MAC)
-

Modified: trunk/Tools/TestWebKitAPI/Tests/TestWebKitAPI/mac/AppKitSPI.h (261319 => 261320)


--- trunk/Tools/TestWebKitAPI/Tests/TestWebKitAPI/mac/AppKitSPI.h	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Tools/TestWebKitAPI/Tests/TestWebKitAPI/mac/AppKitSPI.h	2020-05-07 18:37:33 UTC (rev 261320)
@@ -31,7 +31,6 @@
 #import <AppKit/NSInspectorBarItemController.h>
 #import <AppKit/NSInspectorBar_Private.h>
 #import <AppKit/NSTextInputClient_Private.h>
-#import <AppKit/NSTextInputContext_Private.h>
 #import <AppKit/NSWindow_Private.h>
 
 #else
@@ -42,11 +41,6 @@
 - (void)hasMarkedTextWithCompletionHandler:(void(^)(BOOL hasMarkedText))completionHandler;
 @end
 
-@interface NSTextInputContext (WebKitSupport)
-- (void)handleEvent:(NSEvent *)event completionHandler:(void(^)(BOOL handled))completionHandler;
-- (void)handleEventByInputMethod:(NSEvent *)event completionHandler:(void(^)(BOOL handled))completionHandler;
-@end
-
 @protocol NSInspectorBarClient <NSObject>
 @property (readonly) NSArray<NSString *> *inspectorBarItemIdentifiers;
 @property (readonly) NSWindow *window;
@@ -65,7 +59,6 @@
 NSString * const NSInspectorBarTextBackgroundColorItemIdentifier = @"NSInspectorBarTextBackgroundColorItemIdentifier";
 NSString * const NSInspectorBarFontStyleItemIdentifier = @"NSInspectorBarFontStyleItemIdentifier";
 NSString * const NSInspectorBarTextAlignmentItemIdentifier = @"NSInspectorBarTextAlignmentItemIdentifier";
-NSString * const NSTextInputReplacementRangeAttributeName = @"NSTextInputReplacementRangeAttributeName";
 
 @interface __NSInspectorBarItemController : NSObject
 - (instancetype)initWithInspectorBar:(NSInspectorBar *)bar NS_DESIGNATED_INITIALIZER;

Modified: trunk/Tools/TestWebKitAPI/Tests/mac/CandidateTests.mm (261319 => 261320)


--- trunk/Tools/TestWebKitAPI/Tests/mac/CandidateTests.mm	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/CandidateTests.mm	2020-05-07 18:37:33 UTC (rev 261320)
@@ -25,14 +25,15 @@
 
 #import "config.h"
 
+#if PLATFORM(MAC)
+
 #import "AppKitSPI.h"
 #import "InstanceMethodSwizzler.h"
 #import "PlatformUtilities.h"
 #import <WebKit/WebViewPrivate.h>
+#import <pal/spi/mac/NSTextInputContextSPI.h>
 #import <wtf/RetainPtr.h>
 
-#if PLATFORM(MAC)
-
 static bool webViewWasDeallocated = false;
 static bool didFinishLoad = false;
 static bool didCallShowCandidates = false;

Modified: trunk/Tools/TestWebKitAPI/Tests/mac/WKWebViewMacEditingTests.mm (261319 => 261320)


--- trunk/Tools/TestWebKitAPI/Tests/mac/WKWebViewMacEditingTests.mm	2020-05-07 18:24:04 UTC (rev 261319)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/WKWebViewMacEditingTests.mm	2020-05-07 18:37:33 UTC (rev 261320)
@@ -30,6 +30,7 @@
 #import "AppKitSPI.h"
 #import "PlatformUtilities.h"
 #import "TestWKWebView.h"
+#import <pal/spi/mac/NSTextInputContextSPI.h>
 #import <wtf/BlockPtr.h>
 #import <wtf/RetainPtr.h>
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to