Reviewed by Harrison
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Nov 2004 16:58:30 +0000 (16:58 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Nov 2004 16:58:30 +0000 (16:58 +0000)
        Some cleanups and fixes in upstream and downstream functions.

        Removed redundant checks for isBlockFlow() when calling enclosingBlockFlowElement().
        Blocks do not need to skip the call to enclosingBlockFlowElement() for fear that the
        block's enclosing block will be returned.

        Remove code from upstream that confined the serach to block boundaries outside of
        the code which runs in the StayInBlock case. This code was redundant, and caused
        incorrect results to be returned in the DoNotStayInBlock case.

        In downstream, the check for crossing into a new block should use the equivalentDeepPosition()
        node, not the the this pointer's node.

        * khtml/xml/dom_position.cpp:
        (DOM::Position::upstream)
        (DOM::Position::downstream)

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

WebCore/ChangeLog-2005-08-23
WebCore/khtml/xml/dom_position.cpp

index fe1c1f90868d2a34eac50c50a4c4dc55f586f100..2021208a149c631fd960096825a4ad71f2b3c048 100644 (file)
@@ -1,3 +1,24 @@
+2004-11-10  Ken Kocienda  <kocienda@apple.com>
+
+        Reviewed by Harrison
+
+        Some cleanups and fixes in upstream and downstream functions. 
+        
+        Removed redundant checks for isBlockFlow() when calling enclosingBlockFlowElement(). 
+        Blocks do not need to skip the call to enclosingBlockFlowElement() for fear that the 
+        block's enclosing block will be returned. 
+        
+        Remove code from upstream that confined the serach to block boundaries outside of
+        the code which runs in the StayInBlock case. This code was redundant, and caused
+        incorrect results to be returned in the DoNotStayInBlock case.
+        
+        In downstream, the check for crossing into a new block should use the equivalentDeepPosition()
+        node, not the the this pointer's node.
+
+        * khtml/xml/dom_position.cpp:
+        (DOM::Position::upstream)
+        (DOM::Position::downstream)
+
 2004-11-09  David Hyatt  <hyatt@apple.com>
 
        Fix for 3873234, Safari UI is unresponsive when parsing multiple HTML docs and 3873233, Safari hangs when
index 31086bdc7a63c24224b4ecc32ddb5ef06b3a4252..91ba1f12664b14466c5ecf8730ffdb12b1183d88 100644 (file)
@@ -368,14 +368,14 @@ Position Position::upstream(EStayInBlock stayInBlock) const
     if (!startNode)
         return Position();
 
-    NodeImpl *block = startNode->isBlockFlow() ? startNode : startNode->enclosingBlockFlowElement();
+    NodeImpl *block = startNode->enclosingBlockFlowElement();
     
     PositionIterator it(start);
     for (; !it.atStart(); it.previous()) {
         NodeImpl *currentNode = it.current().node();
 
         if (stayInBlock) {
-            NodeImpl *currentBlock = currentNode->isBlockFlow() ? currentNode : currentNode->enclosingBlockFlowElement();
+            NodeImpl *currentBlock = currentNode->enclosingBlockFlowElement();
             if (block != currentBlock)
                 return it.next();
         }
@@ -387,7 +387,7 @@ Position Position::upstream(EStayInBlock stayInBlock) const
         if (renderer->style()->visibility() != VISIBLE)
             continue;
 
-        if ((currentNode != startNode && renderer->isBlockFlow()) || renderer->isReplaced() || renderer->isBR()) {
+        if (renderer->isReplaced() || renderer->isBR()) {
             if (it.current().offset() >= renderer->caretMaxOffset())
                 return Position(currentNode, renderer->caretMaxOffset());
             else
@@ -424,14 +424,14 @@ Position Position::downstream(EStayInBlock stayInBlock) const
     if (!startNode)
         return Position();
 
-    NodeImpl *block = startNode->isBlockFlow() ? startNode : startNode->enclosingBlockFlowElement();
+    NodeImpl *block = startNode->enclosingBlockFlowElement();
     
     PositionIterator it(start);            
     for (; !it.atEnd(); it.next()) {   
         NodeImpl *currentNode = it.current().node();
 
         if (stayInBlock) {
-            NodeImpl *currentBlock = currentNode->isBlockFlow() ? currentNode : currentNode->enclosingBlockFlowElement();
+            NodeImpl *currentBlock = currentNode->enclosingBlockFlowElement();
             if (block != currentBlock)
                 return it.previous();
         }
@@ -443,7 +443,7 @@ Position Position::downstream(EStayInBlock stayInBlock) const
         if (renderer->style()->visibility() != VISIBLE)
             continue;
 
-        if ((currentNode != node() && renderer->isBlockFlow()) || renderer->isReplaced() || renderer->isBR()) {
+        if ((currentNode != startNode && renderer->isBlockFlow()) || renderer->isReplaced() || renderer->isBR()) {
             if (it.current().offset() <= renderer->caretMinOffset())
                 return Position(currentNode, renderer->caretMinOffset());
             else