Commit 2b51d382 authored by darin@chromium.org's avatar darin@chromium.org

2009-04-01 Tony Chang <tony@chromium.org>

        Reviewed by Darin Fisher.

        Ensure the right click doesn't deselect text under it.  This was
        happening in the Chromium and GTK+ ports because they don't select
        the text under the cursor on right click.
        
        This was regressed in r41715, https://bugs.webkit.org/show_bug.cgi?id=19737
        
        https://bugs.webkit.org/show_bug.cgi?id=24946

        Test: fast/events/context-no-deselect.html

        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleMouseReleaseEvent):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@42154 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 278d4cde
2009-04-01 Tony Chang <tony@chromium.org>
Reviewed by Darin Fisher.
Ensure the right click doesn't deselect text under it. This was
happening in the Chromium and GTK+ ports because they don't select
the text under the cursor on right click.
This was regressed in r41715, https://bugs.webkit.org/show_bug.cgi?id=19737
https://bugs.webkit.org/show_bug.cgi?id=24946
* fast/events/context-no-deselect.html: Added.
* platform/mac/fast/events/context-no-deselect-expected.checksum: Added.
* platform/mac/fast/events/context-no-deselect-expected.png: Added.
* platform/mac/fast/events/context-no-deselect-expected.txt: Added.
2009-03-31 Eric Carlson <eric.carlson@apple.com>
Reviewed by Darin Adler.
......
<html>
<body>
<input type="text" id="text" value="some sample text">
</body>
</html>
<script>
// This test checks that if the user right clicks on selected text,
// the selected text doesn't change or get deselected.
var input = document.getElementById("text");
input.selectionStart = 5;
input.selectionEnd = 15;
if (window.layoutTestController) {
var x, y;
x = input.offsetParent.offsetLeft + input.offsetLeft + input.offsetWidth / 2;
y = input.offsetParent.offsetTop + input.offsetTop + input.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.contextClick();
}
</script>
d59884cef781bc592520f85696ac72fd
\ 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
RenderTextControl {INPUT} at (2,2) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
layer at (13,13) size 142x13
RenderBlock {DIV} at (3,3) size 142x13
RenderText {#text} at (1,0) size 96x13
text run at (1,0) width 96: "some sample text"
selection start: position 5 of child 0 {#text} of child 0 {DIV} of child 1 {INPUT} of child 0 {BODY} of child 0 {HTML} of document
selection end: position 15 of child 0 {#text} of child 0 {DIV} of child 1 {INPUT} of child 0 {BODY} of child 0 {HTML} of document
2009-04-01 Tony Chang <tony@chromium.org>
Reviewed by Darin Fisher.
Ensure the right click doesn't deselect text under it. This was
happening in the Chromium and GTK+ ports because they don't select
the text under the cursor on right click.
This was regressed in r41715, https://bugs.webkit.org/show_bug.cgi?id=19737
https://bugs.webkit.org/show_bug.cgi?id=24946
Test: fast/events/context-no-deselect.html
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseReleaseEvent):
2009-04-01 Simon Fraser <simon.fraser@apple.com>
Reviewed by Dave Hyatt
......@@ -549,12 +549,14 @@ bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& e
bool handled = false;
// Clear the selection if the mouse didn't move after the last mouse press.
// We do this so when clicking on the selection, the selection goes away.
// However, if we are editing, place the caret.
// Clear the selection if the mouse didn't move after the last mouse
// press and it's not a context menu click. We do this so when clicking
// on the selection, the selection goes away. However, if we are
// editing, place the caret.
if (m_mouseDownWasSingleClickInSelection && !m_beganSelectingText
&& m_dragStartPos == event.event().pos()
&& m_frame->selection()->isRange()) {
&& m_frame->selection()->isRange()
&& event.event().button() != RightButton) {
VisibleSelection newSelection;
Node *node = event.targetNode();
if (node && node->isContentEditable() && node->renderer()) {
......
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