LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2006 19:52:27 +0000 (19:52 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2006 19:52:27 +0000 (19:52 +0000)
        Reviewed by harrison

        <rdar://problem/4655880> Up/Down arrows skip over To Do

        * editing/selection/mixed-editability-3-expected.checksum: Added.
        * editing/selection/mixed-editability-3-expected.png: Added.
        * editing/selection/mixed-editability-3-expected.txt: Added.
        * editing/selection/mixed-editability-3.html: Added.
        * editing/selection/mixed-editability-4-expected.checksum: Added.
        * editing/selection/mixed-editability-4-expected.png: Added.
        * editing/selection/mixed-editability-4-expected.txt: Added.
        * editing/selection/mixed-editability-4.html: Added.
        * editing/selection/mixed-editability-5-expected.checksum: Added.
        * editing/selection/mixed-editability-5-expected.png: Added.
        * editing/selection/mixed-editability-5-expected.txt: Added.
        * editing/selection/mixed-editability-5.html: Added.

WebCore:

        Reviewed by harrison

        <rdar://problem/4655880> Up/Down arrows skip over To Do

        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge canDeleteRange:]): Added a FIXME.
        * dom/Node.cpp: Removed the unused inSameRootEditableElement.
        * dom/Node.h:
        * editing/SelectionController.cpp:
        (WebCore::SelectionController::modify): Added documentboundary to granularities in order test a fix.
        * editing/visible_units.cpp:
        (WebCore::previousLinePosition): Use highestEditableRoot so that this function can move from
        editable content into editable content that's embedded in non-editable content.
        (WebCore::nextLinePosition): Ditto.
        (WebCore::startOfEditableContent): Renamed from startOfEditableRoot and use highestEditableRoot.
        This is the behavior that callers desire.  This fixes Command + Up/Down.
        (WebCore::endOfEditableContent): Ditto.
        * editing/visible_units.h:

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

21 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/selection/mixed-editability-3-expected.checksum [new file with mode: 0644]
LayoutTests/editing/selection/mixed-editability-3-expected.png [new file with mode: 0644]
LayoutTests/editing/selection/mixed-editability-3-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/mixed-editability-3.html [new file with mode: 0644]
LayoutTests/editing/selection/mixed-editability-4-expected.checksum [new file with mode: 0644]
LayoutTests/editing/selection/mixed-editability-4-expected.png [new file with mode: 0644]
LayoutTests/editing/selection/mixed-editability-4-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/mixed-editability-4.html [new file with mode: 0644]
LayoutTests/editing/selection/mixed-editability-5-expected.checksum [new file with mode: 0644]
LayoutTests/editing/selection/mixed-editability-5-expected.png [new file with mode: 0644]
LayoutTests/editing/selection/mixed-editability-5-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/mixed-editability-5.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bridge/mac/WebCoreFrameBridge.mm
WebCore/dom/Node.cpp
WebCore/dom/Node.h
WebCore/editing/SelectionController.cpp
WebCore/editing/visible_units.cpp
WebCore/editing/visible_units.h

index b065da4b6681c10a910945fee27fd7c693cb2a4d..4988269681d879f67e56d794f33e5161ec1bc329 100644 (file)
@@ -1,3 +1,22 @@
+2006-09-14  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <rdar://problem/4655880> Up/Down arrows skip over To Do
+
+        * editing/selection/mixed-editability-3-expected.checksum: Added.
+        * editing/selection/mixed-editability-3-expected.png: Added.
+        * editing/selection/mixed-editability-3-expected.txt: Added.
+        * editing/selection/mixed-editability-3.html: Added.
+        * editing/selection/mixed-editability-4-expected.checksum: Added.
+        * editing/selection/mixed-editability-4-expected.png: Added.
+        * editing/selection/mixed-editability-4-expected.txt: Added.
+        * editing/selection/mixed-editability-4.html: Added.
+        * editing/selection/mixed-editability-5-expected.checksum: Added.
+        * editing/selection/mixed-editability-5-expected.png: Added.
+        * editing/selection/mixed-editability-5-expected.txt: Added.
+        * editing/selection/mixed-editability-5.html: Added.
+
 2006-09-14  Graham Dennis  <graham.dennis@gmail.com>
 
         Reviewed by Justin Garcia.
diff --git a/LayoutTests/editing/selection/mixed-editability-3-expected.checksum b/LayoutTests/editing/selection/mixed-editability-3-expected.checksum
new file mode 100644 (file)
index 0000000..e5fe376
--- /dev/null
@@ -0,0 +1 @@
+ea15d1992fb7b8803e6583675cd95c85
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/mixed-editability-3-expected.png b/LayoutTests/editing/selection/mixed-editability-3-expected.png
new file mode 100644 (file)
index 0000000..cea842a
Binary files /dev/null and b/LayoutTests/editing/selection/mixed-editability-3-expected.png differ
diff --git a/LayoutTests/editing/selection/mixed-editability-3-expected.txt b/LayoutTests/editing/selection/mixed-editability-3-expected.txt
new file mode 100644 (file)
index 0000000..95ded94
--- /dev/null
@@ -0,0 +1,32 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 1 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 784x36
+        RenderText {#text} at (0,0) size 754x36
+          text run at (0,0) width 459: "This tests moving the caret forward through content of mixed editability. "
+          text run at (459,0) width 295: "The caret should move down one line from the"
+          text run at (0,18) width 470: "editable piece to the editable piece that's embedded in a non-editable piece."
+      RenderBlock {DIV} at (0,52) size 784x64
+        RenderBlock (anonymous) at (0,0) size 784x18
+          RenderText {#text} at (0,0) size 49x18
+            text run at (0,0) width 49: "editable"
+        RenderTable {TABLE} at (0,18) size 59x28 [border: (1px outset #808080)]
+          RenderTableSection {TBODY} at (1,1) size 57x26
+            RenderTableRow {TR} at (0,2) size 57x22
+              RenderTableCell {TD} at (2,2) size 53x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 49x18
+                  text run at (2,2) width 49: "editable"
+        RenderBlock (anonymous) at (0,46) size 784x18
+          RenderText {#text} at (0,0) size 49x18
+            text run at (0,0) width 49: "editable"
+caret: position 0 of child 0 {#text} 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
diff --git a/LayoutTests/editing/selection/mixed-editability-3.html b/LayoutTests/editing/selection/mixed-editability-3.html
new file mode 100644 (file)
index 0000000..d2d08f3
--- /dev/null
@@ -0,0 +1,16 @@
+<p>This tests moving the caret forward through content of mixed editability.  The caret should move down one line from the editable piece to the editable piece that's embedded in a non-editable piece.</p>
+
+<div contenteditable="true" id="test">
+editable
+<table border="1" contenteditable="false"><tr><td contenteditable="true">editable</td></tr></table>
+editable
+</div>
+
+<script>
+var e = document.getElementById("test");
+var s = window.getSelection();
+
+s.setPosition(e, 0);
+
+s.modify("move", "forward", "line");
+</script>
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/mixed-editability-4-expected.checksum b/LayoutTests/editing/selection/mixed-editability-4-expected.checksum
new file mode 100644 (file)
index 0000000..60e0cf8
--- /dev/null
@@ -0,0 +1 @@
+592209256035f36c3d2c6b25a6e7f245
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/mixed-editability-4-expected.png b/LayoutTests/editing/selection/mixed-editability-4-expected.png
new file mode 100644 (file)
index 0000000..b750db8
Binary files /dev/null and b/LayoutTests/editing/selection/mixed-editability-4-expected.png differ
diff --git a/LayoutTests/editing/selection/mixed-editability-4-expected.txt b/LayoutTests/editing/selection/mixed-editability-4-expected.txt
new file mode 100644 (file)
index 0000000..48acbc1
--- /dev/null
@@ -0,0 +1,32 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 1 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 1 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 784x36
+        RenderText {#text} at (0,0) size 754x36
+          text run at (0,0) width 459: "This tests moving the caret forward through content of mixed editability. "
+          text run at (459,0) width 295: "The caret should move down one line from the"
+          text run at (0,18) width 470: "editable piece to the editable piece that's embedded in a non-editable piece."
+      RenderBlock {DIV} at (0,52) size 784x64
+        RenderBlock (anonymous) at (0,0) size 784x18
+          RenderText {#text} at (0,0) size 49x18
+            text run at (0,0) width 49: "editable"
+        RenderTable {TABLE} at (0,18) size 59x28 [border: (1px outset #808080)]
+          RenderTableSection {TBODY} at (1,1) size 57x26
+            RenderTableRow {TR} at (0,2) size 57x22
+              RenderTableCell {TD} at (2,2) size 53x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 49x18
+                  text run at (2,2) width 49: "editable"
+        RenderBlock (anonymous) at (0,46) size 784x18
+          RenderText {#text} at (0,0) size 49x18
+            text run at (0,0) width 49: "editable"
+caret: position 2 of child 0 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/selection/mixed-editability-4.html b/LayoutTests/editing/selection/mixed-editability-4.html
new file mode 100644 (file)
index 0000000..2813157
--- /dev/null
@@ -0,0 +1,16 @@
+<p>This tests moving the caret forward through content of mixed editability.  The caret should move down one line from the editable piece to the editable piece that's embedded in a non-editable piece.</p>
+
+<div contenteditable="true">
+editable
+<table border="1" contenteditable="false"><tr><td contenteditable="true" id="test">editable</td></tr></table>
+editable
+</div>
+
+<script>
+var e = document.getElementById("test");
+var s = window.getSelection();
+
+s.setPosition(e, 0);
+
+s.modify("move", "backward", "line");
+</script>
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/mixed-editability-5-expected.checksum b/LayoutTests/editing/selection/mixed-editability-5-expected.checksum
new file mode 100644 (file)
index 0000000..69d22dc
--- /dev/null
@@ -0,0 +1 @@
+e288d0e5cccccc08bb276fa070e4e7fd
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/mixed-editability-5-expected.png b/LayoutTests/editing/selection/mixed-editability-5-expected.png
new file mode 100644 (file)
index 0000000..5911e6e
Binary files /dev/null and b/LayoutTests/editing/selection/mixed-editability-5-expected.png differ
diff --git a/LayoutTests/editing/selection/mixed-editability-5-expected.txt b/LayoutTests/editing/selection/mixed-editability-5-expected.txt
new file mode 100644 (file)
index 0000000..3359d0d
--- /dev/null
@@ -0,0 +1,32 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 1 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 1 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 784x36
+        RenderText {#text} at (0,0) size 754x36
+          text run at (0,0) width 459: "This tests moving the caret forward through content of mixed editability. "
+          text run at (459,0) width 295: "The caret should move down one line from the"
+          text run at (0,18) width 470: "editable piece to the editable piece that's embedded in a non-editable piece."
+      RenderBlock {DIV} at (0,52) size 784x64
+        RenderBlock (anonymous) at (0,0) size 784x18
+          RenderText {#text} at (0,0) size 49x18
+            text run at (0,0) width 49: "editable"
+        RenderTable {TABLE} at (0,18) size 59x28 [border: (1px outset #808080)]
+          RenderTableSection {TBODY} at (1,1) size 57x26
+            RenderTableRow {TR} at (0,2) size 57x22
+              RenderTableCell {TD} at (2,2) size 53x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                RenderText {#text} at (2,2) size 49x18
+                  text run at (2,2) width 49: "editable"
+        RenderBlock (anonymous) at (0,46) size 784x18
+          RenderText {#text} at (0,0) size 49x18
+            text run at (0,0) width 49: "editable"
+caret: position 9 of child 2 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/selection/mixed-editability-5.html b/LayoutTests/editing/selection/mixed-editability-5.html
new file mode 100644 (file)
index 0000000..827f7bb
--- /dev/null
@@ -0,0 +1,16 @@
+<p>This tests moving the caret forward through content of mixed editability.  The caret should move down one line from the editable piece to the editable piece that's embedded in a non-editable piece.</p>
+
+<div contenteditable="true">
+editable
+<table border="1" contenteditable="false"><tr><td contenteditable="true" id="test">editable</td></tr></table>
+editable
+</div>
+
+<script>
+var e = document.getElementById("test");
+var s = window.getSelection();
+
+s.setPosition(e, 0);
+
+s.modify("move", "forward", "documentBoundary");
+</script>
\ No newline at end of file
index 675db8cce22f416af399a1303e0cddf1f3544012..fa463d2319dcd8f0767556de18eddf06d0e8be19 100644 (file)
@@ -1,3 +1,24 @@
+2006-09-14  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by harrison
+        
+        <rdar://problem/4655880> Up/Down arrows skip over To Do
+
+        * bridge/mac/WebCoreFrameBridge.mm:
+        (-[WebCoreFrameBridge canDeleteRange:]): Added a FIXME.
+        * dom/Node.cpp: Removed the unused inSameRootEditableElement.
+        * dom/Node.h:
+        * editing/SelectionController.cpp:
+        (WebCore::SelectionController::modify): Added documentboundary to granularities in order test a fix.
+        * editing/visible_units.cpp:
+        (WebCore::previousLinePosition): Use highestEditableRoot so that this function can move from
+        editable content into editable content that's embedded in non-editable content.
+        (WebCore::nextLinePosition): Ditto.
+        (WebCore::startOfEditableContent): Renamed from startOfEditableRoot and use highestEditableRoot.
+        This is the behavior that callers desire.  This fixes Command + Up/Down.
+        (WebCore::endOfEditableContent): Ditto.
+        * editing/visible_units.h:
+
 2006-09-14  Karthik Kumar  <karthikkumar@gmail.com>
 
         Reviewed by timothy. Landed by aroben.
index 8606663bb80100576bc9dd58ba3e31eae54521fb..426766e57c6e6f4056f522806c9fcd2dfb83bcd7 100644 (file)
                        mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
-                       projectRoot = "";
                        targets = (
                                93F198A508245E59001E9ABC /* WebCore */,
                                DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
index 80c2e0b4f22aefb45193d6221531d5503abab1aa..270751caebb80df2f10fd699df895dbe46c34f86 100644 (file)
@@ -1867,7 +1867,9 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
     
     if ([range collapsed]) {
         VisiblePosition start(startContainer, [range startOffset], DOWNSTREAM);
-        if (isStartOfEditableContent(start))
+        VisiblePosition previous = start.previous();
+        // FIXME: We sometimes allow deletions at the start of editable roots, like when the caret is in an empty list item.
+        if (previous.isNull() || previous.deepEquivalent().node()->rootEditableElement() != startContainer->rootEditableElement())
             return NO;
     }
     
index 8dfc6ac3754740c5f3df22690630964beea905fa..df30291499814c59d5936e35ae6248e9e3161200 100644 (file)
@@ -1058,11 +1058,6 @@ Element* Node::rootEditableElement() const
     return result;
 }
 
-bool Node::inSameRootEditableElement(Node *n)
-{
-    return n ? rootEditableElement() == n->rootEditableElement() : false;
-}
-
 bool Node::inSameContainingBlockFlowElement(Node *n)
 {
     return n ? enclosingBlockFlowElement() == n->enclosingBlockFlowElement() : false;
index 59817e041b13dc031c4513980ad3f64826c722b0..869d2448cc0b951185db8a509f308ad536eadab4 100644 (file)
@@ -181,7 +181,6 @@ public:
     Element* enclosingInlineElement() const;
     Element* rootEditableElement() const;
     
-    bool inSameRootEditableElement(Node*);
     bool inSameContainingBlockFlowElement(Node*);
     
     // Used by the parser. Checks against the DTD, unlike DOM operations like appendChild().
index e59f017bb3a9699ac5661e77a3eadc56277b8cb4..ad316d8fc02367eba8b5a81168bbf3504dc8d4de 100644 (file)
@@ -430,6 +430,8 @@ bool SelectionController::modify(const String &alterString, const String &direct
         granularity = LineGranularity;
     else if (granularityStringLower == "paragraph")
         granularity = ParagraphGranularity;
+    else if (granularityStringLower == "documentboundary")
+        granularity = DocumentBoundary;
     else
         return false;
                 
index 0dcea605f4ef957db73038773a9b7f63ae20f504..d34d442aa04129698a690d08fec947678b60cfaf 100644 (file)
@@ -377,6 +377,7 @@ VisiblePosition previousLinePosition(const VisiblePosition &visiblePosition, int
 {
     Position p = visiblePosition.deepEquivalent();
     Node *node = p.node();
+    Node* highestRoot = highestEditableRoot(p);
     if (!node)
         return VisiblePosition();
     
@@ -404,7 +405,7 @@ VisiblePosition previousLinePosition(const VisiblePosition &visiblePosition, int
         while (n && startBlock == n->enclosingBlockFlowElement())
             n = n->previousEditable();
         while (n) {
-            if (!n->inSameRootEditableElement(node))
+            if (highestEditableRoot(Position(n, 0)) != highestRoot)
                 break;
             Position pos(n, n->caretMinOffset());
             if (pos.inRenderedContent()) {
@@ -445,6 +446,7 @@ VisiblePosition nextLinePosition(const VisiblePosition &visiblePosition, int x)
 {
     Position p = visiblePosition.deepEquivalent();
     Node *node = p.node();
+    Node* highestRoot = highestEditableRoot(p);
     if (!node)
         return VisiblePosition();
     
@@ -472,7 +474,7 @@ VisiblePosition nextLinePosition(const VisiblePosition &visiblePosition, int x)
         while (n && startBlock == n->enclosingBlockFlowElement())
             n = n->nextEditable();
         while (n) {
-            if (!n->inSameRootEditableElement(node))
+            if (highestEditableRoot(Position(n, 0)) != highestRoot)
                 break;
             Position pos(n, n->caretMinOffset());
             if (pos.inRenderedContent()) {
@@ -815,56 +817,22 @@ bool isEndOfDocument(const VisiblePosition &p)
 
 // ---------
 
-VisiblePosition startOfEditableContent(const VisiblePosition &c)
+VisiblePosition startOfEditableContent(const VisiblePosition& visiblePosition)
 {
-    Position p = c.deepEquivalent();
-    Node *node = p.node();
-    if (!node)
+    Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent());
+    if (!highestRoot)
         return VisiblePosition();
 
-    return VisiblePosition(node->rootEditableElement(), 0, DOWNSTREAM);
+    return VisiblePosition(highestRoot, 0, DOWNSTREAM);
 }
 
-VisiblePosition endOfEditableContent(const VisiblePosition &c)
+VisiblePosition endOfEditableContent(const VisiblePosition& visiblePosition)
 {
-    Position p = c.deepEquivalent();
-    Node *node = p.node();
-    if (!node)
+    Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent());
+    if (!highestRoot)
         return VisiblePosition();
 
-    node = node->rootEditableElement();
-    if (!node)
-        return VisiblePosition();
-
-    return VisiblePosition(node, node->childNodeCount(), DOWNSTREAM);
-}
-
-bool inSameEditableContent(const VisiblePosition &a, const VisiblePosition &b)
-{
-    Position ap = a.deepEquivalent();
-    Node *an = ap.node();
-    if (!an)
-        return false;
-        
-    Position bp = b.deepEquivalent();
-    Node *bn = bp.node();
-    if (!bn)
-        return false;
-    
-    if (!an->isContentEditable() || !bn->isContentEditable())
-        return false;
-
-    return an->rootEditableElement() == bn->rootEditableElement();
-}
-
-bool isStartOfEditableContent(const VisiblePosition &p)
-{
-    return !inSameEditableContent(p, p.previous());
-}
-
-bool isEndOfEditableContent(const VisiblePosition &p)
-{
-    return !inSameEditableContent(p, p.next());
+    return VisiblePosition(highestRoot, maxDeepOffset(highestRoot), DOWNSTREAM);
 }
 
 }
index 75fe8e2060f06559ec86cc6c3da621a8993bae20..39a938bcf0a11b1765286150e292b0cd7475ed35 100644 (file)
@@ -82,11 +82,8 @@ bool isStartOfDocument(const VisiblePosition &);
 bool isEndOfDocument(const VisiblePosition &);
 
 // editable content
-VisiblePosition startOfEditableContent(const VisiblePosition &);
-VisiblePosition endOfEditableContent(const VisiblePosition &);
-bool inSameEditableContent(const VisiblePosition &, const VisiblePosition &);
-bool isStartOfEditableContent(const VisiblePosition &);
-bool isEndOfEditableContent(const VisiblePosition &);
+VisiblePosition startOfEditableContent(const VisiblePosition&);
+VisiblePosition endOfEditableContent(const VisiblePosition&);
 
 } // namespace WebCore