Commit f28ec400 authored by dbates@webkit.org's avatar dbates@webkit.org

2011-05-12 Daniel Bates <dbates@rim.com>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] fast/events/fire-mousedown-while-pressing-mouse-button.html failing
        https://bugs.webkit.org/show_bug.cgi?id=58863

        Fixes an issue where a platform mouse event corresponding to mouse button A
        may be associated with the wrong WebCore mouse button when the event occurs
        while pressing and holding a mouse button B, where A != B.

        For example, a person clicks the middle mouse button while pressing and holding
        the left mouse button. Then we dispatch the following DOM events: mouse down for
        left button, mouse down for left button, mouse up for left button. But, we should
        have dispatched: mouse down for left button, mouse down for middle button, mouse up
        for middle button.

        * platform/qt/PlatformMouseEventQt.cpp:
        (WebCore::mouseEventTypeAndMouseButtonFromQEvent): Added.
        (WebCore::PlatformMouseEvent::PlatformMouseEvent): Modified to call mouseEventTypeAndMouseButtonFromQEvent()
        to determine the WebCore mouse event type and button from the platform-specific event.
2011-05-12  Daniel Bates  <dbates@rim.com>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] fast/events/fire-mousedown-while-pressing-mouse-button.html failing
        https://bugs.webkit.org/show_bug.cgi?id=58863

        Remove test case fast/events/fire-mousedown-while-pressing-mouse-button.html
        from the Skipped list since it now passes.

        * platform/qt/Skipped:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86381 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 61be250f
2011-05-12 Daniel Bates <dbates@rim.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] fast/events/fire-mousedown-while-pressing-mouse-button.html failing
https://bugs.webkit.org/show_bug.cgi?id=58863
Remove test case fast/events/fire-mousedown-while-pressing-mouse-button.html
from the Skipped list since it now passes.
* platform/qt/Skipped:
2011-05-12 Chang Shu <cshu@webkit.org>
Reviewed by Csaba Osztrogonác.
......@@ -1241,10 +1241,6 @@ editing/unsupported-content/table-type-before.html
# failing fast tests
# ============================================================================= #
# [Qt] fast/events/fire-mousedown-while-pressing-mouse-button.html failing
# https://bugs.webkit.org/show_bug.cgi?id=58863
fast/events/fire-mousedown-while-pressing-mouse-button.html
# [Qt] fast/ruby/overhang* tests fail
# https://bugs.webkit.org/show_bug.cgi?id=57824
fast/ruby/overhang-horizontal.html
......
2011-05-12 Daniel Bates <dbates@rim.com>
Reviewed by Kenneth Rohde Christiansen.
[Qt] fast/events/fire-mousedown-while-pressing-mouse-button.html failing
https://bugs.webkit.org/show_bug.cgi?id=58863
Fixes an issue where a platform mouse event corresponding to mouse button A
may be associated with the wrong WebCore mouse button when the event occurs
while pressing and holding a mouse button B, where A != B.
For example, a person clicks the middle mouse button while pressing and holding
the left mouse button. Then we dispatch the following DOM events: mouse down for
left button, mouse down for left button, mouse up for left button. But, we should
have dispatched: mouse down for left button, mouse down for middle button, mouse up
for middle button.
* platform/qt/PlatformMouseEventQt.cpp:
(WebCore::mouseEventTypeAndMouseButtonFromQEvent): Added.
(WebCore::PlatformMouseEvent::PlatformMouseEvent): Modified to call mouseEventTypeAndMouseButtonFromQEvent()
to determine the WebCore mouse event type and button from the platform-specific event.
2011-05-12 Levi Weintraub <leviw@chromium.org>
Reviewed by Eric Seidel.
/*
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
* Copyright (C) 2011 Research In Motion Limited.
*
* All rights reserved.
*
......@@ -42,35 +43,79 @@ static void mouseEventModifiersFromQtKeyboardModifiers(Qt::KeyboardModifiers key
shiftKey = keyboardModifiers & Qt::ShiftModifier;
}
#if !defined(QT_NO_GRAPHICSVIEW)
PlatformMouseEvent::PlatformMouseEvent(QGraphicsSceneMouseEvent* event, int clickCount)
static void mouseEventTypeAndMouseButtonFromQEvent(const QEvent* event, MouseEventType& mouseEventType, MouseButton& mouseButton)
{
m_timestamp = WTF::currentTime();
enum { MouseEvent, GraphicsSceneMouseEvent } frameworkMouseEventType;
switch (event->type()) {
case QEvent::MouseButtonDblClick:
case QEvent::MouseButtonPress:
frameworkMouseEventType = MouseEvent;
mouseEventType = MouseEventPressed;
break;
case QEvent::MouseButtonRelease:
frameworkMouseEventType = MouseEvent;
mouseEventType = MouseEventReleased;
break;
case QEvent::MouseMove:
frameworkMouseEventType = MouseEvent;
mouseEventType = MouseEventMoved;
break;
#if !defined(QT_NO_GRAPHICSVIEW)
case QEvent::GraphicsSceneMouseDoubleClick:
case QEvent::GraphicsSceneMousePress:
m_eventType = MouseEventPressed;
frameworkMouseEventType = GraphicsSceneMouseEvent;
mouseEventType = MouseEventPressed;
break;
case QEvent::GraphicsSceneMouseRelease:
m_eventType = MouseEventReleased;
frameworkMouseEventType = GraphicsSceneMouseEvent;
mouseEventType = MouseEventReleased;
break;
case QEvent::GraphicsSceneMouseMove:
frameworkMouseEventType = GraphicsSceneMouseEvent;
mouseEventType = MouseEventMoved;
break;
#endif
default:
m_eventType = MouseEventMoved;
ASSERT_NOT_REACHED();
frameworkMouseEventType = MouseEvent;
mouseEventType = MouseEventMoved;
break;
}
m_position = IntPoint(event->pos().toPoint());
m_globalPosition = IntPoint(event->screenPos());
Qt::MouseButtons mouseButtons;
switch (frameworkMouseEventType) {
case MouseEvent: {
const QMouseEvent* mouseEvent = static_cast<const QMouseEvent*>(event);
mouseButtons = mouseEventType == MouseEventMoved ? mouseEvent->buttons() : mouseEvent->button();
break;
}
case GraphicsSceneMouseEvent: {
const QGraphicsSceneMouseEvent* mouseEvent = static_cast<const QGraphicsSceneMouseEvent*>(event);
mouseButtons = mouseEventType == MouseEventMoved ? mouseEvent->buttons() : mouseEvent->button();
break;
}
}
if (event->button() == Qt::LeftButton || (event->buttons() & Qt::LeftButton))
m_button = LeftButton;
else if (event->button() == Qt::RightButton || (event->buttons() & Qt::RightButton))
m_button = RightButton;
else if (event->button() == Qt::MidButton || (event->buttons() & Qt::MidButton))
m_button = MiddleButton;
if (mouseButtons & Qt::LeftButton)
mouseButton = LeftButton;
else if (mouseButtons & Qt::RightButton)
mouseButton = RightButton;
else if (mouseButtons & Qt::MidButton)
mouseButton = MiddleButton;
else
m_button = NoButton;
mouseButton = NoButton;
}
#if !defined(QT_NO_GRAPHICSVIEW)
PlatformMouseEvent::PlatformMouseEvent(QGraphicsSceneMouseEvent* event, int clickCount)
{
m_timestamp = WTF::currentTime();
// FIXME: Why don't we handle a context menu event here as we do in PlatformMouseEvent(QInputEvent*, int)?
// See <https://bugs.webkit.org/show_bug.cgi?id=60728>.
mouseEventTypeAndMouseButtonFromQEvent(event, m_eventType, m_button);
m_position = IntPoint(event->pos().toPoint());
m_globalPosition = IntPoint(event->screenPos());
m_clickCount = clickCount;
mouseEventModifiersFromQtKeyboardModifiers(event->modifiers(), m_altKey, m_ctrlKey, m_metaKey, m_shiftKey);
......@@ -81,48 +126,22 @@ PlatformMouseEvent::PlatformMouseEvent(QInputEvent* event, int clickCount)
{
m_timestamp = WTF::currentTime();
QMouseEvent* me = 0;
switch (event->type()) {
case QEvent::MouseMove:
m_eventType = MouseEventMoved;
me = static_cast<QMouseEvent *>(event);
break;
case QEvent::MouseButtonDblClick:
case QEvent::MouseButtonPress:
m_eventType = MouseEventPressed;
me = static_cast<QMouseEvent *>(event);
break;
case QEvent::MouseButtonRelease:
m_eventType = MouseEventReleased;
me = static_cast<QMouseEvent *>(event);
break;
bool isContextMenuEvent = false;
#ifndef QT_NO_CONTEXTMENU
case QEvent::ContextMenu: {
if (event->type() == QEvent::ContextMenu) {
isContextMenuEvent = true;
m_eventType = MouseEventPressed;
QContextMenuEvent* ce = static_cast<QContextMenuEvent*>(event);
m_position = IntPoint(ce->pos());
m_globalPosition = IntPoint(ce->globalPos());
m_button = RightButton;
break;
}
#endif // QT_NO_CONTEXTMENU
default:
m_eventType = MouseEventMoved;
}
if (me) {
m_position = IntPoint(me->pos());
m_globalPosition = IntPoint(me->globalPos());
if (me->button() == Qt::LeftButton || (me->buttons() & Qt::LeftButton))
m_button = LeftButton;
else if (me->button() == Qt::RightButton || (me->buttons() & Qt::RightButton))
m_button = RightButton;
else if (me->button() == Qt::MidButton || (me->buttons() & Qt::MidButton))
m_button = MiddleButton;
else
m_button = NoButton;
#endif
if (!isContextMenuEvent) {
mouseEventTypeAndMouseButtonFromQEvent(event, m_eventType, m_button);
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
m_position = IntPoint(mouseEvent->pos());
m_globalPosition = IntPoint(mouseEvent->globalPos());
}
m_clickCount = clickCount;
......
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