Commit 0c9fb2be authored by ap@webkit.org's avatar ap@webkit.org

Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=19737
        No cursor and paste not enabled right clicking text field/area

        Test: fast/events/right-click-focus.html

        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleMousePressEventSingleClick):
        (WebCore::EventHandler::handleMousePressEvent):
        Take normal code path for right clicks (we were taking it for Ctrl-clicks anyway).



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@41715 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 61e92942
2009-03-15 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=19737
No cursor and paste not enabled right clicking text field/area
* fast/events/right-click-focus-expected.txt: Added.
* fast/events/right-click-focus.html: Added.
* editing/selection/5354455-2.html:
* platform/mac/editing/selection/5354455-2-expected.checksum:
* platform/mac/editing/selection/5354455-2-expected.png:
* platform/mac/editing/selection/5354455-2-expected.txt:
Right-clicking now removes existing selection. I think that this is a progression.
2009-03-15 Alexey Proskuryakov <ap@webkit.org>
Suggested by Mark Rowe.
......
Test that right-clicking on a text area properly focuses it.
PASS
<head>
<script>
function log(t) {
document.getElementById('console').innerHTML += t +'<br>';
}
if (window.layoutTestController)
layoutTestController.dumpAsText();
</script>
<body>
<p>Test that right-clicking on a text area properly focuses it.</p>
<textarea></textarea>
<div id=console></div>
<script>
if (window.eventSender) {
var elt = document.getElementsByTagName('textarea')[0];
eventSender.mouseMoveTo(elt.offsetLeft + 5, elt.offsetTop + 5);
eventSender.contextClick();
if (!window.getSelection().anchorNode)
log("FAIL: No selection after right-clicking");
eventSender.keyDown("z");
log(document.getElementsByTagName("textarea")[0].value == "z" ? "PASS" : "FAIL: No text in textarea");
} else {
log("Please try right-clicking on the text area below, dismissing the context menu that appears, and typing some text. The caret should be visible, and typing should work.");
}
</script>
1db1b8dbf44496d53cad7c22be04648d
\ No newline at end of file
84cd4927cf64d404e3c9f19d17f3ccad
\ No newline at end of file
......@@ -2,26 +2,24 @@ 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
layer at (8,8) size 612x160
RenderBody {BODY} at (8,8) size 612x160 [border: (1px solid #000000)]
layer at (8,8) size 612x142
RenderBody {BODY} at (8,8) size 612x142 [border: (1px solid #000000)]
RenderBlock {H1} at (6,6) size 600x37
RenderText {#text} at (0,0) size 451x37
text run at (0,0) width 451: "Word selection on right click test"
RenderBlock (anonymous) at (6,64) size 600x90
RenderBlock (anonymous) at (6,64) size 600x72
RenderText {#text} at (0,0) size 597x36
text run at (0,0) width 597: "This tests to make sure that right clicking non-editable content only creates a word selection for"
text run at (0,18) width 132: "clicks over text. The "
RenderInline {SPAN} at (0,0) size 44x18
RenderText {#text} at (132,18) size 44x18
text run at (132,18) width 44: "second"
RenderText {#text} at (176,18) size 587x72
text run at (176,18) width 373: " word in this sentence should be selected when run through"
text run at (0,36) width 552: "DumpRenderTree. To run manually, right click on text, and a word should be selected. "
text run at (552,36) width 35: "Right"
text run at (0,54) width 574: "click on the empty space outside and to the right of the black border, no selection should be"
text run at (0,72) width 49: "created."
text run at (0,18) width 103: "clicks over text. "
RenderInline {SPAN} at (0,0) size 18x18
RenderText {#text} at (103,18) size 18x18
text run at (103,18) width 18: "To"
RenderText {#text} at (121,18) size 577x54
text run at (121,18) width 411: " run manually, right click on text, and a word should be selected. "
text run at (532,18) width 35: "Right"
text run at (0,36) width 577: "click on the empty space outside and to the right of the black border, the selection should be"
text run at (0,54) width 59: "removed."
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 0x0
selection start: position 0 of child 0 {#text} of child 3 {SPAN} of child 1 {BODY} of child 0 {HTML} of document
selection end: position 6 of child 0 {#text} of child 3 {SPAN} of child 1 {BODY} of child 0 {HTML} of document
caret: position 0 of child 0 {#text} of child 1 {H1} of child 1 {BODY} of child 0 {HTML} of document
2009-03-15 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=19737
No cursor and paste not enabled right clicking text field/area
Test: fast/events/right-click-focus.html
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEventSingleClick):
(WebCore::EventHandler::handleMousePressEvent):
Take normal code path for right clicks (we were taking it for Ctrl-clicks anyway).
2009-03-15 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Adele Peterson.
......@@ -276,9 +276,6 @@ bool EventHandler::handleMousePressEventTripleClick(const MouseEventWithHitTestR
bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestResults& event)
{
if (event.event().button() != LeftButton)
return false;
Node* innerNode = event.targetNode();
if (!(innerNode && innerNode->renderer() && m_mouseDownMayStartSelect))
return false;
......@@ -368,18 +365,16 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
m_dragStartPos = event.event().pos();
bool swallowEvent = false;
if (event.event().button() == LeftButton || event.event().button() == MiddleButton) {
m_frame->selection()->setCaretBlinkingSuspended(true);
m_mousePressed = true;
m_beganSelectingText = false;
if (event.event().clickCount() == 2)
swallowEvent = handleMousePressEventDoubleClick(event);
else if (event.event().clickCount() >= 3)
swallowEvent = handleMousePressEventTripleClick(event);
else
swallowEvent = handleMousePressEventSingleClick(event);
}
m_frame->selection()->setCaretBlinkingSuspended(true);
m_mousePressed = true;
m_beganSelectingText = false;
if (event.event().clickCount() == 2)
swallowEvent = handleMousePressEventDoubleClick(event);
else if (event.event().clickCount() >= 3)
swallowEvent = handleMousePressEventTripleClick(event);
else
swallowEvent = handleMousePressEventSingleClick(event);
m_mouseDownMayStartAutoscroll = m_mouseDownMayStartSelect ||
(m_mousePressNode && m_mousePressNode->renderBox() && m_mousePressNode->renderBox()->canBeProgramaticallyScrolled(true));
......
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