Title: [288864] trunk/Source/WebKit
Revision
288864
Author
[email protected]
Date
2022-01-31 18:43:09 -0800 (Mon, 31 Jan 2022)

Log Message

[iOS] Don't register undo actions in undoManager overridden by WKWebView client
https://bugs.webkit.org/show_bug.cgi?id=235928
<rdar://problem/87192657>

Patch by Matt Gilligan <[email protected]> on 2022-01-31
Reviewed by Tim Horton.

* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::registerEditCommand):
Use -[WKContentView undoManagerForWebView] rather than -undoManager to prevent registering
actions in an undo manager overridden by a WKWebView subclass. This ensures that all
actions are registered in the same manager. If the client has disabled groupsByEvent on the
overridden undoManager, this prevents an exception from being thrown due to registering
actions outside of an undo group.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (288863 => 288864)


--- trunk/Source/WebKit/ChangeLog	2022-02-01 01:57:08 UTC (rev 288863)
+++ trunk/Source/WebKit/ChangeLog	2022-02-01 02:43:09 UTC (rev 288864)
@@ -1,3 +1,19 @@
+2022-01-31  Matt Gilligan  <[email protected]>
+
+        [iOS] Don't register undo actions in undoManager overridden by WKWebView client
+        https://bugs.webkit.org/show_bug.cgi?id=235928
+        <rdar://problem/87192657>
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::registerEditCommand):
+        Use -[WKContentView undoManagerForWebView] rather than -undoManager to prevent registering
+        actions in an undo manager overridden by a WKWebView subclass. This ensures that all
+        actions are registered in the same manager. If the client has disabled groupsByEvent on the
+        overridden undoManager, this prevents an exception from being thrown due to registering
+        actions outside of an undo group.
+
 2022-01-31  Brent Fulgham  <[email protected]>
 
         [iOS] Clean up some issues in the 'com.apple.WebKit.adattributiond.sb' sandbox

Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (288863 => 288864)


--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2022-02-01 01:57:08 UTC (rev 288863)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm	2022-02-01 02:43:09 UTC (rev 288864)
@@ -320,7 +320,7 @@
     auto actionName = command->label();
     auto commandObjC = adoptNS([[WKEditCommand alloc] initWithWebEditCommandProxy:WTFMove(command)]);
     
-    NSUndoManager *undoManager = [m_contentView undoManager];
+    NSUndoManager *undoManager = [m_contentView undoManagerForWebView];
     [undoManager registerUndoWithTarget:m_undoTarget.get() selector:((undoOrRedo == UndoOrRedo::Undo) ? @selector(undoEditing:) : @selector(redoEditing:)) object:commandObjC.get()];
     if (!actionName.isEmpty())
         [undoManager setActionName:(NSString *)actionName];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to