Reviewed by Adele
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Nov 2004 18:09:51 +0000 (18:09 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Nov 2004 18:09:51 +0000 (18:09 +0000)
        * khtml/editing/htmlediting.cpp:
        (khtml::DeleteSelectionCommand::initializePositionData): Add some comments and a new piece of debugging output.

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

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

index ee0cbd219ac1375684417c95fefd243cf8508fea..68661905fac2c37623755bfd02d082b192a57e24 100644 (file)
@@ -1,3 +1,10 @@
+2004-11-11  Ken Kocienda  <kocienda@apple.com>
+
+        Reviewed by Adele
+
+        * khtml/editing/htmlediting.cpp:
+        (khtml::DeleteSelectionCommand::initializePositionData): Add some comments and a new piece of debugging output.
+
 2004-11-11  Ken Kocienda  <kocienda@apple.com>
 
         Reviewed by John
index cba5ba03251db6d3ae1241daeb5f26b0bc7daecb..d192685344fa1333ed0155042908f28048590992 100644 (file)
@@ -1413,6 +1413,9 @@ DeleteSelectionCommand::DeleteSelectionCommand(DocumentImpl *document, const Sel
 
 void DeleteSelectionCommand::initializePositionData()
 {
+    //
+    // Handle setting some basic positions
+    //
     Position start = m_selectionToDelete.start();
     Position end = m_selectionToDelete.end();
 
@@ -1421,6 +1424,9 @@ void DeleteSelectionCommand::initializePositionData()
     m_upstreamEnd = end.upstream(StayInBlock);
     m_downstreamEnd = end.downstream(StayInBlock);
 
+    //
+    // Handle leading and trailing whitespace, as well as smart delete adjustments to the selection
+    //
     m_leadingWhitespace = m_upstreamStart.leadingWhitespacePosition();
     bool hasLeadingWhitespaceBeforeAdjustment = m_leadingWhitespace.isNotNull();
     if (m_smartDelete && hasLeadingWhitespaceBeforeAdjustment) {
@@ -1431,7 +1437,6 @@ void DeleteSelectionCommand::initializePositionData()
         m_downstreamStart = pos.downstream(StayInBlock);
         m_leadingWhitespace = m_upstreamStart.leadingWhitespacePosition();
     }
-
     m_trailingWhitespace = m_downstreamEnd.trailingWhitespacePosition();
     // Note: trailing whitespace is only considered for smart delete if there is no leading
     // whitespace, as in the case where you double-click the first word of a paragraph.
@@ -1443,13 +1448,17 @@ void DeleteSelectionCommand::initializePositionData()
         m_downstreamEnd = pos.downstream(StayInBlock);
         m_trailingWhitespace = m_downstreamEnd.trailingWhitespacePosition();
     }
-        
     m_trailingWhitespaceValid = true;
     
+    //
+    // Handle setting start and end blocks and the start node.
+    //
     m_startBlock = m_downstreamStart.node()->enclosingBlockFlowElement();
     m_startBlock->ref();
     m_endBlock = m_upstreamEnd.node()->enclosingBlockFlowElement();
     m_endBlock->ref();
+    m_startNode = m_upstreamStart.node();
+    m_startNode->ref();
 
     debugPosition("m_upstreamStart      ", m_upstreamStart);
     debugPosition("m_downstreamStart    ", m_downstreamStart);
@@ -1459,9 +1468,7 @@ void DeleteSelectionCommand::initializePositionData()
     debugPosition("m_trailingWhitespace ", m_trailingWhitespace);
     debugNode(    "m_startBlock         ", m_startBlock);
     debugNode(    "m_endBlock           ", m_endBlock);    
-
-    m_startNode = m_upstreamStart.node();
-    m_startNode->ref();
+    debugNode(    "m_startNode          ", m_startNode);    
 }
 
 void DeleteSelectionCommand::saveTypingStyleState()