Commit ada816be authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

2011-01-24 Peter Kasting <pkasting@google.com>

        Reviewed by Darin Adler.

        Roll back r67261 ("Don't fire onclick on middle clicks") due to
        regressions.
        https://bugs.webkit.org/show_bug.cgi?id=46733

        * fast/events/mouse-click-events-expected.txt:
        * fast/events/script-tests/mouse-click-events.js:
2011-01-24  Peter Kasting  <pkasting@google.com>

        Reviewed by Darin Adler.

        Roll back r67261 ("Don't fire onclick on middle clicks") due to
        regressions.
        https://bugs.webkit.org/show_bug.cgi?id=46733

        * html/HTMLAnchorElement.cpp:
        (WebCore::isLinkClick):
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::preDispatchEventHandler):
        (WebCore::HTMLInputElement::postDispatchEventHandler):
        (WebCore::HTMLInputElement::defaultEventHandler):
        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleMouseDoubleClickEvent):
        (WebCore::EventHandler::handleMouseReleaseEvent):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76557 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e66fb080
2011-01-24 Peter Kasting <pkasting@google.com>
Reviewed by Darin Adler.
Roll back r67261 ("Don't fire onclick on middle clicks") due to
regressions.
https://bugs.webkit.org/show_bug.cgi?id=46733
* fast/events/mouse-click-events-expected.txt:
* fast/events/script-tests/mouse-click-events.js:
2011-01-24 Xiaomei Ji <xji@chromium.org>
 
Unreviewed.
......
......@@ -6,11 +6,11 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Left Mouse Button
PASS eventLog is "mousedown(0) mouseup(0) click(0) mousedown(0) mouseup(0) click(0) dblclick(0) "
Middle Mouse Button
PASS eventLog is "mousedown(1) mouseup(1) mousedown(1) mouseup(1) "
PASS eventLog is "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) "
Right Mouse Button
PASS eventLog is "mousedown(2) mouseup(2) mousedown(2) mouseup(2) "
4th Mouse Button
PASS eventLog is "mousedown(1) mouseup(1) mousedown(1) mouseup(1) "
PASS eventLog is "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) "
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -49,9 +49,9 @@ function testEvents(description, button, expectedString) {
if (window.eventSender) {
testEvents("Left Mouse Button", 0, "mousedown(0) mouseup(0) click(0) mousedown(0) mouseup(0) click(0) dblclick(0) ");
testEvents("Middle Mouse Button", 1, "mousedown(1) mouseup(1) mousedown(1) mouseup(1) ");
testEvents("Middle Mouse Button", 1, "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) ");
testEvents("Right Mouse Button", 2, "mousedown(2) mouseup(2) mousedown(2) mouseup(2) ");
testEvents("4th Mouse Button", 3, "mousedown(1) mouseup(1) mousedown(1) mouseup(1) ");
testEvents("4th Mouse Button", 3, "mousedown(1) mouseup(1) click(1) mousedown(1) mouseup(1) click(1) dblclick(1) ");
}
var successfullyParsed = true;
2011-01-24 Peter Kasting <pkasting@google.com>
Reviewed by Darin Adler.
Roll back r67261 ("Don't fire onclick on middle clicks") due to
regressions.
https://bugs.webkit.org/show_bug.cgi?id=46733
* html/HTMLAnchorElement.cpp:
(WebCore::isLinkClick):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::preDispatchEventHandler):
(WebCore::HTMLInputElement::postDispatchEventHandler):
(WebCore::HTMLInputElement::defaultEventHandler):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseDoubleClickEvent):
(WebCore::EventHandler::handleMouseReleaseEvent):
2011-01-24 Martin Robinson <mrobinson@igalia.com>
 
Reviewed by Eric Seidel.
......@@ -541,7 +541,7 @@ bool isMiddleMouseButtonEvent(Event* event)
bool isLinkClick(Event* event)
{
return event->type() == eventNames().clickEvent || (event->type() == eventNames().mouseupEvent && isMiddleMouseButtonEvent(event));
return event->type() == eventNames().clickEvent && (!event->isMouseEvent() || static_cast<MouseEvent*>(event)->button() != RightButton);
}
void handleLinkClick(Event* event, Document* document, const String& url, const String& target, bool hideReferrer)
......
......@@ -45,6 +45,7 @@
#include "KeyboardEvent.h"
#include "LocalizedStrings.h"
#include "MouseEvent.h"
#include "PlatformMouseEvent.h"
#include "RenderTextControlSingleLine.h"
#include "RenderTheme.h"
#include "RuntimeEnabledFeatures.h"
......@@ -942,6 +943,8 @@ void* HTMLInputElement::preDispatchEventHandler(Event* event)
{
if (event->type() != eventNames().clickEvent)
return 0;
if (!event->isMouseEvent() || static_cast<MouseEvent*>(event)->button() != LeftButton)
return 0;
// FIXME: Check whether there are any cases where this actually ends up leaking.
return m_inputType->willDispatchClick().leakPtr();
}
......@@ -949,8 +952,6 @@ void* HTMLInputElement::preDispatchEventHandler(Event* event)
void HTMLInputElement::postDispatchEventHandler(Event* event, void* dataFromPreDispatch)
{
OwnPtr<ClickHandlingState> state = adoptPtr(static_cast<ClickHandlingState*>(dataFromPreDispatch));
if (event->type() != eventNames().clickEvent)
return;
if (!state)
return;
m_inputType->didDispatchClick(event, *state);
......@@ -958,7 +959,7 @@ void HTMLInputElement::postDispatchEventHandler(Event* event, void* dataFromPreD
void HTMLInputElement::defaultEventHandler(Event* evt)
{
if (evt->isMouseEvent() && evt->type() == eventNames().clickEvent) {
if (evt->isMouseEvent() && evt->type() == eventNames().clickEvent && static_cast<MouseEvent*>(evt)->button() == LeftButton) {
m_inputType->handleClickEvent(static_cast<MouseEvent*>(evt));
if (evt->defaultHandled())
return;
......
......@@ -1422,7 +1422,7 @@ bool EventHandler::handleMouseDoubleClickEvent(const PlatformMouseEvent& mouseEv
m_clickCount = mouseEvent.clickCount();
bool swallowMouseUpEvent = dispatchMouseEvent(eventNames().mouseupEvent, mev.targetNode(), true, m_clickCount, mouseEvent, false);
bool swallowClickEvent = mouseEvent.button() == LeftButton && mev.targetNode() == m_clickNode && dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true);
bool swallowClickEvent = mouseEvent.button() != RightButton && mev.targetNode() == m_clickNode && dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true);
if (m_lastScrollbarUnderMouse)
swallowMouseUpEvent = m_lastScrollbarUnderMouse->mouseUp();
......@@ -1613,7 +1613,7 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
bool swallowMouseUpEvent = dispatchMouseEvent(eventNames().mouseupEvent, mev.targetNode(), true, m_clickCount, mouseEvent, false);
bool swallowClickEvent = m_clickCount > 0 && mouseEvent.button() == LeftButton && mev.targetNode() == m_clickNode && dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true);
bool swallowClickEvent = m_clickCount > 0 && mouseEvent.button() != RightButton && mev.targetNode() == m_clickNode && dispatchMouseEvent(eventNames().clickEvent, mev.targetNode(), true, m_clickCount, mouseEvent, true);
if (m_resizeLayer) {
m_resizeLayer->setInResizeMode(false);
......
Supports Markdown
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