Sometimes NSUndoManager can get into an inconsistent state
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 May 2013 20:07:20 +0000 (20:07 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 May 2013 20:07:20 +0000 (20:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=116050

Reviewed by Enrica Casucci.

Always group undo items to work around a bug in NSUndoManager that manifests
when we call removeAllActionsWithTarget.

Source/WebKit/mac:

* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::registerUndoOrRedoStep):

Source/WebKit2:

* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::registerEditCommand):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@150034 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm

index 36753dc604ed2570d844de6b8ed23709b257382f..da4dbcb6532181618a5c105fb622ba7ed81831ca 100644 (file)
@@ -1,3 +1,16 @@
+2013-05-13  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Sometimes NSUndoManager can get into an inconsistent state
+        https://bugs.webkit.org/show_bug.cgi?id=116050
+
+        Reviewed by Enrica Casucci.
+
+        Always group undo items to work around a bug in NSUndoManager that manifests
+        when we call removeAllActionsWithTarget.
+
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::registerUndoOrRedoStep):
+
 2013-05-13  Zalan Bujtas  <zalan@apple.com>
 
         WebProcess consuming very high CPU on linkedin.com
index 2045d8eaf732fd2c064fdb1c653b4049591cd017..099d2e7b15137b25ac5e2000e43b48080a530741 100644 (file)
@@ -544,9 +544,11 @@ void WebEditorClient::registerUndoOrRedoStep(PassRefPtr<UndoStep> step, bool isR
     NSUndoManager *undoManager = [m_webView undoManager];
     NSString *actionName = undoNameForEditAction(step->editingAction());
     WebUndoStep *webEntry = [WebUndoStep stepWithUndoStep:step];
+    [undoManager beginUndoGrouping];
     [undoManager registerUndoWithTarget:m_undoTarget.get() selector:(isRedo ? @selector(redoEditing:) : @selector(undoEditing:)) object:webEntry];
     if (actionName)
         [undoManager setActionName:actionName];
+    [undoManager endUndoGrouping];
     m_haveUndoRedoOperations = YES;
 }
 
index 3ba8d10c8bd0da22b29777302a0362889308f0e8..766b4191494789795f224a6bc151cafd120a4673 100644 (file)
@@ -1,3 +1,16 @@
+2013-05-13  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Sometimes NSUndoManager can get into an inconsistent state
+        https://bugs.webkit.org/show_bug.cgi?id=116050
+
+        Reviewed by Enrica Casucci.
+
+        Always group undo items to work around a bug in NSUndoManager that manifests
+        when we call removeAllActionsWithTarget.
+
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::registerEditCommand):
+
 2013-05-13  Anders Carlsson  <andersca@apple.com>
 
         [WK2] Crash in WebKit::StorageAreaMap::didSetItem()
index 7bbb016ddfaec4c8d6f71301740aeaddda1092ee..1f901e1b34f30059d15ec124f6998b418ff84cf7 100644 (file)
@@ -286,9 +286,11 @@ void PageClientImpl::registerEditCommand(PassRefPtr<WebEditCommandProxy> prpComm
     String actionName = WebEditCommandProxy::nameForEditAction(command->editAction());
 
     NSUndoManager *undoManager = [m_wkView undoManager];
+    [undoManager beginUndoGrouping];
     [undoManager registerUndoWithTarget:m_undoTarget.get() selector:((undoOrRedo == WebPageProxy::Undo) ? @selector(undoEditing:) : @selector(redoEditing:)) object:commandObjC.get()];
     if (!actionName.isEmpty())
         [undoManager setActionName:(NSString *)actionName];
+    [undoManager endUndoGrouping];
 }
 
 void PageClientImpl::clearAllEditCommands()