Reviewed by john
<rdar://problem/
4836287>
Cannot expand selection out of editable element when containing element is non-editable.
* editing/selection/mixed-editability-6-expected.checksum: Added.
* editing/selection/mixed-editability-6-expected.png: Added.
* editing/selection/mixed-editability-6-expected.txt: Added.
* editing/selection/mixed-editability-6.html: Added.
* editing/selection/mixed-editability-7-expected.checksum: Added.
* editing/selection/mixed-editability-7-expected.png: Added.
* editing/selection/mixed-editability-7-expected.txt: Added.
* editing/selection/mixed-editability-7.html: Added.
WebCore:
Reviewed by john
<rdar://problem/
4836287>
Cannot expand selection out of editable element when containing element is non-editable.
* editing/Selection.cpp:
(WebCore::Selection::adjustForEditableContent): Restrict the selection endpoints
to the same *highest* editable root. This bug only happened when creating selections
based in an editable region and extending into a higher editable root, so this change
doesn't expose any new kinds of deletions, but we should start thinking about how
those deletions should behave.
* editing/SelectionController.cpp:
(WebCore::SelectionController::selectAll): Ditto.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@18084
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-12-08 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by john
+
+ <rdar://problem/4836287>
+ Cannot expand selection out of editable element when containing element is non-editable.
+
+ * editing/selection/mixed-editability-6-expected.checksum: Added.
+ * editing/selection/mixed-editability-6-expected.png: Added.
+ * editing/selection/mixed-editability-6-expected.txt: Added.
+ * editing/selection/mixed-editability-6.html: Added.
+ * editing/selection/mixed-editability-7-expected.checksum: Added.
+ * editing/selection/mixed-editability-7-expected.png: Added.
+ * editing/selection/mixed-editability-7-expected.txt: Added.
+ * editing/selection/mixed-editability-7.html: Added.
+
2006-12-08 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Geoff.
--- /dev/null
+5a1abb6a04c7f939d3d8442a193d512f
\ No newline at end of file
--- /dev/null
+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 779x36
+ text run at (0,0) width 618: "This tests Select All when the caret is inside an editable region that is inside a non editable region. "
+ text run at (618,0) width 161: "Whenever the selection is"
+ text run at (0,18) width 537: "in an editable region, Select All should select the contents of the highest editable root."
+ RenderBlock {DIV} at (0,52) size 784x54
+ RenderBlock {DIV} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 27x18
+ text run at (0,0) width 27: "One"
+ RenderBlock {DIV} at (0,18) size 784x18
+ RenderInline {SPAN} at (0,0) size 30x18
+ RenderText {#text} at (0,0) size 30x18
+ text run at (0,0) width 30: "Two"
+ RenderText {#text} at (30,0) size 4x18
+ text run at (30,0) width 4: " "
+ RenderInline {SPAN} at (0,0) size 37x18
+ RenderText {#text} at (34,0) size 37x18
+ text run at (34,0) width 37: "Three"
+ RenderBlock {DIV} at (0,36) size 784x18
+ RenderText {#text} at (0,0) size 30x18
+ text run at (0,0) width 30: "Four"
+selection start: position 0 of child 0 {#text} of child 1 {DIV} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
+selection end: position 4 of child 0 {#text} of child 5 {DIV} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
--- /dev/null
+<p>This tests Select All when the caret is inside an editable region that is inside a non editable region. Whenever the selection is in an editable region, Select All should select the contents of the highest editable root.</p>
+<div contenteditable="true">
+<div>One</div>
+<div contenteditable="false"><span>Two</span> <span id="start" contenteditable="true">Three</span></div>
+<div>Four</div>
+</div>
+
+<script>
+var span = document.getElementById("start");
+var sel = window.getSelection();
+sel.setPosition(span, 0);
+
+document.execCommand("SelectAll");
+</script>
\ No newline at end of file
--- /dev/null
+267df7b9967007a4f5292e45b70c0892
\ No newline at end of file
--- /dev/null
+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 779x36
+ text run at (0,0) width 779: "This tests creating a selection based inside a nested editable region that extends out to editable content that is inside the same"
+ text run at (0,18) width 135: "highest editable root. "
+ text run at (135,18) width 256: "'One' through 'Three' should be selected."
+ RenderBlock {DIV} at (0,52) size 784x54
+ RenderBlock {DIV} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 27x18
+ text run at (0,0) width 27: "One"
+ RenderBlock {DIV} at (0,18) size 784x18
+ RenderInline {SPAN} at (0,0) size 30x18
+ RenderText {#text} at (0,0) size 30x18
+ text run at (0,0) width 30: "Two"
+ RenderText {#text} at (30,0) size 4x18
+ text run at (30,0) width 4: " "
+ RenderInline {SPAN} at (0,0) size 37x18
+ RenderText {#text} at (34,0) size 37x18
+ text run at (34,0) width 37: "Three"
+ RenderBlock {DIV} at (0,36) size 784x18
+ RenderText {#text} at (0,0) size 30x18
+ text run at (0,0) width 30: "Four"
+selection start: position 0 of child 0 {#text} of child 1 {DIV} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
+selection end: position 5 of child 0 {#text} of child 2 {SPAN} of child 3 {DIV} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
--- /dev/null
+<p>This tests creating a selection based inside a nested editable region that extends out to editable content that is inside the same highest editable root. 'One' through 'Three' should be selected.</p>
+<div contenteditable="true">
+<div id="extent">One</div>
+<div contenteditable="false"><span>Two</span> <span id="base" contenteditable="true">Three</span></div>
+<div>Four</div>
+</div>
+
+<script>
+var base = document.getElementById("base");
+var extent = document.getElementById("extent");
+
+var sel = window.getSelection();
+sel.setBaseAndExtent(base, 1, extent, 0);
+</script>
\ No newline at end of file
+2006-12-07 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by john
+
+ <rdar://problem/4836287>
+ Cannot expand selection out of editable element when containing element is non-editable.
+
+ * editing/Selection.cpp:
+ (WebCore::Selection::adjustForEditableContent): Restrict the selection endpoints
+ to the same *highest* editable root. This bug only happened when creating selections
+ based in an editable region and extending into a higher editable root, so this change
+ doesn't expose any new kinds of deletions, but we should start thinking about how
+ those deletions should behave.
+ * editing/SelectionController.cpp:
+ (WebCore::SelectionController::selectAll): Ditto.
+
2006-12-08 Beth Dakin <bdakin@apple.com>
Reviewed by Maciej.
if (m_base.isNull() || m_start.isNull() || m_end.isNull())
return;
- Node* baseRoot = m_base.node()->rootEditableElement();
- Node* startRoot = m_start.node()->rootEditableElement();
- Node* endRoot = m_end.node()->rootEditableElement();
+ Node* baseRoot = highestEditableRoot(m_base);
+ Node* startRoot = highestEditableRoot(m_start);
+ Node* endRoot = highestEditableRoot(m_end);
Node* baseEditableAncestor = lowestEditableAncestor(m_base.node());
if (!document)
return;
- Node* root = isContentEditable() ? rootEditableElement() : document->documentElement();
+ Node* root = isContentEditable() ? highestEditableRoot(m_sel.start()) : document->documentElement();
Selection newSelection(Selection::selectionFromContentsOfNode(root));
if (m_frame->shouldChangeSelection(newSelection))
setSelection(newSelection);