summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-17 16:21:14 +0200
commit8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch)
tree17985605dab9263cc2444bd4d45f189e142cca7c /Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
parentb9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff)
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well as the previously cherry-picked changes
Diffstat (limited to 'Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp')
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp73
1 files changed, 39 insertions, 34 deletions
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
index 819d4a0a2..fdc92355f 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
@@ -167,18 +167,18 @@ void QtWebPageEventHandler::handleHoverLeaveEvent(QHoverEvent* ev)
{
// To get the correct behavior of mouseout, we need to turn the Leave event of our webview into a mouse move
// to a very far region.
- QTransform fromItemTransform = m_webPage->transformFromItem();
- QHoverEvent fakeEvent(QEvent::HoverMove, QPoint(INT_MIN, INT_MIN), fromItemTransform.map(ev->oldPosF()));
+ QHoverEvent fakeEvent(QEvent::HoverMove, QPoint(INT_MIN, INT_MIN), ev->oldPosF());
fakeEvent.setTimestamp(ev->timestamp());
+ // This will apply the transform on the event.
handleHoverMoveEvent(&fakeEvent);
}
void QtWebPageEventHandler::handleHoverMoveEvent(QHoverEvent* ev)
{
- QTransform fromItemTransform = m_webPage->transformFromItem();
- QMouseEvent me(QEvent::MouseMove, fromItemTransform.map(ev->posF()), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
+ QMouseEvent me(QEvent::MouseMove, ev->posF(), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
me.setAccepted(ev->isAccepted());
me.setTimestamp(ev->timestamp());
+ // This will apply the transform on the event.
handleMouseMoveEvent(&me);
}
@@ -450,7 +450,38 @@ void QtWebPageEventHandler::doneWithGestureEvent(const WebGestureEvent& event, b
void QtWebPageEventHandler::handleInputEvent(const QInputEvent* event)
{
- ASSERT(m_viewportController);
+ if (m_viewportController) {
+ switch (event->type()) {
+ case QEvent::MouseButtonPress:
+ case QEvent::TouchBegin:
+ ASSERT(!m_viewportController->panGestureActive());
+ ASSERT(!m_viewportController->pinchGestureActive());
+ m_viewportController->touchBegin();
+
+ // The page viewport controller might still be animating kinetic scrolling or a scale animation
+ // such as double-tap to zoom or the bounce back effect. A touch stops the kinetic scrolling
+ // where as it does not stop the scale animation.
+ // The gesture recognizer stops the kinetic scrolling animation if needed.
+ break;
+ case QEvent::MouseMove:
+ case QEvent::TouchUpdate:
+ // The scale animation can only be interrupted by a pinch gesture, which will then take over.
+ if (m_viewportController->scaleAnimationActive() && m_pinchGestureRecognizer.isRecognized())
+ m_viewportController->interruptScaleAnimation();
+ break;
+ case QEvent::MouseButtonRelease:
+ case QEvent::TouchEnd:
+ m_viewportController->touchEnd();
+ break;
+ default:
+ break;
+ }
+
+ // If the scale animation is active we don't pass the event to the recognizers. In the future
+ // we would want to queue the event here and repost then when the animation ends.
+ if (m_viewportController->scaleAnimationActive())
+ return;
+ }
bool isMouseEvent = false;
@@ -458,45 +489,22 @@ void QtWebPageEventHandler::handleInputEvent(const QInputEvent* event)
case QEvent::MouseButtonPress:
isMouseEvent = true;
m_isMouseButtonPressed = true;
- // Fall through.
- case QEvent::TouchBegin:
- ASSERT(!m_viewportController->panGestureActive());
- ASSERT(!m_viewportController->pinchGestureActive());
- m_viewportController->touchBegin();
-
- // The interaction engine might still be animating kinetic scrolling or a scale animation
- // such as double-tap to zoom or the bounce back effect. A touch stops the kinetic scrolling
- // where as it does not stop the scale animation.
- // The gesture recognizer stops the kinetic scrolling animation if needed.
break;
case QEvent::MouseMove:
if (!m_isMouseButtonPressed)
return;
-
isMouseEvent = true;
- // Fall through.
- case QEvent::TouchUpdate:
- // The scale animation can only be interrupted by a pinch gesture, which will then take over.
- if (m_viewportController->scaleAnimationActive() && m_pinchGestureRecognizer.isRecognized())
- m_viewportController->interruptScaleAnimation();
break;
case QEvent::MouseButtonRelease:
isMouseEvent = true;
m_isMouseButtonPressed = false;
- // Fall through.
- case QEvent::TouchEnd:
- m_viewportController->touchEnd();
break;
- default:
- ASSERT(event->type() == QEvent::MouseButtonDblClick);
+ case QEvent::MouseButtonDblClick:
return;
+ default:
+ break;
}
- // If the scale animation is active we don't pass the event to the recognizers. In the future
- // we would want to queue the event here and repost then when the animation ends.
- if (m_viewportController->scaleAnimationActive())
- return;
-
QList<QTouchEvent::TouchPoint> activeTouchPoints;
QTouchEvent::TouchPoint currentTouchPoint;
qint64 eventTimestampMillis = event->timestamp();
@@ -568,9 +576,6 @@ void QtWebPageEventHandler::handleInputEvent(const QInputEvent* event)
#if ENABLE(TOUCH_EVENTS)
void QtWebPageEventHandler::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled)
{
- if (!m_viewportController)
- return;
-
if (wasEventHandled || event.type() == WebEvent::TouchCancel) {
m_panGestureRecognizer.cancel();
m_pinchGestureRecognizer.cancel();