Title: [135318] trunk/Source/WebKit/chromium
Revision
135318
Author
[email protected]
Date
2012-11-20 15:27:39 -0800 (Tue, 20 Nov 2012)

Log Message

[chromium] Use embedder-supported gesture curves
https://bugs.webkit.org/show_bug.cgi?id=100884

Reviewed by James Robinson.

Use embedder-provided gesture animation curves via WebKit api interfaces.
Tested by existing tests.

* src/WebCompositorInputHandlerImpl.cpp:
(WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
(WebKit::WebCompositorInputHandlerImpl::scrollBy):
* src/WebCompositorInputHandlerImpl.h:
(WebCompositorInputHandlerImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::scrollBy):
(WebKit::WebViewImpl::handleGestureEvent):
(WebKit::WebViewImpl::transferActiveWheelFlingAnimation):
* src/WebViewImpl.h:
(WebCore):
(WebKit):
(WebViewImpl):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (135317 => 135318)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-11-20 22:54:38 UTC (rev 135317)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-11-20 23:27:39 UTC (rev 135318)
@@ -1,3 +1,27 @@
+2012-11-20  Robert Kroeger  <[email protected]>
+
+        [chromium] Use embedder-supported gesture curves
+        https://bugs.webkit.org/show_bug.cgi?id=100884
+
+        Reviewed by James Robinson.
+
+        Use embedder-provided gesture animation curves via WebKit api interfaces.
+        Tested by existing tests.
+
+        * src/WebCompositorInputHandlerImpl.cpp:
+        (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
+        (WebKit::WebCompositorInputHandlerImpl::scrollBy):
+        * src/WebCompositorInputHandlerImpl.h:
+        (WebCompositorInputHandlerImpl):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::scrollBy):
+        (WebKit::WebViewImpl::handleGestureEvent):
+        (WebKit::WebViewImpl::transferActiveWheelFlingAnimation):
+        * src/WebViewImpl.h:
+        (WebCore):
+        (WebKit):
+        (WebViewImpl):
+
 2012-11-20  Tony Chang  <[email protected]>
 
         When calling DocumentStyleSheetCollection::addUserSheet, pass in a user sheet

Modified: trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp (135317 => 135318)


--- trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp	2012-11-20 22:54:38 UTC (rev 135317)
+++ trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp	2012-11-20 23:27:39 UTC (rev 135318)
@@ -27,12 +27,12 @@
 
 #include "WebCompositorInputHandlerImpl.h"
 
-#include "PlatformGestureCurveFactory.h"
-#include "PlatformGestureCurveTarget.h"
 #include "TraceEvent.h"
 #include "WebCompositorInputHandlerClient.h"
 #include "WebInputEvent.h"
+#include <public/Platform.h>
 #include <public/WebInputHandlerClient.h>
+#include <wtf/PassOwnPtr.h>
 #include <wtf/ThreadingPrimitives.h>
 
 using namespace WebCore;
@@ -206,8 +206,8 @@
     switch (scrollStatus) {
     case WebInputHandlerClient::ScrollStatusStarted: {
         m_inputHandlerClient->scrollEnd();
-        m_wheelFlingCurve = PlatformGestureCurveFactory::get()->createCurve(gestureEvent.data.flingStart.sourceDevice, FloatPoint(gestureEvent.data.flingStart.velocityX, gestureEvent.data.flingStart.velocityY));
-        TRACE_EVENT_ASYNC_BEGIN1("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started", this, "curve", m_wheelFlingCurve->debugName());
+        m_wheelFlingCurve = adoptPtr(Platform::current()->createFlingAnimationCurve(gestureEvent.data.flingStart.sourceDevice, WebFloatPoint(gestureEvent.data.flingStart.velocityX, gestureEvent.data.flingStart.velocityY), WebSize()));
+        TRACE_EVENT_ASYNC_BEGIN0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started", this);
         m_wheelFlingParameters.delta = WebFloatPoint(gestureEvent.data.flingStart.velocityX, gestureEvent.data.flingStart.velocityY);
         m_wheelFlingParameters.point = WebPoint(gestureEvent.x, gestureEvent.y);
         m_wheelFlingParameters.globalPoint = WebPoint(gestureEvent.globalX, gestureEvent.globalY);
@@ -273,16 +273,16 @@
     return hadFlingAnimation;
 }
 
-void WebCompositorInputHandlerImpl::scrollBy(const IntPoint& increment)
+void WebCompositorInputHandlerImpl::scrollBy(const WebPoint& increment)
 {
-    if (increment == IntPoint::zero())
+    if (increment == WebPoint())
         return;
 
-    TRACE_EVENT2("cc", "WebCompositorInputHandlerImpl::scrollBy", "x", increment.x(), "y", increment.y());
+    TRACE_EVENT2("cc", "WebCompositorInputHandlerImpl::scrollBy", "x", increment.x, "y", increment.y);
     WebMouseWheelEvent syntheticWheel;
     syntheticWheel.type = WebInputEvent::MouseWheel;
-    syntheticWheel.deltaX = increment.x();
-    syntheticWheel.deltaY = increment.y();
+    syntheticWheel.deltaX = increment.x;
+    syntheticWheel.deltaY = increment.y;
     syntheticWheel.hasPreciseScrollingDeltas = true;
     syntheticWheel.x = m_wheelFlingParameters.point.x;
     syntheticWheel.y = m_wheelFlingParameters.point.y;
@@ -293,8 +293,8 @@
     WebCompositorInputHandlerImpl::EventDisposition disposition = handleInputEventInternal(syntheticWheel);
     switch (disposition) {
     case DidHandle:
-        m_wheelFlingParameters.cumulativeScroll.width += increment.x();
-        m_wheelFlingParameters.cumulativeScroll.height += increment.y();
+        m_wheelFlingParameters.cumulativeScroll.width += increment.x;
+        m_wheelFlingParameters.cumulativeScroll.height += increment.y;
     case DropEvent:
         break;
     case DidNotHandle:

Modified: trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h (135317 => 135318)


--- trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h	2012-11-20 22:54:38 UTC (rev 135317)
+++ trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h	2012-11-20 23:27:39 UTC (rev 135318)
@@ -26,10 +26,11 @@
 #ifndef WebCompositorInputHandlerImpl_h
 #define WebCompositorInputHandlerImpl_h
 
-#include "PlatformGestureCurveTarget.h"
 #include "WebActiveWheelFlingParameters.h"
 #include "WebCompositorInputHandler.h"
 #include "WebInputEvent.h"
+#include <public/WebGestureCurve.h>
+#include <public/WebGestureCurveTarget.h>
 #include <public/WebInputHandler.h>
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
@@ -41,14 +42,13 @@
 
 namespace WebCore {
 class IntPoint;
-class PlatformGestureCurve;
 }
 
 namespace WebKit {
 
 class WebCompositorInputHandlerClient;
 
-class WebCompositorInputHandlerImpl : public WebCompositorInputHandler, public WebInputHandler, public WebCore::PlatformGestureCurveTarget {
+class WebCompositorInputHandlerImpl : public WebCompositorInputHandler, public WebInputHandler, public WebGestureCurveTarget {
     WTF_MAKE_NONCOPYABLE(WebCompositorInputHandlerImpl);
 public:
     static WebCompositorInputHandler* fromIdentifier(int identifier);
@@ -64,8 +64,8 @@
     virtual void bindToClient(WebInputHandlerClient*);
     virtual void animate(double monotonicTime);
 
-    // WebCore::PlatformGestureCurveTarget implementation.
-    virtual void scrollBy(const WebCore::IntPoint&);
+    // WebGestureCurveTarget implementation.
+    virtual void scrollBy(const WebPoint&);
 
     int identifier() const { return m_identifier; }
 
@@ -81,7 +81,7 @@
     // Returns true if we actually had an active fling to cancel.
     bool cancelCurrentFling();
 
-    OwnPtr<WebCore::PlatformGestureCurve> m_wheelFlingCurve;
+    OwnPtr<WebGestureCurve> m_wheelFlingCurve;
     // Parameters for the active fling animation, stored in case we need to transfer it out later.
     WebActiveWheelFlingParameters m_wheelFlingParameters;
 

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (135317 => 135318)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-11-20 22:54:38 UTC (rev 135317)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-11-20 23:27:39 UTC (rev 135318)
@@ -32,7 +32,6 @@
 #include "WebViewImpl.h"
 
 #include "AXObjectCache.h"
-#include "ActivePlatformGestureAnimation.h"
 #include "AutofillPopupMenuClient.h"
 #include "BackForwardListChromium.h"
 #include "BatteryClientImpl.h"
@@ -145,6 +144,7 @@
 #include "WebViewClient.h"
 #include "WheelEvent.h"
 #include "painting/GraphicsContextBuilder.h"
+#include "src/WebActiveGestureAnimation.h"
 #include <public/Platform.h>
 #include <public/WebCompositorOutputSurface.h>
 #include <public/WebCompositorSupport.h>
@@ -170,7 +170,6 @@
 #endif
 
 #if ENABLE(GESTURE_EVENTS)
-#include "PlatformGestureCurveFactory.h"
 #include "PlatformGestureEvent.h"
 #include "TouchDisambiguation.h"
 #endif
@@ -649,15 +648,15 @@
 #endif
 }
 
-void WebViewImpl::scrollBy(const WebCore::IntPoint& delta)
+void WebViewImpl::scrollBy(const WebPoint& 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.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;
@@ -705,9 +704,8 @@
         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.
-        OwnPtr<PlatformGestureCurve> flingCurve = PlatformGestureCurveFactory::get()->createCurve(event.data.flingStart.sourceDevice, FloatPoint(event.data.flingStart.velocityX, event.data.flingStart.velocityY));
-        m_gestureAnimation = ActivePlatformGestureAnimation::create(flingCurve.release(), this);
+        OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->createFlingAnimationCurve(event.data.flingStart.sourceDevice, WebFloatPoint(event.data.flingStart.velocityX, event.data.flingStart.velocityY), WebSize()));
+        m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(flingCurve.release(), this);
         scheduleAnimation();
         eventSwallowed = true;
         break;
@@ -809,8 +807,8 @@
     m_lastWheelPosition = parameters.point;
     m_lastWheelGlobalPosition = parameters.globalPoint;
     m_flingModifier = parameters.modifiers;
-    OwnPtr<PlatformGestureCurve> curve = PlatformGestureCurveFactory::get()->createCurve(parameters.sourceDevice, parameters.delta, IntPoint(parameters.cumulativeScroll));
-    m_gestureAnimation = ActivePlatformGestureAnimation::create(curve.release(), this, parameters.startTime);
+    OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAnimationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters.cumulativeScroll));
+    m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset(curve.release(), this, parameters.startTime);
     scheduleAnimation();
 }
 

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (135317 => 135318)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-11-20 22:54:38 UTC (rev 135317)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-11-20 23:27:39 UTC (rev 135318)
@@ -44,13 +44,13 @@
 #include "PageOverlayList.h"
 #include "PagePopupDriver.h"
 #include "PageWidgetDelegate.h"
-#include "PlatformGestureCurveTarget.h"
 #include "UserMediaClientImpl.h"
 #include "WebInputEvent.h"
 #include "WebNavigationPolicy.h"
 #include "WebView.h"
 #include "WebViewBenchmarkSupportImpl.h"
 #include <public/WebFloatQuad.h>
+#include <public/WebGestureCurveTarget.h>
 #include <public/WebLayer.h>
 #include <public/WebLayerTreeViewClient.h>
 #include <public/WebPoint.h>
@@ -61,7 +61,6 @@
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
-class ActivePlatformGestureAnimation;
 class ChromiumDataObject;
 class Color;
 class DocumentLoader;
@@ -74,7 +73,6 @@
 class PageGroup;
 class PagePopup;
 class PagePopupClient;
-class PlatformGestureCurveTarget;
 class PlatformKeyboardEvent;
 class PopupContainer;
 class PopupMenuClient;
@@ -101,6 +99,7 @@
 class UserMediaClientImpl;
 class ValidationMessageClientImpl;
 class WebAccessibilityObject;
+class WebActiveGestureAnimation;
 class WebCompositorImpl;
 class WebDevToolsAgentClient;
 class WebDevToolsAgentPrivate;
@@ -119,13 +118,13 @@
 class WebViewBenchmarkSupport;
 
 class WebViewImpl : public WebView
-                  , public WebLayerTreeViewClient
-                  , public RefCounted<WebViewImpl>
-                  , public WebCore::PlatformGestureCurveTarget
+    , public WebLayerTreeViewClient
+    , public RefCounted<WebViewImpl>
+    , public WebGestureCurveTarget
 #if ENABLE(PAGE_POPUP)
-                  , public WebCore::PagePopupDriver
+    , public WebCore::PagePopupDriver
 #endif
-                  , public PageWidgetEventHandler {
+    , public PageWidgetEventHandler {
 public:
     enum AutoZoomType {
         DoubleTap,
@@ -405,8 +404,8 @@
     void numberOfWheelEventHandlersChanged(unsigned);
     void hasTouchEventHandlers(bool);
 
-    // PlatformGestureCurveTarget implementation for wheel fling.
-    virtual void scrollBy(const WebCore::IntPoint&);
+    // WebGestureCurveTarget implementation for fling.
+    virtual void scrollBy(const WebPoint&);
 
     // Handles context menu events orignated via the the keyboard. These
     // include the VK_APPS virtual key and the Shift+F10 combine. Code is
@@ -873,7 +872,7 @@
 #if ENABLE(NAVIGATOR_CONTENT_UTILS)
     OwnPtr<NavigatorContentUtilsClientImpl> m_navigatorContentUtilsClient;
 #endif
-    OwnPtr<WebCore::ActivePlatformGestureAnimation> m_gestureAnimation;
+    OwnPtr<WebActiveGestureAnimation> m_gestureAnimation;
     WebPoint m_lastWheelPosition;
     WebPoint m_lastWheelGlobalPosition;
     int m_flingModifier;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to