Reviewed by Ken.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 May 2004 23:21:17 +0000 (23:21 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 May 2004 23:21:17 +0000 (23:21 +0000)
- avoid messing with undo manager needlessly for ~1% HTML iBench speedup

        * WebCoreSupport.subproj/WebBridge.h:
        * WebCoreSupport.subproj/WebBridge.m:
        (-[WebBridge registerCommandForUndo:]): mark undo/redo item flag
        (-[WebBridge registerCommandForRedo:]): ditto
        (-[WebBridge clearUndoRedoOperations]): check flag before removing items,
and clear it after removing them

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

WebKit/ChangeLog
WebKit/WebCoreSupport.subproj/WebBridge.h
WebKit/WebCoreSupport.subproj/WebBridge.m

index dced1ca..9ce6f3d 100644 (file)
@@ -1,3 +1,16 @@
+2004-05-09  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Ken.
+
+       - avoid messing with undo manager needlessly for ~1% HTML iBench speedup
+
+        * WebCoreSupport.subproj/WebBridge.h:
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge registerCommandForUndo:]): mark undo/redo item flag
+        (-[WebBridge registerCommandForRedo:]): ditto
+        (-[WebBridge clearUndoRedoOperations]): check flag before removing items,
+       and clear it after removing them
+
 2004-05-08  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Darin.
index d0d10e2..c6dd7e7 100644 (file)
@@ -19,6 +19,7 @@
     BOOL _keyboardUIModeAccessed;
     BOOL _doingClientRedirect;
     BOOL _inNextKeyViewOutsideWebFrameViews;
+    BOOL _haveUndoRedoOperations;
 }
 
 - (id)initWithWebFrame:(WebFrame *)webFrame;
index 63fea61..5a7382c 100644 (file)
@@ -1183,18 +1183,23 @@ static id <WebFormDelegate> formDelegate(WebBridge *self)
 {
     NSUndoManager *undoManager = [[_frame webView] undoManager];
     [undoManager registerUndoWithTarget:self selector:@selector(undoEditing:) object:arg];
+    _haveUndoRedoOperations = YES;
 }
 
 - (void)registerCommandForRedo:(id)arg
 {
     NSUndoManager *undoManager = [[_frame webView] undoManager];
     [undoManager registerUndoWithTarget:self selector:@selector(redoEditing:) object:arg];
+    _haveUndoRedoOperations = YES;
 }
 
 - (void)clearUndoRedoOperations
 {
-    NSUndoManager *undoManager = [[_frame webView] undoManager];
-    [undoManager removeAllActionsWithTarget:self];
+    if (_haveUndoRedoOperations) {
+       NSUndoManager *undoManager = [[_frame webView] undoManager];
+       [undoManager removeAllActionsWithTarget:self];
+       _haveUndoRedoOperations = NO;
+    }
 }
 
 - (void)editingKeyDown:(NSEvent *)event