Reviewed by adele
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Mar 2006 07:37:36 +0000 (07:37 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Mar 2006 07:37:36 +0000 (07:37 +0000)
        <http://bugzilla.opendarwin.org/show_bug.cgi?id=7692>
        Should use an iterator in CompositeEditCommand::doUnapply()

        ~30% speedup of a big undo

        * editing/CompositeEditCommand.cpp:
        (WebCore::CompositeEditCommand::doUnapply):
        (WebCore::CompositeEditCommand::doReapply):

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

WebCore/ChangeLog
WebCore/editing/CompositeEditCommand.cpp

index 9fa49c7411672c56e1f5485f87e74b462e45285f..0310333b676f5a1d2e946513ffeb4c6c3c89cafb 100644 (file)
@@ -1,3 +1,16 @@
+2006-03-09  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by adele
+        
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=7692>
+        Should use an iterator in CompositeEditCommand::doUnapply()
+        
+        ~30% speedup of a big undo
+
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::doUnapply):
+        (WebCore::CompositeEditCommand::doReapply):
+
 2006-03-09  Adele Peterson  <adele@apple.com>
 
         Reviewed by Tim O.
index 736acb0f1715d92b0db21a20145ada4a80072859..5bc23246e3f79e8214d33e2f4a841a0461dd46f7 100644 (file)
@@ -68,21 +68,20 @@ CompositeEditCommand::CompositeEditCommand(DocumentImpl *document)
 
 void CompositeEditCommand::doUnapply()
 {
-    if (m_cmds.count() == 0) {
+    if (m_cmds.count() == 0)
         return;
-    }
     
-    for (int i = m_cmds.count() - 1; i >= 0; --i)
-        m_cmds[i]->unapply();
+    QValueList<EditCommandPtr>::ConstIterator end;
+    for (QValueList<EditCommandPtr>::ConstIterator it = m_cmds.fromLast(); it != end; --it)
+        (*it)->unapply();
 
     setState(NotApplied);
 }
 
 void CompositeEditCommand::doReapply()
 {
-    if (m_cmds.count() == 0) {
+    if (m_cmds.count() == 0)
         return;
-    }
 
     for (QValueList<EditCommandPtr>::ConstIterator it = m_cmds.begin(); it != m_cmds.end(); ++it)
         (*it)->reapply();