Reviewed by Darin
[WebKit-https.git] / WebCore / khtml / editing / visible_position.cpp
index ff634fc2c20f7c26416870a80d8dac74fa9bfbe4..887ca075ab7dc64b87702779569e5d150f567b14 100644 (file)
@@ -349,18 +349,18 @@ Position VisiblePosition::deepEquivalent(const Position &pos)
     return Position(node, 0);
 }
 
-Position VisiblePosition::upstreamDeepEquivalent() const
+Position VisiblePosition::downstreamDeepEquivalent() const
 {
     Position pos = m_deepPosition;
     
-    if (pos.isNull() || atStart(pos))
+    if (pos.isNull() || atEnd(pos))
         return pos;
 
     Position downstreamTest = pos.downstream(StayInBlock);
 
     Position current = pos;
-    while (!atStart(current)) {
-        current = previousPosition(current);
+    while (!atEnd(current)) {
+        current = nextPosition(current);
         if (isCandidate(current)) {
             if (downstreamTest != current.downstream(StayInBlock))
                 break;