Title: [115311] trunk/Source/WebKit2
- Revision
- 115311
- Author
- abe...@webkit.org
- Date
- 2012-04-26 07:11:44 -0700 (Thu, 26 Apr 2012)
Log Message
[Qt][WK2] Tap highlight should have a delay not to interfere with panning
https://bugs.webkit.org/show_bug.cgi?id=84948
Reviewed by Kenneth Rohde Christiansen.
Start the tap highlight animation after a slight delay so that pan
gestures do not result in flashing highlight rects which slow down
flicking, especially during continuous pan gestures.
* UIProcess/qt/QtTapGestureRecognizer.cpp:
(WebKit::QtTapGestureRecognizer::update):
(WebKit::QtTapGestureRecognizer::highlightTimeout):
(WebKit):
(WebKit::QtTapGestureRecognizer::reset):
(WebKit::QtTapGestureRecognizer::timerEvent):
* UIProcess/qt/QtTapGestureRecognizer.h:
(QtTapGestureRecognizer):
* UIProcess/qt/QtWebPageEventHandler.cpp:
(WebKit::QtWebPageEventHandler::doneWithTouchEvent):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (115310 => 115311)
--- trunk/Source/WebKit2/ChangeLog 2012-04-26 14:06:39 UTC (rev 115310)
+++ trunk/Source/WebKit2/ChangeLog 2012-04-26 14:11:44 UTC (rev 115311)
@@ -1,3 +1,25 @@
+2012-04-26 Andras Becsi <andras.be...@nokia.com>
+
+ [Qt][WK2] Tap highlight should have a delay not to interfere with panning
+ https://bugs.webkit.org/show_bug.cgi?id=84948
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Start the tap highlight animation after a slight delay so that pan
+ gestures do not result in flashing highlight rects which slow down
+ flicking, especially during continuous pan gestures.
+
+ * UIProcess/qt/QtTapGestureRecognizer.cpp:
+ (WebKit::QtTapGestureRecognizer::update):
+ (WebKit::QtTapGestureRecognizer::highlightTimeout):
+ (WebKit):
+ (WebKit::QtTapGestureRecognizer::reset):
+ (WebKit::QtTapGestureRecognizer::timerEvent):
+ * UIProcess/qt/QtTapGestureRecognizer.h:
+ (QtTapGestureRecognizer):
+ * UIProcess/qt/QtWebPageEventHandler.cpp:
+ (WebKit::QtWebPageEventHandler::doneWithTouchEvent):
+
2012-04-26 Lars Knudsen <lars.knud...@nokia.com>
Make it possible to use accelerated compositing for page overlay fading
Modified: trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp (115310 => 115311)
--- trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp 2012-04-26 14:06:39 UTC (rev 115310)
+++ trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp 2012-04-26 14:11:44 UTC (rev 115311)
@@ -58,7 +58,7 @@
else {
m_candidate = SingleTapCandidate;
// The below in facts resets any previous single tap event.
- m_eventHandler->handlePotentialSingleTapEvent(touchPoint);
+ m_highlightTimer.start(highlightDelay, this);
m_lastTouchPoint = touchPoint;
m_doubleTapTimer.start(maxDoubleTapInterval, this);
}
@@ -99,6 +99,15 @@
reset();
}
+void QtTapGestureRecognizer::highlightTimeout()
+{
+ if (m_candidate != SingleTapCandidate)
+ return;
+
+ ASSERT(m_lastTouchPoint.id() != -1);
+ m_eventHandler->handlePotentialSingleTapEvent(m_lastTouchPoint);
+}
+
void QtTapGestureRecognizer::singleTapTimeout()
{
// Finger is still pressed, ignore.
@@ -130,9 +139,10 @@
m_eventHandler->handlePotentialSingleTapEvent(QTouchEvent::TouchPoint());
m_candidate = Invalid;
+ m_lastTouchPoint.setId(-1);
+ m_highlightTimer.stop();
+ m_doubleTapTimer.stop();
m_tapAndHoldTimer.stop();
- m_doubleTapTimer.stop();
- m_lastTouchPoint.setId(-1);
QtGestureRecognizer::reset();
}
@@ -140,7 +150,9 @@
void QtTapGestureRecognizer::timerEvent(QTimerEvent* ev)
{
int timerId = ev->timerId();
- if (timerId == m_doubleTapTimer.timerId())
+ if (timerId == m_highlightTimer.timerId())
+ highlightTimeout();
+ else if (timerId == m_doubleTapTimer.timerId())
singleTapTimeout();
else if (timerId == m_tapAndHoldTimer.timerId())
tapAndHoldTimeout();
Modified: trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.h (115310 => 115311)
--- trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.h 2012-04-26 14:06:39 UTC (rev 115310)
+++ trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.h 2012-04-26 14:11:44 UTC (rev 115311)
@@ -32,10 +32,11 @@
#include <QtCore/QObject>
// FIXME: These constants should possibly depend on DPI.
-const int maxPanDistance = 5;
+const int maxPanDistance = 10;
const int maxDoubleTapDistance = 120;
const int tapAndHoldTime = 800;
const int maxDoubleTapInterval = 400;
+const int highlightDelay = 80;
namespace WebKit {
@@ -49,6 +50,7 @@
protected:
void timerEvent(QTimerEvent*);
+ void highlightTimeout();
void singleTapTimeout();
void tapAndHoldTimeout();
@@ -56,6 +58,7 @@
void reset();
bool withinDistance(const QTouchEvent::TouchPoint&, int distance);
+ QBasicTimer m_highlightTimer;
QBasicTimer m_doubleTapTimer;
QBasicTimer m_tapAndHoldTimer;
QTouchEvent::TouchPoint m_lastTouchPoint;
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp (115310 => 115311)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp 2012-04-26 14:06:39 UTC (rev 115310)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp 2012-04-26 14:11:44 UTC (rev 115311)
@@ -488,11 +488,16 @@
const int activeTouchPointCount = activeTouchPoints.size();
if (!activeTouchPointCount) {
- if (touchPointCount == 1)
- // No active touch points, one finger released.
- m_panGestureRecognizer.finish(touchPoints.first(), eventTimestampMillis);
- else
- m_pinchGestureRecognizer.finish();
+ if (touchPointCount == 1) {
+ // No active touch points, one finger released.
+ if (!m_panGestureRecognizer.isRecognized())
+ m_tapGestureRecognizer.update(ev->type(), touchPoints.first());
+ m_panGestureRecognizer.finish(touchPoints.first(), eventTimestampMillis);
+ } else
+ m_pinchGestureRecognizer.finish();
+
+ // Early return since this was a touch-end event.
+ return;
} else if (activeTouchPointCount == 1) {
// If the pinch gesture recognizer was previously in active state the content might
// be out of valid zoom boundaries, thus we need to finish the pinch gesture here.
@@ -504,7 +509,7 @@
m_pinchGestureRecognizer.update(activeTouchPoints.first(), activeTouchPoints.last());
}
- if (m_panGestureRecognizer.isRecognized() || m_pinchGestureRecognizer.isRecognized())
+ if (m_panGestureRecognizer.isRecognized() || m_pinchGestureRecognizer.isRecognized() || m_webView->isMoving())
m_tapGestureRecognizer.cancel();
else if (touchPointCount == 1)
m_tapGestureRecognizer.update(ev->type(), touchPoints.first());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes