Reviewed by John.
authorharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 May 2005 17:37:41 +0000 (17:37 +0000)
committerharrison <harrison@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 7 May 2005 17:37:41 +0000 (17:37 +0000)
        <rdar://problem/4110366> Deleting text at the end of email moves insertion point to the top of the document

        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::handleGeneralDelete):
        Update m_upstreamStart when deleting m_downstreamEnd.node() if the former is no longer in the document.
        Better to update here than trying to recover later in calculateEndingPosition().

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

WebCore/ChangeLog-2005-08-23
WebCore/khtml/editing/htmlediting.cpp

index 1aa55444bd45342ce64466e03f16412b43cbdf34..b9ee6bd428654da9e85da872afc3562d0af319c3 100644 (file)
@@ -1,3 +1,14 @@
+2005-05-07  David Harrison  <harrison@apple.com>
+
+        Reviewed by John.
+
+        <rdar://problem/4110366> Deleting text at the end of email moves insertion point to the top of the document
+        
+        * khtml/editing/htmlediting.cpp:
+        (khtml::DeleteSelectionCommand::handleGeneralDelete):
+        Update m_upstreamStart when deleting m_downstreamEnd.node() if the former is no longer in the document.
+        Better to update here than trying to recover later in calculateEndingPosition().
+
 2005-05-07  David Harrison  <harrison@apple.com>
         
         Remove workaround for <rdar://problem/4103339>.
index 823b7dd322e6662a61dd2be6e891370aa86bbb49..aa50ead299c1e8c3c3caf61d67a8ade900251850 100644 (file)
@@ -2881,7 +2881,8 @@ void DeleteSelectionCommand::handleGeneralDelete()
                 // need to delete whole node
                 // we can get here if this is the last node in the block
                 // remove an ancestor of m_downstreamEnd.node(), and thus m_downstreamEnd.node() itself
-                if (m_upstreamStart.node() == m_downstreamEnd.node() ||
+                if (!m_upstreamStart.node()->inDocument() ||
+                    m_upstreamStart.node() == m_downstreamEnd.node() ||
                     m_upstreamStart.node()->isAncestor(m_downstreamEnd.node())) {
                     m_upstreamStart = Position(m_downstreamEnd.node()->parentNode(), m_downstreamEnd.node()->nodeIndex());
                 }