Reviewed by Darin
authorkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Oct 2004 20:37:50 +0000 (20:37 +0000)
committerkocienda <kocienda@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Oct 2004 20:37:50 +0000 (20:37 +0000)
        Recent checkin adding upstreamDeepEquivalent had it backwards. The helper
        we want is downstreamDeepEquivalent, as the deepEquivalent function returns
        an upstream position.

        * khtml/editing/selection.cpp:
        (khtml::Selection::layout): DOWNSTREAM case now uses downstreamDeepEquivalent.
        UPSTREAM uses deepEquivalent.
        * khtml/editing/visible_position.cpp:
        (khtml::VisiblePosition::downstreamDeepEquivalent): New helper, replacing
        upstreamDeepEquivalent.
        * khtml/editing/visible_position.h

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

WebCore/ChangeLog-2005-08-23
WebCore/khtml/editing/SelectionController.cpp
WebCore/khtml/editing/selection.cpp
WebCore/khtml/editing/visible_position.cpp
WebCore/khtml/editing/visible_position.h

index 5d448beacd719a239f3b53eb84f6f1b25d6cdfa2..40f2bc4bf772fbfed8f019ea3187ae1abedd0750 100644 (file)
@@ -1,3 +1,19 @@
+2004-10-05  Ken Kocienda  <kocienda@apple.com>
+
+        Reviewed by Darin
+
+        Recent checkin adding upstreamDeepEquivalent had it backwards. The helper
+        we want is downstreamDeepEquivalent, as the deepEquivalent function returns
+        an upstream position.
+
+        * khtml/editing/selection.cpp:
+        (khtml::Selection::layout): DOWNSTREAM case now uses downstreamDeepEquivalent.
+        UPSTREAM uses deepEquivalent.
+        * khtml/editing/visible_position.cpp:
+        (khtml::VisiblePosition::downstreamDeepEquivalent): New helper, replacing 
+        upstreamDeepEquivalent.
+        * khtml/editing/visible_position.h
+
 2004-10-05  David Hyatt  <hyatt@apple.com>
 
        New selection gap-filling architecture.  Makes the gap-filling much more like NSTextView and puts the responsibility
index 55a9e26bd71fb1b52f4acc58fcc5fa21f4a1070d..09f139ed1508ad993efd5122d3bc6dba41a8d5ec 100644 (file)
@@ -622,10 +622,10 @@ void Selection::layout()
         pos.node()->getDocument()->updateRendering();
         switch (m_affinity) {
             case DOWNSTREAM:
-                pos = VisiblePosition(m_start).deepEquivalent();
+                pos = VisiblePosition(m_start).downstreamDeepEquivalent();
                 break;
             case UPSTREAM:
-                pos = VisiblePosition(m_start).upstreamDeepEquivalent();
+                pos = VisiblePosition(m_start).deepEquivalent();
                 break;
         }
         m_caretRect = pos.node()->renderer()->caretRect(pos.offset(), false);
index 55a9e26bd71fb1b52f4acc58fcc5fa21f4a1070d..09f139ed1508ad993efd5122d3bc6dba41a8d5ec 100644 (file)
@@ -622,10 +622,10 @@ void Selection::layout()
         pos.node()->getDocument()->updateRendering();
         switch (m_affinity) {
             case DOWNSTREAM:
-                pos = VisiblePosition(m_start).deepEquivalent();
+                pos = VisiblePosition(m_start).downstreamDeepEquivalent();
                 break;
             case UPSTREAM:
-                pos = VisiblePosition(m_start).upstreamDeepEquivalent();
+                pos = VisiblePosition(m_start).deepEquivalent();
                 break;
         }
         m_caretRect = pos.node()->renderer()->caretRect(pos.offset(), false);
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;
index 4ed3fc785796b8d19272f4c931e4780d41de6a7d..b5e36ae46206565572d6851c573990e5c6bdc587 100644 (file)
@@ -54,7 +54,7 @@ public:
     Position position() const { return rangeCompliantEquivalent(m_deepPosition); }
     Position deepEquivalent() const { return m_deepPosition; }
     
-    Position upstreamDeepEquivalent() const;
+    Position downstreamDeepEquivalent() const;
 
     friend bool operator==(const VisiblePosition &a, const VisiblePosition &b);