Commit e5eed761 authored by justing's avatar justing

LayoutTests:

        Reviewed by Adele.
        
        <rdar://problem/5240265> REGRESSION: Clicking a <button> clears the selection in contenteditable areas

        * editing/selection/5240265-expected.checksum: Added.
        * editing/selection/5240265-expected.png: Added.
        * editing/selection/5240265-expected.txt: Added.
        * editing/selection/5240265.html: Added.

WebCore:

        Reviewed by Adele.

        <rdar://problem/5240265> 
        REGRESSION: Clicking a <button> clears the selection in contenteditable areas

        * page/FocusController.cpp:
        (WebCore::clearSelectionIfNeeded): Don't clear the selection if
        the mouse press that caused the focus shift occurred in 
        a -webkit-user-select: ignore region.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@24334 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f2d70b14
2007-07-16 Justin Garcia <justin.garcia@apple.com>
Reviewed by Adele.
<rdar://problem/5240265> REGRESSION: Clicking a <button> clears the selection in contenteditable areas
* editing/selection/5240265-expected.checksum: Added.
* editing/selection/5240265-expected.png: Added.
* editing/selection/5240265-expected.txt: Added.
* editing/selection/5240265.html: Added.
2007-07-16 Adele Peterson <adele@apple.com>
Reviewed by Brady.
b58cb97690cdef11090a3e3a968e0343
\ No newline at end of file
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 784x54
RenderText {#text} at (0,0) size 782x54
text run at (0,0) width 757: "This tests to see that clicking on content outside of an editable region with -webkit-user-select: ignore doesn't remove the"
text run at (0,18) width 467: "selection from the editable region. To run it manually, click on the button. "
text run at (467,18) width 315: "The editable region should not be focused, but the"
text run at (0,36) width 216: "text inside of it should be selected."
RenderBlock (anonymous) at (0,70) size 784x22
RenderButton {INPUT} at (2,2) size 80x18 [bgcolor=#C0C0C0]
RenderBlock (anonymous) at (8,2) size 64x13
RenderText at (0,0) size 64x13
text run at (0,0) width 64: "Click on me"
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,92) size 784x18
RenderText {#text} at (0,0) size 178x18
text run at (0,0) width 178: "This text should be selected."
selection start: position 0 of child 0 {#text} of child 4 {DIV} of child 0 {BODY} of child 0 {HTML} of document
selection end: position 29 of child 0 {#text} of child 4 {DIV} of child 0 {BODY} of child 0 {HTML} of document
<p>This tests to see that clicking on content outside of an editable region with -webkit-user-select: ignore doesn't remove the selection from the editable region. To run it manually, click on the button. The editable region should not be focused, but the text inside of it should be selected.</p>
<input id="button" type="button" style="-webkit-user-select: ignore;" value="Click on me">
<div id="div" contenteditable="true">This text should be selected.</div>
<script>
div = document.getElementById("div");
sel = window.getSelection();
sel.setPosition(div, 0);
document.execCommand("SelectAll");
if (window.layoutTestController) {
button = document.getElementById("button");
x = button.offsetParent.offsetLeft + button.offsetLeft + button.offsetWidth / 2;
y = button.offsetParent.offsetTop + button.offsetTop + button.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
}
</script>
2007-07-16 Justin Garcia <justin.garcia@apple.com>
Reviewed by Adele.
<rdar://problem/5240265>
REGRESSION: Clicking a <button> clears the selection in contenteditable areas
* page/FocusController.cpp:
(WebCore::clearSelectionIfNeeded): Don't clear the selection if
the mouse press that caused the focus shift occurred in
a -webkit-user-select: ignore region.
2007-07-16 Adam Roben <aroben@apple.com>
Added a manual test to test calling window.print on a subframe.
......@@ -235,6 +235,13 @@ static void clearSelectionIfNeeded(Frame* oldFocusedFrame, Frame* newFocusedFram
Node* selectionStartNode = s->selection().start().node();
if (selectionStartNode == newFocusedNode || selectionStartNode->isDescendantOf(newFocusedNode) || selectionStartNode->shadowAncestorNode() == newFocusedNode)
return;
if (Node* mousePressNode = newFocusedFrame->eventHandler()->mousePressNode())
if (mousePressNode->renderer() && mousePressNode->renderer()->style()->userSelect() == SELECT_IGNORE)
// Don't do this for textareas and text fields, when they lose focus their selections should be cleared
// and then restored when they regain focus, to match other browsers.
if (!s->rootEditableElement()->shadowAncestorNode())
return;
s->clear();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment