Diff
Modified: trunk/LayoutTests/ChangeLog (111181 => 111182)
--- trunk/LayoutTests/ChangeLog 2012-03-19 14:47:07 UTC (rev 111181)
+++ trunk/LayoutTests/ChangeLog 2012-03-19 14:51:06 UTC (rev 111182)
@@ -1,3 +1,26 @@
+2012-03-19 Robert Kroeger <[email protected]>
+
+ [chromium] synthesize wheel events for fling on main thread
+ https://bugs.webkit.org/show_bug.cgi?id=81458
+
+ Show that the GestureFlingStart and GestureFlingEnd events are handled and
+ connect up with WebViewImpl
+
+ Reviewed by James Robinson.
+
+ * fast/events/touch/gesture/pad-gesture-cancel-expected.txt: Added.
+ * fast/events/touch/gesture/pad-gesture-cancel.html: Added.
+ * fast/events/touch/gesture/pad-gesture-cancel.js: Added.
+ (recordWheelEvent):
+ (if):
+ * fast/events/touch/gesture/pad-gesture-fling-expected.txt: Added.
+ * fast/events/touch/gesture/pad-gesture-fling.html: Added.
+ * fast/events/touch/gesture/pad-gesture-fling.js: Added.
+ (recordWheelEvent):
+ (if):
+ * platform/chromium/fast/events/touch/gesture/pad-gesture-cancel-expected.txt: Added.
+ * platform/chromium/fast/events/touch/gesture/pad-gesture-fling-expected.txt: Added.
+
2012-03-19 Ádám Kallai <[email protected]>
[Qt] Unreviewed. Add new platform specific expectation after r110667.
Added: trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-cancel-expected.txt (0 => 111182)
--- trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-cancel-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-cancel-expected.txt 2012-03-19 14:51:06 UTC (rev 111182)
@@ -0,0 +1,10 @@
+Tests basic use of GestureFlingCancel
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL actualWheelEventsOccurred should be 1. Was 0.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-cancel.html (0 => 111182)
--- trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-cancel.html (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-cancel.html 2012-03-19 14:51:06 UTC (rev 111182)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<span id="e"></span>
+<span id="f"></span>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-cancel.js (0 => 111182)
--- trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-cancel.js (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-cancel.js 2012-03-19 14:51:06 UTC (rev 111182)
@@ -0,0 +1,36 @@
+description("Tests basic use of GestureFlingCancel");
+
+var expectedWheelEventsOccurred = "0";
+var actualWheelEventsOccurred = 0;
+
+function recordWheelEvent(event)
+{
+ shouldBe('event.clientX', "10");
+ shouldBe('event.clientY', "11");
+
+ // Test deliberately does not equality check wheelDeltas to not be fragile in the face of curve adjustment.
+ shouldBeTrue("event.wheelDeltaX > 5");
+ shouldBeTrue("event.wheelDeltaY > 5");
+ actualWheelEventsOccurred++;
+}
+
+document.addEventListener("mousewheel", recordWheelEvent);
+
+if (window.layoutTestController && window.eventSender && window.eventSender.gestureFlingStart) {
+ eventSender.gestureFlingStart(10, 11, 1000, 1000);
+ eventSender.gestureFlingCancel();
+ layoutTestController.display();
+}
+
+setTimeout(function() {
+ shouldBe('actualWheelEventsOccurred', expectedWheelEventsOccurred);
+}, 100);
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+setTimeout(function() {
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}, 200);
Added: trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-fling-expected.txt (0 => 111182)
--- trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-fling-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-fling-expected.txt 2012-03-19 14:51:06 UTC (rev 111182)
@@ -0,0 +1,10 @@
+Tests basic use of GestureFlingStart
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL actualWheelEventsOccurred should be 2. Was 0.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-fling.html (0 => 111182)
--- trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-fling.html (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-fling.html 2012-03-19 14:51:06 UTC (rev 111182)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<span id="e"></span>
+<span id="f"></span>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-fling.js (0 => 111182)
--- trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-fling.js (rev 0)
+++ trunk/LayoutTests/fast/events/touch/gesture/pad-gesture-fling.js 2012-03-19 14:51:06 UTC (rev 111182)
@@ -0,0 +1,37 @@
+description("Tests basic use of GestureFlingStart");
+
+var expectedWheelEventsOccurred = "2";
+var actualWheelEventsOccurred = 0;
+
+function recordWheelEvent(event)
+{
+ shouldBe('event.clientX', "10");
+ shouldBe('event.clientY', "11");
+
+ // Test deliberately does not equality check wheelDeltas to not be fragile in the face of curve adjustment.
+ shouldBeTrue("event.wheelDeltaX > 5");
+ shouldBeTrue("event.wheelDeltaY > 5");
+ actualWheelEventsOccurred++;
+}
+
+document.addEventListener("mousewheel", recordWheelEvent);
+
+if (window.layoutTestController && window.eventSender && window.eventSender.gestureFlingStart) {
+ eventSender.gestureFlingStart(10, 11, 1000, 1000);
+ layoutTestController.display();
+ layoutTestController.display();
+ layoutTestController.display();
+}
+
+setTimeout(function() {
+ shouldBe('actualWheelEventsOccurred', expectedWheelEventsOccurred);
+}, 100);
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+setTimeout(function() {
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}, 200);
Added: trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/pad-gesture-cancel-expected.txt (0 => 111182)
--- trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/pad-gesture-cancel-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/pad-gesture-cancel-expected.txt 2012-03-19 14:51:06 UTC (rev 111182)
@@ -0,0 +1,10 @@
+Tests basic use of GestureFlingCancel
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS actualWheelEventsOccurred is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/pad-gesture-fling-expected.txt (0 => 111182)
--- trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/pad-gesture-fling-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/events/touch/gesture/pad-gesture-fling-expected.txt 2012-03-19 14:51:06 UTC (rev 111182)
@@ -0,0 +1,18 @@
+Tests basic use of GestureFlingStart
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS event.clientX is 10
+PASS event.clientY is 11
+PASS event.wheelDeltaX > 5 is true
+PASS event.wheelDeltaY > 5 is true
+PASS event.clientX is 10
+PASS event.clientY is 11
+PASS event.wheelDeltaX > 5 is true
+PASS event.wheelDeltaY > 5 is true
+PASS actualWheelEventsOccurred is 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Modified: trunk/Source/WebKit/chromium/ChangeLog (111181 => 111182)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-03-19 14:47:07 UTC (rev 111181)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-03-19 14:51:06 UTC (rev 111182)
@@ -1,3 +1,23 @@
+2012-03-19 Robert Kroeger <[email protected]>
+
+ [chromium] synthesize wheel events for fling on main thread
+ https://bugs.webkit.org/show_bug.cgi?id=81458
+
+ Support track pad fling by generating a sequence of wheel events.
+
+ Reviewed by James Robinson.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+ (WebKit::WebViewImpl::scrollBy): Call-back from PlatformGestureCurve to dispatch wheel event.
+ (WebKit):
+ (WebKit::WebViewImpl::gestureEvent): Handle GestureFlingStart and GestureFlingCancel.
+ (WebKit::WebViewImpl::updateAnimations): Requests a PlatformGestureCurve to animate forward.
+ (WebKit::WebViewImpl::didCommitLoad): Halt flings on navigations.
+ * src/WebViewImpl.h:
+ (WebCore):
+ (WebViewImpl):
+
2012-03-19 Keishi Hattori <[email protected]>
[chromium] Fix build that was broken by r111137
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (111181 => 111182)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-03-19 14:47:07 UTC (rev 111181)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-03-19 14:51:06 UTC (rev 111182)
@@ -31,6 +31,7 @@
#include "config.h"
#include "WebViewImpl.h"
+#include "ActivePlatformGestureAnimation.h"
#include "AutofillPopupMenuClient.h"
#include "AXObjectCache.h"
#include "BackForwardListChromium.h"
@@ -109,6 +110,7 @@
#include "SpeechRecognitionClient.h"
#include "TextIterator.h"
#include "Timer.h"
+#include "TouchFlingPlatformGestureCurve.h"
#include "TraceEvent.h"
#include "TypingCommand.h"
#include "UserGestureIndicator.h"
@@ -143,6 +145,7 @@
#include "platform/WebString.h"
#include "platform/WebVector.h"
#include "WebViewClient.h"
+#include "WheelEvent.h"
#include <wtf/ByteArray.h>
#include <wtf/CurrentTime.h>
#include <wtf/MainThread.h>
@@ -364,6 +367,7 @@
#if ENABLE(MEDIA_STREAM)
, m_userMediaClientImpl(this)
#endif
+ , m_flingModifier(0)
{
// WebKit/win/WebView.cpp does the same thing, except they call the
// KJS specific wrapper around this method. We need to have threading
@@ -603,11 +607,57 @@
return mainFrameImpl()->frame()->eventHandler()->handleWheelEvent(platformEvent);
}
+void WebViewImpl::scrollBy(const WebCore::IntPoint& delta)
+{
+ WebMouseWheelEvent syntheticWheel;
+ const float tickDivisor = WebCore::WheelEvent::tickMultiplier;
+
+ syntheticWheel.deltaX = delta.x();
+ syntheticWheel.deltaY = delta.y();
+ syntheticWheel.wheelTicksX = delta.x() / tickDivisor;
+ syntheticWheel.wheelTicksY = delta.y() / tickDivisor;
+ syntheticWheel.hasPreciseScrollingDeltas = true;
+ syntheticWheel.x = m_lastWheelPosition.x;
+ syntheticWheel.y = m_lastWheelPosition.y;
+ syntheticWheel.globalX = m_lastWheelGlobalPosition.x;
+ syntheticWheel.globalY = m_lastWheelGlobalPosition.y;
+ syntheticWheel.modifiers = m_flingModifier;
+
+ mouseWheel(syntheticWheel);
+}
+
#if ENABLE(GESTURE_EVENTS)
bool WebViewImpl::gestureEvent(const WebGestureEvent& event)
{
- PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event);
- return mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent);
+ switch (event.type) {
+ case WebInputEvent::GestureFlingStart: {
+ m_lastWheelPosition = WebPoint(event.x, event.y);
+ m_lastWheelGlobalPosition = WebPoint(event.globalX, event.globalY);
+ m_flingModifier = event.modifiers;
+ // FIXME: Make the curve parametrizable from the browser.
+ m_gestureAnimation = ActivePlatformGestureAnimation::create(TouchFlingPlatformGestureCurve::create(FloatPoint(event.deltaX, event.deltaY)), this);
+ scheduleAnimation();
+ return true;
+ }
+ case WebInputEvent::GestureFlingCancel:
+ m_gestureAnimation.clear();
+ return true;
+ case WebInputEvent::GestureScrollBegin:
+ case WebInputEvent::GestureScrollEnd:
+ case WebInputEvent::GestureScrollUpdate:
+ case WebInputEvent::GestureTap:
+ case WebInputEvent::GestureTapDown:
+ case WebInputEvent::GestureDoubleTap:
+ case WebInputEvent::GesturePinchBegin:
+ case WebInputEvent::GesturePinchEnd:
+ case WebInputEvent::GesturePinchUpdate: {
+ PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event);
+ return mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent);
+ }
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ return false;
}
void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec)
@@ -1289,6 +1339,15 @@
FrameView* view = webframe->frameView();
if (!view)
return;
+
+ // Create synthetic wheel events as necessary for fling.
+ if (m_gestureAnimation) {
+ if (m_gestureAnimation->animate(frameBeginTime))
+ scheduleAnimation();
+ else
+ m_gestureAnimation.clear();
+ }
+
view->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(frameBeginTime));
#endif
}
@@ -2838,6 +2897,8 @@
m_observedNewNavigation = false;
if (!isNavigationWithinPage)
m_pageScaleFactorIsSet = false;
+
+ m_gestureAnimation.clear();
}
void WebViewImpl::layoutUpdated(WebFrameImpl* webframe)
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (111181 => 111182)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.h 2012-03-19 14:47:07 UTC (rev 111181)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h 2012-03-19 14:51:06 UTC (rev 111182)
@@ -52,11 +52,13 @@
#include "IntRect.h"
#include "NotificationPresenterImpl.h"
#include "PageOverlayList.h"
+#include "PlatformGestureCurveTarget.h"
#include "UserMediaClientImpl.h"
#include <wtf/OwnPtr.h>
#include <wtf/RefCounted.h>
namespace WebCore {
+class ActivePlatformGestureAnimation;
class ChromiumDataObject;
class DocumentLoader;
class Frame;
@@ -65,6 +67,7 @@
class HitTestResult;
class KeyboardEvent;
class Page;
+class PlatformGestureCurveTarget;
class PlatformKeyboardEvent;
class PopupContainer;
class PopupMenuClient;
@@ -96,7 +99,7 @@
class WebSettingsImpl;
class WebTouchEvent;
-class WebViewImpl : public WebView, public WebLayerTreeViewClient, public RefCounted<WebViewImpl> {
+class WebViewImpl : public WebView, public WebLayerTreeViewClient, public RefCounted<WebViewImpl>, public WebCore::PlatformGestureCurveTarget {
public:
enum AutoZoomType {
DoubleTap,
@@ -333,6 +336,9 @@
void numberOfWheelEventHandlersChanged(unsigned);
void numberOfTouchEventHandlersChanged(unsigned);
+ // PlatformGestureCurveTarget implementation for wheel fling.
+ virtual void scrollBy(const WebCore::IntPoint&);
+
// Handles context menu events orignated via the the keyboard. These
// include the VK_APPS virtual key and the Shift+F10 combine. Code is
// based on the Webkit function bool WebView::handleContextMenuEvent(WPARAM
@@ -718,6 +724,10 @@
#if ENABLE(MEDIA_STREAM)
UserMediaClientImpl m_userMediaClientImpl;
#endif
+ OwnPtr<WebCore::ActivePlatformGestureAnimation> m_gestureAnimation;
+ WebPoint m_lastWheelPosition;
+ WebPoint m_lastWheelGlobalPosition;
+ int m_flingModifier;
};
} // namespace WebKit
Modified: trunk/Tools/ChangeLog (111181 => 111182)
--- trunk/Tools/ChangeLog 2012-03-19 14:47:07 UTC (rev 111181)
+++ trunk/Tools/ChangeLog 2012-03-19 14:51:06 UTC (rev 111182)
@@ -1,3 +1,19 @@
+2012-03-19 Robert Kroeger <[email protected]>
+
+ [chromium] synthesize wheel events for fling on main thread
+ https://bugs.webkit.org/show_bug.cgi?id=81458
+
+ Added the ability to dispatch GestureFlingStart and GestureFlingCancel from EventSender.
+
+ Reviewed by James Robinson.
+
+ * DumpRenderTree/chromium/EventSender.cpp:
+ (EventSender::EventSender):
+ (EventSender::gestureFlingCancel):
+ (EventSender::gestureFlingStart):
+ * DumpRenderTree/chromium/EventSender.h:
+ (EventSender):
+
2012-03-19 Alexander Færøy <[email protected]>
[Qt] Add command line option to set the user agent in the MiniBrowser
Modified: trunk/Tools/DumpRenderTree/chromium/EventSender.cpp (111181 => 111182)
--- trunk/Tools/DumpRenderTree/chromium/EventSender.cpp 2012-03-19 14:47:07 UTC (rev 111181)
+++ trunk/Tools/DumpRenderTree/chromium/EventSender.cpp 2012-03-19 14:51:06 UTC (rev 111182)
@@ -279,6 +279,8 @@
bindMethod("touchMove", &EventSender::touchMove);
bindMethod("touchStart", &EventSender::touchStart);
bindMethod("updateTouchPoint", &EventSender::updateTouchPoint);
+ bindMethod("gestureFlingCancel", &EventSender::gestureFlingCancel);
+ bindMethod("gestureFlingStart", &EventSender::gestureFlingStart);
bindMethod("gestureScrollBegin", &EventSender::gestureScrollBegin);
bindMethod("gestureScrollEnd", &EventSender::gestureScrollEnd);
bindMethod("gestureScrollFirstPoint", &EventSender::gestureScrollFirstPoint);
@@ -1142,6 +1144,42 @@
webview()->handleInputEvent(event);
}
+void EventSender::gestureFlingCancel(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (!arguments.size())
+ return;
+
+ WebGestureEvent event;
+ event.type = WebInputEvent::GestureFlingCancel;
+ event.timeStampSeconds = getCurrentEventTimeSec();
+ webview()->handleInputEvent(event);
+}
+
+void EventSender::gestureFlingStart(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 4)
+ return;
+
+ for (int i = 0; i < 4; i++)
+ if (!arguments[i].isNumber())
+ return;
+
+ WebGestureEvent event;
+ event.type = WebInputEvent::GestureFlingStart;
+
+ event.x = static_cast<float>(arguments[0].toDouble());
+ event.y = static_cast<float>(arguments[1].toDouble());
+ event.globalX = event.x;
+ event.globalY = event.y;
+
+ event.deltaX = static_cast<float>(arguments[2].toDouble());
+ event.deltaY = static_cast<float>(arguments[3].toDouble());
+ event.timeStampSeconds = getCurrentEventTimeSec();
+ webview()->handleInputEvent(event);
+}
+
//
// Unimplemented stubs
//
Modified: trunk/Tools/DumpRenderTree/chromium/EventSender.h (111181 => 111182)
--- trunk/Tools/DumpRenderTree/chromium/EventSender.h 2012-03-19 14:47:07 UTC (rev 111181)
+++ trunk/Tools/DumpRenderTree/chromium/EventSender.h 2012-03-19 14:51:06 UTC (rev 111182)
@@ -97,6 +97,8 @@
void touchStart(const CppArgumentList&, CppVariant*);
void updateTouchPoint(const CppArgumentList&, CppVariant*);
+ void gestureFlingCancel(const CppArgumentList&, CppVariant*);
+ void gestureFlingStart(const CppArgumentList&, CppVariant*);
void gestureScrollBegin(const CppArgumentList&, CppVariant*);
void gestureScrollEnd(const CppArgumentList&, CppVariant*);
void gestureScrollFirstPoint(const CppArgumentList&, CppVariant*);