summaryrefslogtreecommitdiffstats
path: root/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-16 14:56:46 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-16 14:57:30 +0200
commitb297e0fa5c217c9467033b7c8b46891a52870120 (patch)
tree43fc14689295e9e64f2719d05aad94e3049f6cd7 /Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
parent69d517dbfa69903d8593cc1737f0474b21e3251e (diff)
Revert "Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)"
This reverts commit 5466563f4b5b6b86523e3f89bb7f77e5b5270c78. Caused OOM issues on some CI machines :(
Diffstat (limited to 'Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp')
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp73
1 files changed, 34 insertions, 39 deletions
diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp
index fdc92355f..819d4a0a2 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.
- QHoverEvent fakeEvent(QEvent::HoverMove, QPoint(INT_MIN, INT_MIN), ev->oldPosF());
+ QTransform fromItemTransform = m_webPage->transformFromItem();
+ QHoverEvent fakeEvent(QEvent::HoverMove, QPoint(INT_MIN, INT_MIN), fromItemTransform.map(ev->oldPosF()));
fakeEvent.setTimestamp(ev->timestamp());
- // This will apply the transform on the event.
handleHoverMoveEvent(&fakeEvent);
}
void QtWebPageEventHandler::handleHoverMoveEvent(QHoverEvent* ev)
{
- QMouseEvent me(QEvent::MouseMove, ev->posF(), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
+ QTransform fromItemTransform = m_webPage->transformFromItem();
+ QMouseEvent me(QEvent::MouseMove, fromItemTransform.map(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,38 +450,7 @@ void QtWebPageEventHandler::doneWithGestureEvent(const WebGestureEvent& event, b
void QtWebPageEventHandler::handleInputEvent(const QInputEvent* event)
{
- 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;
- }
+ ASSERT(m_viewportController);
bool isMouseEvent = false;
@@ -489,22 +458,45 @@ 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;
- case QEvent::MouseButtonDblClick:
- return;
default:
- break;
+ ASSERT(event->type() == QEvent::MouseButtonDblClick);
+ return;
}
+ // 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();
@@ -576,6 +568,9 @@ 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();