LayoutTests:
authorjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jul 2006 23:13:20 +0000 (23:13 +0000)
committerjusting <justing@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Jul 2006 23:13:20 +0000 (23:13 +0000)
        Reviewed by adele

        <rdar://problem/4649560>
        REGRESSION: Can't Select All when the body is contentEditable="true"

        * editing/selection/select-all-005-expected.checksum: Added.
        * editing/selection/select-all-005-expected.png: Added.
        * editing/selection/select-all-005-expected.txt: Added.
        * editing/selection/select-all-005.html: Added.
        * editing/selection/select-all-006-expected.checksum: Added.
        * editing/selection/select-all-006-expected.png: Added.
        * editing/selection/select-all-006-expected.txt: Added.
        * editing/selection/select-all-006.html: Added.

WebCore:

        Reviewed by adele

        <rdar://problem/4649560>
        REGRESSION: Can't Select All when the body is contentEditable="true"

        * editing/VisiblePosition.cpp:
        (WebCore::VisiblePosition::canonicalPosition): Allow descent from a non-editable html
        element into an editable body as a convenience.

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

LayoutTests/ChangeLog
LayoutTests/editing/selection/select-all-005-expected.checksum [new file with mode: 0644]
LayoutTests/editing/selection/select-all-005-expected.png [new file with mode: 0644]
LayoutTests/editing/selection/select-all-005-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/select-all-005.html [new file with mode: 0644]
LayoutTests/editing/selection/select-all-006-expected.checksum [new file with mode: 0644]
LayoutTests/editing/selection/select-all-006-expected.png [new file with mode: 0644]
LayoutTests/editing/selection/select-all-006-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/select-all-006.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/VisiblePosition.cpp

index 05f0d4046b166ed0ba5b2ee52eff94b14a61fdd1..1f59166ac8e10957fa8e8aa9d84624560356f4c8 100644 (file)
@@ -1,3 +1,19 @@
+2006-07-25  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by adele
+        
+        <rdar://problem/4649560>
+        REGRESSION: Can't Select All when the body is contentEditable="true"
+
+        * editing/selection/select-all-005-expected.checksum: Added.
+        * editing/selection/select-all-005-expected.png: Added.
+        * editing/selection/select-all-005-expected.txt: Added.
+        * editing/selection/select-all-005.html: Added.
+        * editing/selection/select-all-006-expected.checksum: Added.
+        * editing/selection/select-all-006-expected.png: Added.
+        * editing/selection/select-all-006-expected.txt: Added.
+        * editing/selection/select-all-006.html: Added.
+
 2006-07-24  Dan Waylonis  <waylonis@google.com>
 
         Reviewed and tweaked a bit by Darin.
diff --git a/LayoutTests/editing/selection/select-all-005-expected.checksum b/LayoutTests/editing/selection/select-all-005-expected.checksum
new file mode 100644 (file)
index 0000000..928ee24
--- /dev/null
@@ -0,0 +1 @@
+59e3543da15bdfa732049d09c5c326a8
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/select-all-005-expected.png b/LayoutTests/editing/selection/select-all-005-expected.png
new file mode 100644 (file)
index 0000000..0a283a5
Binary files /dev/null and b/LayoutTests/editing/selection/select-all-005-expected.png differ
diff --git a/LayoutTests/editing/selection/select-all-005-expected.txt b/LayoutTests/editing/selection/select-all-005-expected.txt
new file mode 100644 (file)
index 0000000..188f2f0
--- /dev/null
@@ -0,0 +1,14 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 2 of 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
+      RenderText {#text} at (0,0) size 745x36
+        text run at (0,0) width 745: "VisiblePositions created at [html, x] where html is non-editable should descend into an editable body, for convenience."
+        text run at (0,18) width 273: "Everything on this page should be selected."
+      RenderText {#text} at (0,0) size 0x0
+selection start: position 0 of child 0 {#text} of child 0 {BODY} of child 0 {HTML} of document
+selection end:   position 164 of child 0 {#text} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/selection/select-all-005.html b/LayoutTests/editing/selection/select-all-005.html
new file mode 100644 (file)
index 0000000..d01273e
--- /dev/null
@@ -0,0 +1,7 @@
+<html id="html">
+<body contenteditable="true">VisiblePositions created at [html, x] where html is non-editable should descend into an editable body, for convenience.  Everything on this page should be selected.
+<script>
+var e = document.getElementById("html");
+window.getSelection().setBaseAndExtent(e, 0, e, 1);
+</script>
+</body></html>
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/select-all-006-expected.checksum b/LayoutTests/editing/selection/select-all-006-expected.checksum
new file mode 100644 (file)
index 0000000..928ee24
--- /dev/null
@@ -0,0 +1 @@
+59e3543da15bdfa732049d09c5c326a8
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/select-all-006-expected.png b/LayoutTests/editing/selection/select-all-006-expected.png
new file mode 100644 (file)
index 0000000..0a283a5
Binary files /dev/null and b/LayoutTests/editing/selection/select-all-006-expected.png differ
diff --git a/LayoutTests/editing/selection/select-all-006-expected.txt b/LayoutTests/editing/selection/select-all-006-expected.txt
new file mode 100644 (file)
index 0000000..d66088c
--- /dev/null
@@ -0,0 +1,15 @@
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of #text > BODY > HTML > #document to 164 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 2 of 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
+      RenderText {#text} at (0,0) size 745x36
+        text run at (0,0) width 745: "VisiblePositions created at [html, x] where html is non-editable should descend into an editable body, for convenience."
+        text run at (0,18) width 273: "Everything on this page should be selected."
+      RenderText {#text} at (0,0) size 0x0
+selection start: position 0 of child 0 {#text} of child 0 {BODY} of child 0 {HTML} of document
+selection end:   position 164 of child 0 {#text} of child 0 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/selection/select-all-006.html b/LayoutTests/editing/selection/select-all-006.html
new file mode 100644 (file)
index 0000000..6c28c91
--- /dev/null
@@ -0,0 +1,6 @@
+<html id="html">
+<body contenteditable="true">VisiblePositions created at [html, x] where html is non-editable should descend into an editable body, for convenience.  Everything on this page should be selected.
+<script>
+document.execCommand("SelectAll");
+</script>
+</body></html>
\ No newline at end of file
index e74fbb8191cec329fc68a71aa1deaea635c2dce0..9b7151ee1c0cc4f11d821248babb611f40b41210 100644 (file)
@@ -1,3 +1,14 @@
+2006-07-25  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by adele
+        
+        <rdar://problem/4649560>
+        REGRESSION: Can't Select All when the body is contentEditable="true"
+
+        * editing/VisiblePosition.cpp:
+        (WebCore::VisiblePosition::canonicalPosition): Allow descent from a non-editable html
+        element into an editable body as a convenience.
+
 2006-07-25  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by darin
index a09281ff1d8ef1423520c79763d7ec728c8d99cf..b4ff4935442e9b8c0f37a8c351a39cbfd3b7cadc 100644 (file)
@@ -186,10 +186,14 @@ Position VisiblePosition::canonicalPosition(const Position& position)
     Node* prevNode = prev.node();
 
     // The new position must be in the same editable element. Enforce that first.
+    // Unless the descent is from a non-editable html element to an editable body.
+    if (node->hasTagName(htmlTag) && !node->isContentEditable())
+        return next.isNotNull() ? next : prev;
+
     Node* editingRoot = node->rootEditableElement();
+        
     // If the html element is editable, descending into its body will look like a descent 
-    // from non-editable to editable content since rootEditableElement stops at the body 
-    // even if the html element is editable.
+    // from non-editable to editable content since rootEditableElement() always stops at the body.
     if (editingRoot && editingRoot->hasTagName(htmlTag))
         return next.isNotNull() ? next : prev;