WebCore:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Sep 2007 19:18:01 +0000 (19:18 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Sep 2007 19:18:01 +0000 (19:18 +0000)
        Reviewed by Darin.

        <rdar://problem/5057506> Double-clicking after ToDo content doesn't select the paragraph break

        * editing/Selection.cpp:
        (WebCore::Selection::validate):
        Moved the code that moves across a paragraph boundary
        when expanding selections by word granularity from
        endOfWord to here.
        In the word and paragraph granularity cases, if the
        end of the selection is at the end of the last paragraph
        in the last cell of a block table, expand it so that
        it ends at the start of the paragraph after the table,
        instead of just after the table, so that ToDo content
        gets the same double/tripled click behavior that normal
        paragraphs get (added two testcases).
        When expanding the selection to include paragraph
        breaks, pass VisiblePosition::next true so that it
        doesn't change editability.
        * editing/VisiblePosition.cpp:
        (WebCore::VisiblePosition::next): Renamed the bool because it's now also
        used to keep non-editable positions non-editable.
        (WebCore::VisiblePosition::previous): Ditto.
        (WebCore::VisiblePosition::lastPositionWithSameEditabilityAtOrBefore):
        Renamed this function and made it also work with non-editable positions.
        (WebCore::VisiblePosition::firstPositionWithSameEditabilityAtOrAfter):
        Ditto.
        * editing/VisiblePosition.h:
        * editing/visible_units.cpp:
        (WebCore::endOfWord): Called the renamed function.
        (WebCore::previousWordPosition): Ditto.
        (WebCore::nextWordPosition): Ditto.
        (WebCore::startOfLine): Ditto.
        (WebCore::endOfLine): Ditto.
        (WebCore::previousSentencePosition): Ditto.
        (WebCore::nextSentencePosition): Ditto.

LayoutTests:

        Reviewed by Darin.

        <rdar://problem/5333725> -webkit-user-select: none makes selection difficult

        * editing/selection/5057506-2.html: Added.
        * editing/selection/5057506.html: Added.
        * platform/mac/editing/selection/5057506-2-expected.checksum: Added.
        * platform/mac/editing/selection/5057506-2-expected.png: Added.
        * platform/mac/editing/selection/5057506-2-expected.txt: Added.
        * platform/mac/editing/selection/5057506-expected.checksum: Added.
        * platform/mac/editing/selection/5057506-expected.png: Added.
        * platform/mac/editing/selection/5057506-expected.txt: Added.

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

15 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/selection/5057506-2.html [new file with mode: 0644]
LayoutTests/editing/selection/5057506.html [new file with mode: 0644]
LayoutTests/platform/mac/editing/selection/5057506-2-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/editing/selection/5057506-2-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/editing/selection/5057506-2-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/editing/selection/5057506-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/editing/selection/5057506-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/editing/selection/5057506-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/editing/Selection.cpp
WebCore/editing/VisiblePosition.cpp
WebCore/editing/VisiblePosition.h
WebCore/editing/visible_units.cpp

index 474aef9599f88bc35c64f03e3b8849e8ae0f3c40..d268131e779ab340eb1482fa94fc8a53b93f9166 100644 (file)
@@ -1,3 +1,18 @@
+2007-09-07  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by Darin.
+        
+        <rdar://problem/5333725> -webkit-user-select: none makes selection difficult
+
+        * editing/selection/5057506-2.html: Added.
+        * editing/selection/5057506.html: Added.
+        * platform/mac/editing/selection/5057506-2-expected.checksum: Added.
+        * platform/mac/editing/selection/5057506-2-expected.png: Added.
+        * platform/mac/editing/selection/5057506-2-expected.txt: Added.
+        * platform/mac/editing/selection/5057506-expected.checksum: Added.
+        * platform/mac/editing/selection/5057506-expected.png: Added.
+        * platform/mac/editing/selection/5057506-expected.txt: Added.
+
 2007-09-07  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Kevin McCullough.
diff --git a/LayoutTests/editing/selection/5057506-2.html b/LayoutTests/editing/selection/5057506-2.html
new file mode 100644 (file)
index 0000000..08ac685
--- /dev/null
@@ -0,0 +1,23 @@
+<p>This tests triple clicking after the last character in the last cell of a block table.  The paragraph break (the space between the last character and the first character in the next paragraph) should be selected.  Selection painting problems might prevent the paragraph break from appearing as selected even though it is.  To test manually, triple click inside the table cell, after the last character, and hit delete.  Afterward, the table should contain only 'bar'.</p>
+<div contenteditable="true">
+<table border="1"><tr><td width="100px"><span id="span">foo</span></td></tr></table>
+<div id="end">bar</div>
+</div>
+
+<script>
+if (window.layoutTestController) {
+    span = document.getElementById("span");
+    x = span.offsetParent.offsetLeft + span.offsetLeft + span.offsetWidth + 10;
+    y = span.offsetParent.offsetParent.offsetTop + span.offsetParent.offsetTop + span.offsetTop + span.offsetHeight / 2;
+    alert(x);
+    alert(y);
+
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+</script>
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/5057506.html b/LayoutTests/editing/selection/5057506.html
new file mode 100644 (file)
index 0000000..b9a8a99
--- /dev/null
@@ -0,0 +1,21 @@
+<p>This tests double clicking after the last character in the last cell of a block table.  The paragraph break (the space between the last character and the first character in the next paragraph) should be selected.  Selection painting problems might prevent the paragraph break from appearing as selected even though it is.  To test manually, double click inside the table cell, after the last character, and hit delete.  Afterward, the table should contain 'foobar'.</p>
+<div contenteditable="true">
+<table border="1"><tr><td width="100px"><span id="span">foo</span></td></tr></table>
+<div id="end">bar</div>
+</div>
+
+<script>
+if (window.layoutTestController) {
+    span = document.getElementById("span");
+    x = span.offsetParent.offsetLeft + span.offsetLeft + span.offsetWidth + 10;
+    y = span.offsetParent.offsetParent.offsetTop + span.offsetParent.offsetTop + span.offsetTop + span.offsetHeight / 2;
+    alert(x);
+    alert(y);
+
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+</script>
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/editing/selection/5057506-2-expected.checksum b/LayoutTests/platform/mac/editing/selection/5057506-2-expected.checksum
new file mode 100644 (file)
index 0000000..07c7f07
--- /dev/null
@@ -0,0 +1 @@
+0a69f9a5cfb2e6402172e0688c427149
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/editing/selection/5057506-2-expected.png b/LayoutTests/platform/mac/editing/selection/5057506-2-expected.png
new file mode 100644 (file)
index 0000000..9eecb91
Binary files /dev/null and b/LayoutTests/platform/mac/editing/selection/5057506-2-expected.png differ
diff --git a/LayoutTests/platform/mac/editing/selection/5057506-2-expected.txt b/LayoutTests/platform/mac/editing/selection/5057506-2-expected.txt
new file mode 100644 (file)
index 0000000..8ebb4fb
--- /dev/null
@@ -0,0 +1,30 @@
+ALERT: 34
+ALERT: 108
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x72
+        RenderText {#text} at (0,0) size 779x72
+          text run at (0,0) width 489: "This tests triple clicking after the last character in the last cell of a block table. "
+          text run at (489,0) width 278: "The paragraph break (the space between the"
+          text run at (0,18) width 490: "last character and the first character in the next paragraph) should be selected. "
+          text run at (490,18) width 289: "Selection painting problems might prevent the"
+          text run at (0,36) width 389: "paragraph break from appearing as selected even though it is. "
+          text run at (389,36) width 387: "To test manually, triple click inside the table cell, after the last"
+          text run at (0,54) width 157: "character, and hit delete. "
+          text run at (157,54) width 288: "Afterward, the table should contain only 'bar'."
+      RenderBlock {DIV} at (0,88) size 784x46
+        RenderTable {TABLE} at (0,0) size 110x28 [border: (1px outset #808080)]
+          RenderTableSection {TBODY} at (1,1) size 108x26
+            RenderTableRow {TR} at (0,2) size 108x22
+              RenderTableCell {TD} at (2,2) size 104x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                RenderInline {SPAN} at (0,0) size 21x18
+                  RenderText {#text} at (2,2) size 21x18
+                    text run at (2,2) width 21: "foo"
+        RenderBlock {DIV} at (0,28) size 784x18
+          RenderText {#text} at (0,0) size 20x18
+            text run at (0,0) width 20: "bar"
+selection start: position 0 of child 0 {#text} of child 0 {SPAN} of child 0 {TD} of child 0 {TR} of child 0 {TBODY} of child 1 {TABLE} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
+selection end:   position 0 of child 3 {DIV} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/platform/mac/editing/selection/5057506-expected.checksum b/LayoutTests/platform/mac/editing/selection/5057506-expected.checksum
new file mode 100644 (file)
index 0000000..2738208
--- /dev/null
@@ -0,0 +1 @@
+6e2cb85c69b32ab4c0feba2ef073a7ac
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/editing/selection/5057506-expected.png b/LayoutTests/platform/mac/editing/selection/5057506-expected.png
new file mode 100644 (file)
index 0000000..db6d6f1
Binary files /dev/null and b/LayoutTests/platform/mac/editing/selection/5057506-expected.png differ
diff --git a/LayoutTests/platform/mac/editing/selection/5057506-expected.txt b/LayoutTests/platform/mac/editing/selection/5057506-expected.txt
new file mode 100644 (file)
index 0000000..65e6631
--- /dev/null
@@ -0,0 +1,30 @@
+ALERT: 34
+ALERT: 108
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x72
+        RenderText {#text} at (0,0) size 779x72
+          text run at (0,0) width 500: "This tests double clicking after the last character in the last cell of a block table. "
+          text run at (500,0) width 278: "The paragraph break (the space between the"
+          text run at (0,18) width 490: "last character and the first character in the next paragraph) should be selected. "
+          text run at (490,18) width 289: "Selection painting problems might prevent the"
+          text run at (0,36) width 389: "paragraph break from appearing as selected even though it is. "
+          text run at (389,36) width 373: "To test manually, double click inside the table cell, after the"
+          text run at (0,54) width 182: "last character, and hit delete. "
+          text run at (182,54) width 277: "Afterward, the table should contain 'foobar'."
+      RenderBlock {DIV} at (0,88) size 784x46
+        RenderTable {TABLE} at (0,0) size 110x28 [border: (1px outset #808080)]
+          RenderTableSection {TBODY} at (1,1) size 108x26
+            RenderTableRow {TR} at (0,2) size 108x22
+              RenderTableCell {TD} at (2,2) size 104x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                RenderInline {SPAN} at (0,0) size 21x18
+                  RenderText {#text} at (2,2) size 21x18
+                    text run at (2,2) width 21: "foo"
+        RenderBlock {DIV} at (0,28) size 784x18
+          RenderText {#text} at (0,0) size 20x18
+            text run at (0,0) width 20: "bar"
+selection start: position 3 of child 0 {#text} of child 0 {SPAN} of child 0 {TD} of child 0 {TR} of child 0 {TBODY} of child 1 {TABLE} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
+selection end:   position 0 of child 3 {DIV} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
index 633bb640a62ede10d562c0b59e7a839ad4f96e1a..46631849d17afe8115b44393ecfce6ca2a41a7ce 100644 (file)
@@ -1,3 +1,42 @@
+2007-09-07  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by Darin.
+        
+        <rdar://problem/5057506> Double-clicking after ToDo content doesn't select the paragraph break
+        
+        * editing/Selection.cpp:
+        (WebCore::Selection::validate):
+        Moved the code that moves across a paragraph boundary
+        when expanding selections by word granularity from
+        endOfWord to here.
+        In the word and paragraph granularity cases, if the 
+        end of the selection is at the end of the last paragraph 
+        in the last cell of a block table, expand it so that 
+        it ends at the start of the paragraph after the table, 
+        instead of just after the table, so that ToDo content 
+        gets the same double/tripled click behavior that normal 
+        paragraphs get (added two testcases).
+        When expanding the selection to include paragraph
+        breaks, pass VisiblePosition::next true so that it
+        doesn't change editability.
+        * editing/VisiblePosition.cpp:
+        (WebCore::VisiblePosition::next): Renamed the bool because it's now also
+        used to keep non-editable positions non-editable.
+        (WebCore::VisiblePosition::previous): Ditto.
+        (WebCore::VisiblePosition::lastPositionWithSameEditabilityAtOrBefore):
+        Renamed this function and made it also work with non-editable positions.
+        (WebCore::VisiblePosition::firstPositionWithSameEditabilityAtOrAfter):
+        Ditto.
+        * editing/VisiblePosition.h:
+        * editing/visible_units.cpp:
+        (WebCore::endOfWord): Called the renamed function.
+        (WebCore::previousWordPosition): Ditto.
+        (WebCore::nextWordPosition): Ditto.
+        (WebCore::startOfLine): Ditto.
+        (WebCore::endOfLine): Ditto.
+        (WebCore::previousSentencePosition): Ditto.
+        (WebCore::nextSentencePosition): Ditto.
+
 2007-09-07  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Sam
index 6c4836b8334d270bbfb029fd482a2eb696a8a07a..73e9ad394bae76cc03f1d61d90224b40bd2a4042 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
index 771d67fc7937da8710f6a3d7e3c32ba20116d14e..07cbf39de08b1aad7f3ea9f9a15581089d994bd7 100644 (file)
@@ -232,15 +232,37 @@ void Selection::validate()
             // Edge case: If the caret is after the last word in a paragraph, select from the the end of the
             // last word to the line break (also RightWordIfOnBoundary);
             VisiblePosition start = VisiblePosition(m_start, m_affinity);
-            VisiblePosition end   = VisiblePosition(m_end, m_affinity);
+            VisiblePosition originalEnd(m_end, m_affinity);
             EWordSide side = RightWordIfOnBoundary;
             if (isEndOfDocument(start) || (isEndOfLine(start) && !isStartOfLine(start) && !isEndOfParagraph(start)))
                 side = LeftWordIfOnBoundary;
             m_start = startOfWord(start, side).deepEquivalent();
             side = RightWordIfOnBoundary;
-            if (isEndOfDocument(end) || (isEndOfLine(end) && !isStartOfLine(end) && !isEndOfParagraph(end)))
+            if (isEndOfDocument(originalEnd) || (isEndOfLine(originalEnd) && !isStartOfLine(originalEnd) && !isEndOfParagraph(originalEnd)))
                 side = LeftWordIfOnBoundary;
-            m_end = endOfWord(end, side).deepEquivalent();
+                
+            VisiblePosition wordEnd(endOfWord(originalEnd, side));
+            VisiblePosition end(wordEnd);
+            
+            if (isEndOfParagraph(originalEnd)) {
+                // Select the paragraph break (the space from the end of a paragraph to the start of
+                // the next one) to match TextEdit.
+                end = wordEnd.next(true);
+                
+                if (Node* table = isFirstPositionAfterTable(end)) {
+                    // The paragraph break after the last paragraph in the last cell of a block table ends
+                    // at the start of the paragraph after the table.
+                    if (isBlock(table))
+                        end = end.next(true);
+                    else
+                        end = wordEnd;
+                }
+                
+                if (end.isNull())
+                    end = wordEnd;
+            }
+            
+            m_end = end.deepEquivalent();
             break;
         }
         case SentenceGranularity: {
@@ -281,6 +303,25 @@ void Selection::validate()
                 if (visibleParagraphEnd.deepEquivalent().node()->isDescendantOf(m_end.node()))
                     m_end = visibleParagraphEnd.deepEquivalent();
             }
+            
+            // Include the "paragraph break" (the space from the end of this paragraph to the start
+            // of the next one) in the selection.
+            VisiblePosition end(visibleParagraphEnd.next(true));
+            
+            if (Node* table = isFirstPositionAfterTable(end)) {
+                // The paragraph break after the last paragraph in the last cell of a block table ends
+                // at the start of the paragraph after the table, not at the position just after the table.
+                if (isBlock(table))
+                    end = end.next(true);
+                // There is no parargraph break after the last paragraph in the last cell of an inline table.
+                else
+                    end = visibleParagraphEnd;
+            }
+            
+            if (end.isNull())
+                end = visibleParagraphEnd;
+
+            m_end = end.deepEquivalent();
             break;
         }
         case DocumentBoundary:
index a325bfb389d6c6450bdf6a1b5eeaa056cb0da287..41a767f58e7d1a2b6ba2a39f814ebd8a380eef26 100644 (file)
@@ -62,17 +62,17 @@ void VisiblePosition::init(const Position& position, EAffinity affinity)
         m_affinity = DOWNSTREAM;
 }
 
-VisiblePosition VisiblePosition::next(bool stayInEditableContent) const
+VisiblePosition VisiblePosition::next(bool dontChangeEditability) const
 {
     VisiblePosition next(nextVisuallyDistinctCandidate(m_deepPosition), m_affinity);
     
-    if (!stayInEditableContent)
+    if (!dontChangeEditability)
         return next;
     
-    return firstEditablePositionAtOrAfter(next);
+    return firstPositionWithSameEditabilityAtOrAfter(next);
 }
 
-VisiblePosition VisiblePosition::previous(bool stayInEditableContent) const
+VisiblePosition VisiblePosition::previous(bool dontChangeEditability) const
 {
     // find first previous DOM position that is visible
     Position pos = previousVisuallyDistinctCandidate(m_deepPosition);
@@ -94,40 +94,52 @@ VisiblePosition VisiblePosition::previous(bool stayInEditableContent) const
     }
 #endif
 
-    if (!stayInEditableContent)
+    if (!dontChangeEditability)
         return prev;
     
-    return lastEditablePositionAtOrBefore(prev);
+    return lastPositionWithSameEditabilityAtOrBefore(prev);
 }
 
-VisiblePosition VisiblePosition::lastEditablePositionAtOrBefore(const VisiblePosition &pos) const
+VisiblePosition VisiblePosition::lastPositionWithSameEditabilityAtOrBefore(const VisiblePosition &pos) const
 {
     if (pos.isNull())
         return pos;
     
     Node* highestRoot = highestEditableRoot(deepEquivalent());
     
-    if (!pos.deepEquivalent().node()->isDescendantOf(highestRoot))
+    if (highestRoot && !pos.deepEquivalent().node()->isDescendantOf(highestRoot))
         return VisiblePosition();
         
+    // FIXME: In the non-editable case, just because the new position is non-editable doesn't mean movement
+    // to it is allowed.  Selection::adjustForEditableContent has this problem too.
     if (highestEditableRoot(pos.deepEquivalent()) == highestRoot)
         return pos;
+    
+    // FIXME: Move to the previous non-editable region.
+    if (!highestRoot)
+        return VisiblePosition();
 
     return lastEditablePositionBeforePositionInRoot(pos.deepEquivalent(), highestRoot);
 }
 
-VisiblePosition VisiblePosition::firstEditablePositionAtOrAfter(const VisiblePosition &pos) const
+VisiblePosition VisiblePosition::firstPositionWithSameEditabilityAtOrAfter(const VisiblePosition &pos) const
 {
     if (pos.isNull())
         return pos;
     
     Node* highestRoot = highestEditableRoot(deepEquivalent());
     
-    if (!pos.deepEquivalent().node()->isDescendantOf(highestRoot))
+    if (highestRoot && !pos.deepEquivalent().node()->isDescendantOf(highestRoot))
         return VisiblePosition();
         
+    // FIXME: In the non-editable case, just because the new position is non-editable doesn't mean movement
+    // to it is allowed.  Selection::adjustForEditableContent has this problem too.
     if (highestEditableRoot(pos.deepEquivalent()) == highestRoot)
         return pos;
+        
+    // FIXME: Move to the previous non-editable region.
+    if (!highestRoot)
+        return VisiblePosition();
 
     return firstEditablePositionAfterPositionInRoot(pos.deepEquivalent(), highestRoot);
 }
index 64ebd61047e90ba3617458b82ac7ccad2233689a..597e859326de5f9eb6eb4edde857107da4a9f77f 100644 (file)
@@ -63,8 +63,8 @@ public:
     // next() and previous() will increment/decrement by a character cluster.
     VisiblePosition next(bool stayInEditableContent = false) const;
     VisiblePosition previous(bool stayInEditableContent = false) const;
-    VisiblePosition lastEditablePositionAtOrBefore(const VisiblePosition&) const;
-    VisiblePosition firstEditablePositionAtOrAfter(const VisiblePosition&) const;
+    VisiblePosition lastPositionWithSameEditabilityAtOrBefore(const VisiblePosition&) const;
+    VisiblePosition firstPositionWithSameEditabilityAtOrAfter(const VisiblePosition&) const;
 
     UChar characterAfter() const;
     UChar characterBefore() const { return previous().characterAfter(); }
index 008c05f74d7deb03d992743fb98879a3d825445a..7361a824457a0ad621aeb097c59a2271bf81cf7c 100644 (file)
@@ -217,13 +217,8 @@ VisiblePosition endOfWord(const VisiblePosition &c, EWordSide side)
         p = c.previous();
         if (p.isNull())
             return c;
-    } else {
-        // at paragraph end, the endOfWord is the start of next paragraph
-        if (isEndOfParagraph(c)) {
-            p = c.next();
-            return p.isNotNull() ? p : c;
-        }
-    }
+    } else if (isEndOfParagraph(c))
+        return c;
     
     return nextBoundary(p, endWordBoundary);
 }
@@ -236,7 +231,7 @@ static unsigned previousWordPositionBoundary(const UChar* characters, unsigned l
 VisiblePosition previousWordPosition(const VisiblePosition &c)
 {
     VisiblePosition prev = previousBoundary(c, previousWordPositionBoundary);
-    return c.firstEditablePositionAtOrAfter(prev);
+    return c.firstPositionWithSameEditabilityAtOrAfter(prev);
 }
 
 static unsigned nextWordPositionBoundary(const UChar* characters, unsigned length)
@@ -247,7 +242,7 @@ static unsigned nextWordPositionBoundary(const UChar* characters, unsigned lengt
 VisiblePosition nextWordPosition(const VisiblePosition &c)
 {
     VisiblePosition next = nextBoundary(c, nextWordPositionBoundary);    
-    return c.lastEditablePositionAtOrBefore(next);
+    return c.lastPositionWithSameEditabilityAtOrBefore(next);
 }
 
 // ---------
@@ -341,7 +336,7 @@ VisiblePosition startOfLine(const VisiblePosition& c)
         }
     }
 
-    return c.firstEditablePositionAtOrAfter(visPos);
+    return c.firstPositionWithSameEditabilityAtOrAfter(visPos);
 }
 
 static VisiblePosition endPositionForLine(const VisiblePosition& c)
@@ -408,7 +403,7 @@ VisiblePosition endOfLine(const VisiblePosition& c)
         visPos = endPositionForLine(visPos);
     }
     
-    return c.lastEditablePositionAtOrBefore(visPos);
+    return c.lastPositionWithSameEditabilityAtOrBefore(visPos);
 }
 
 bool inSameLine(const VisiblePosition &a, const VisiblePosition &b)
@@ -604,7 +599,7 @@ static unsigned previousSentencePositionBoundary(const UChar* characters, unsign
 VisiblePosition previousSentencePosition(const VisiblePosition &c)
 {
     VisiblePosition prev = previousBoundary(c, previousSentencePositionBoundary);
-    return c.firstEditablePositionAtOrAfter(prev);
+    return c.firstPositionWithSameEditabilityAtOrAfter(prev);
 }
 
 static unsigned nextSentencePositionBoundary(const UChar* characters, unsigned length)
@@ -618,7 +613,7 @@ static unsigned nextSentencePositionBoundary(const UChar* characters, unsigned l
 VisiblePosition nextSentencePosition(const VisiblePosition &c)
 {
     VisiblePosition next = nextBoundary(c, nextSentencePositionBoundary);    
-    return c.lastEditablePositionAtOrBefore(next);
+    return c.lastPositionWithSameEditabilityAtOrBefore(next);
 }
 
 // FIXME: Broken for positions before/after images that aren't inline (5027702)