[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:49:00 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 6ed5ce6f7dcdcf9167a86b466936ab3236b3f8a0
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jul 7 20:13:00 2004 +0000

            Reviewed by Hyatt
    
            Fix for this bug:
    
            <rdar://problem/3716479> calling setInnerHTML during a webViewDidChange delegate call causes a crash
    
            The fix involves some rearrangement of code in TypingCommand and TypingCommandImpl.
            Formerly, new TypingCommands would apply themselves (which was a no-op) and then
            do their action in some code a way different than other commands. This type of command
            application is different than for all other commands since TypingCommands can be coalesced.
            The crash occurred as a result of the "no-op" TypingCommand having the unconsidered
            consequence of causing editing delegate notifications to be sent before the command
            has actually run. This change takes a small step towards making TypingCommandImpl function like
            other commands, where the command work is done in doApply. This makes the notification
            happen in the right order.
    
            * khtml/editing/htmlediting.cpp:
            (khtml::TypingCommand::TypingCommand):
            (khtml::TypingCommand::insertText):
            (khtml::TypingCommand::insertNewline):
            (khtml::TypingCommand::deleteKeyPressed):
            * khtml/editing/htmlediting.h:
            (khtml::TypingCommand::):
            * khtml/editing/htmlediting_impl.cpp:
            (khtml::TypingCommandImpl::TypingCommandImpl):
            (khtml::TypingCommandImpl::doApply):
            * khtml/editing/htmlediting_impl.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6969 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c5e2f6c..b6c234d 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,33 @@
+2004-07-07  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by Hyatt
+
+        Fix for this bug:
+        
+        <rdar://problem/3716479> calling setInnerHTML during a webViewDidChange delegate call causes a crash
+        
+        The fix involves some rearrangement of code in TypingCommand and TypingCommandImpl.
+        Formerly, new TypingCommands would apply themselves (which was a no-op) and then
+        do their action in some code a way different than other commands. This type of command
+        application is different than for all other commands since TypingCommands can be coalesced.
+        The crash occurred as a result of the "no-op" TypingCommand having the unconsidered
+        consequence of causing editing delegate notifications to be sent before the command 
+        has actually run. This change takes a small step towards making TypingCommandImpl function like
+        other commands, where the command work is done in doApply. This makes the notification
+        happen in the right order.
+
+        * khtml/editing/htmlediting.cpp:
+        (khtml::TypingCommand::TypingCommand):
+        (khtml::TypingCommand::insertText):
+        (khtml::TypingCommand::insertNewline):
+        (khtml::TypingCommand::deleteKeyPressed):
+        * khtml/editing/htmlediting.h:
+        (khtml::TypingCommand::):
+        * khtml/editing/htmlediting_impl.cpp:
+        (khtml::TypingCommandImpl::TypingCommandImpl):
+        (khtml::TypingCommandImpl::doApply):
+        * khtml/editing/htmlediting_impl.h:
+
 2004-07-06  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by me
diff --git a/WebCore/khtml/editing/htmlediting.cpp b/WebCore/khtml/editing/htmlediting.cpp
index afce837..b856a21 100644
--- a/WebCore/khtml/editing/htmlediting.cpp
+++ b/WebCore/khtml/editing/htmlediting.cpp
@@ -731,8 +731,8 @@ long SplitTextNodeCommand::offset() const
 //------------------------------------------------------------------------------------------
 // TypingCommand
 
-TypingCommand::TypingCommand(DocumentImpl *document) 
-    : CompositeEditCommand(new TypingCommandImpl(document))
+TypingCommand::TypingCommand(DocumentImpl *document, ETypingCommand commandType, const DOM::DOMString &textToInsert) 
+    : CompositeEditCommand(new TypingCommandImpl(document, commandType, textToInsert))
 {
 }
 
@@ -757,9 +757,8 @@ void TypingCommand::insertText(DocumentImpl *document, const DOMString &text)
         static_cast<TypingCommand &>(lastEditCommand).insertText(text);
     }
     else {
-        TypingCommand typingCommand(document);
+        TypingCommand typingCommand(document, InsertText, text);
         typingCommand.apply();
-        static_cast<TypingCommand &>(typingCommand).insertText(text);
     }
 }
 
@@ -775,9 +774,8 @@ void TypingCommand::insertNewline(DocumentImpl *document)
         static_cast<TypingCommand &>(lastEditCommand).insertNewline();
     }
     else {
-        TypingCommand typingCommand(document);
+        TypingCommand typingCommand(document, InsertNewline);
         typingCommand.apply();
-        static_cast<TypingCommand &>(typingCommand).insertNewline();
     }
 }
 
@@ -793,9 +791,8 @@ void TypingCommand::deleteKeyPressed(DocumentImpl *document)
         static_cast<TypingCommand &>(lastEditCommand).deleteKeyPressed();
     }
     else {
-        TypingCommand typingCommand(document);
+        TypingCommand typingCommand(document, DeleteKey);
         typingCommand.apply();
-        static_cast<TypingCommand &>(typingCommand).deleteKeyPressed();
     }
 }
 
@@ -826,19 +823,19 @@ bool TypingCommand::openForMoreTyping() const
 void TypingCommand::insertText(const DOMString &text)
 {
     IF_IMPL_NULL_RETURN;
-    return impl()->insertText(text);
+    impl()->insertText(text);
 }
 
 void TypingCommand::insertNewline()
 {
     IF_IMPL_NULL_RETURN;
-    return impl()->insertNewline();
+    impl()->insertNewline();
 }
 
 void TypingCommand::deleteKeyPressed()
 {
     IF_IMPL_NULL_RETURN;
-    return impl()->deleteKeyPressed();
-}
+    impl()->deleteKeyPressed();
+ }
 
 } // namespace khtml
diff --git a/WebCore/khtml/editing/htmlediting.h b/WebCore/khtml/editing/htmlediting.h
index 734ce92..9a40063 100644
--- a/WebCore/khtml/editing/htmlediting.h
+++ b/WebCore/khtml/editing/htmlediting.h
@@ -491,11 +491,13 @@ public:
     bool openForMoreTyping() const;
     void closeTyping();
 
+    enum ETypingCommand { DeleteKey, InsertText, InsertNewline };
+
 private:
-	TypingCommand(DOM::DocumentImpl *document);
-	TypingCommand(TypingCommand *);
-	TypingCommand(const TypingCommand &);
-	virtual ~TypingCommand();
+    TypingCommand(DOM::DocumentImpl *document, ETypingCommand, const DOM::DOMString &text="");
+    TypingCommand(TypingCommand *);
+    TypingCommand(const TypingCommand &);
+    virtual ~TypingCommand();
 
     void deleteKeyPressed();
     void insertText(const DOM::DOMString &text);
diff --git a/WebCore/khtml/editing/htmlediting_impl.cpp b/WebCore/khtml/editing/htmlediting_impl.cpp
index c1d1279..a4f74f5 100644
--- a/WebCore/khtml/editing/htmlediting_impl.cpp
+++ b/WebCore/khtml/editing/htmlediting_impl.cpp
@@ -2344,8 +2344,8 @@ void SplitTextNodeCommandImpl::doUnapply()
 //------------------------------------------------------------------------------------------
 // TypingCommandImpl
 
-TypingCommandImpl::TypingCommandImpl(DocumentImpl *document)
-    : CompositeEditCommandImpl(document), m_openForMoreTyping(true)
+TypingCommandImpl::TypingCommandImpl(DocumentImpl *document, TypingCommand::ETypingCommand commandType, const DOM::DOMString &textToInsert)
+    : CompositeEditCommandImpl(document), m_commandType(commandType), m_textToInsert(textToInsert), m_openForMoreTyping(true)
 {
 }
 
@@ -2360,6 +2360,17 @@ int TypingCommandImpl::commandID() const
 
 void TypingCommandImpl::doApply()
 {
+    switch (m_commandType) {
+        case TypingCommand::DeleteKey:
+            deleteKeyPressed();
+            break;
+        case TypingCommand::InsertText:
+            insertText(m_textToInsert);
+            break;
+        case TypingCommand::InsertNewline:
+            insertNewline();
+            break;
+    }
 }
 
 void TypingCommandImpl::typingAddedToOpenCommand()
diff --git a/WebCore/khtml/editing/htmlediting_impl.h b/WebCore/khtml/editing/htmlediting_impl.h
index 757f047..afc4966 100644
--- a/WebCore/khtml/editing/htmlediting_impl.h
+++ b/WebCore/khtml/editing/htmlediting_impl.h
@@ -594,7 +594,7 @@ private:
 class TypingCommandImpl : public CompositeEditCommandImpl
 {
 public:
-    TypingCommandImpl(DOM::DocumentImpl *document);
+    TypingCommandImpl(DOM::DocumentImpl *document, TypingCommand::ETypingCommand, const DOM::DOMString &);
     virtual ~TypingCommandImpl();
     
     virtual int commandID() const;
@@ -613,6 +613,8 @@ private:
     void removeCommand(const EditCommand &);
     void typingAddedToOpenCommand();
     
+    TypingCommand::ETypingCommand m_commandType;
+    DOM::DOMString m_textToInsert;
     bool m_openForMoreTyping;
 };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list