WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-81479-20120318184501.patch (text/plain), 51.39 KB, created by
James Robinson
on 2012-03-18 18:45:02 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
James Robinson
Created:
2012-03-18 18:45:02 PDT
Size:
51.39 KB
patch
obsolete
>Subversion Revision: 111136 >diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog >index 8eb711aaf61373438dd5e8e08d56f6b6955ac822..fd06f56fa736d4bb39b2e0bdd6d0a1d489475d57 100644 >--- a/Source/Platform/ChangeLog >+++ b/Source/Platform/ChangeLog >@@ -1,3 +1,14 @@ >+2012-03-18 James Robinson <jamesr@chromium.org> >+ >+ [chromium] Transfer wheel flings to main thread if we hit a region that can't be scrolled from the compositor thread >+ https://bugs.webkit.org/show_bug.cgi?id=81479 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * chromium/public/WebLayerTreeViewClient.h: >+ (WebLayerTreeViewClient): >+ (WebKit::WebLayerTreeViewClient::transferWheelFlingAnimation): >+ > 2012-03-08 James Robinson <jamesr@chromium.org> > > Use an explicit attribute to signal that a context prefers to use a discrete GPU >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 8cb3582270dc56cb2146de4f59f5e923f97e44c9..f81d268bbff339dff6f7c4a6dc7696eef5b95279 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,5 +1,66 @@ > 2012-03-18 James Robinson <jamesr@chromium.org> > >+ [chromium] Transfer wheel flings to main thread if we hit a region that can't be scrolled from the compositor thread >+ https://bugs.webkit.org/show_bug.cgi?id=81479 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests. (OOPS!) >+ >+ * platform/ActivePlatformGestureAnimation.cpp: >+ (WebCore::ActivePlatformGestureAnimation::create): >+ (WebCore): >+ (WebCore::ActivePlatformGestureAnimation::ActivePlatformGestureAnimation): >+ * platform/ActivePlatformGestureAnimation.h: >+ (ActivePlatformGestureAnimation): >+ * platform/CrossThreadCopier.h: >+ (WebCore): >+ * platform/PlatformGestureCurve.h: >+ (WebCore): >+ (PlatformGestureCurve): >+ * platform/TouchFlingPlatformGestureCurve.cpp: >+ (WebCore::TouchFlingPlatformGestureCurve::create): >+ (WebCore): >+ (WebCore::TouchFlingPlatformGestureCurve::TouchFlingPlatformGestureCurve): >+ * platform/TouchFlingPlatformGestureCurve.h: >+ (TouchFlingPlatformGestureCurve): >+ (WebCore::TouchFlingPlatformGestureCurve::cumulativeScroll): >+ * platform/WheelFlingPlatformGestureCurve.h: >+ (WebCore::WheelFlingPlatformGestureCurve::cumulativeScroll): >+ * platform/graphics/chromium/cc/CCActiveGestureAnimation.cpp: >+ (WebCore::CCActiveGestureAnimation::cumulativeScroll): >+ (WebCore): >+ * platform/graphics/chromium/cc/CCActiveGestureAnimation.h: >+ (WebCore): >+ (CCActiveGestureAnimation): >+ (WebCore::CCActiveGestureAnimation::startTime): >+ * platform/graphics/chromium/cc/CCGestureCurve.h: >+ (CCGestureCurve): >+ * platform/graphics/chromium/cc/CCInputHandler.h: >+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: >+ (WebCore::CCLayerTreeHost::transferWheelFlingAnimation): >+ (WebCore): >+ * platform/graphics/chromium/cc/CCLayerTreeHost.h: >+ (CCLayerTreeHostClient): >+ (CCLayerTreeHost): >+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: >+ (WebCore): >+ (WebCore::CCLayerTreeHostImpl::transferWheelFlingAnimation): >+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: >+ (CCLayerTreeHostImplClient): >+ (CCLayerTreeHostImpl): >+ * platform/graphics/chromium/cc/CCSingleThreadProxy.h: >+ (WebCore::CCSingleThreadProxy::transferWheelFlingAnimationToMainThreadOnImplThread): >+ * platform/graphics/chromium/cc/CCThreadProxy.cpp: >+ (WebCore::CCThreadProxy::transferWheelFlingAnimationToMainThreadOnImplThread): >+ (WebCore): >+ (WebCore::CCThreadProxy::transferWheelFlingAnimation): >+ (WebCore::CCThreadProxy::scheduledActionBeginFrame): >+ * platform/graphics/chromium/cc/CCThreadProxy.h: >+ (CCThreadProxy): >+ >+2012-03-18 James Robinson <jamesr@chromium.org> >+ > [chromium] Implement fling-by-wheel on compositor thread > https://bugs.webkit.org/show_bug.cgi?id=81462 > >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index c4170ee553e293760001c625273a1918d2c34894..2af4a3e8df46fbda4baf0553c3480216782b1399 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,5 +1,44 @@ > 2012-03-18 James Robinson <jamesr@chromium.org> > >+ [chromium] Transfer wheel flings to main thread if we hit a region that can't be scrolled from the compositor thread >+ https://bugs.webkit.org/show_bug.cgi?id=81479 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * src/WebCompositorInputHandlerImpl.cpp: >+ (WebCore::PlatformGestureToCCGestureAdapter::cumulativeScroll): >+ (PlatformGestureToCCGestureAdapter): >+ (WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal): >+ (WebKit::WebCompositorInputHandlerImpl::handleGestureFling): >+ (WebKit::WebCompositorInputHandlerImpl::scrollBy): >+ * src/WebCompositorInputHandlerImpl.h: >+ * src/WebLayerTreeViewImpl.cpp: >+ (WebKit::WebLayerTreeViewImpl::transferWheelFlingAnimation): >+ (WebKit): >+ * src/WebLayerTreeViewImpl.h: >+ (WebLayerTreeViewImpl): >+ * src/WebViewImpl.cpp: >+ (WebKit::WebViewImpl::WebViewImpl): >+ (WebKit::WebViewImpl::scrollBy): >+ (WebKit): >+ (WebKit::WebViewImpl::gestureEvent): >+ (WebKit::WebViewImpl::transferWheelFlingAnimation): >+ (WebKit::WebViewImpl::updateAnimations): >+ (WebKit::WebViewImpl::didCommitLoad): >+ * src/WebViewImpl.h: >+ (WebCore): >+ (WebViewImpl): >+ * tests/CCLayerTreeHostImplTest.cpp: >+ (WebKit::CCLayerTreeHostImplTest::transferWheelFlingAnimationToMainThreadOnImplThread): >+ * tests/CCLayerTreeHostTest.cpp: >+ (WTF::MockLayerTreeHostClient::transferWheelFlingAnimation): >+ (MockLayerTreeHostClient): >+ * tests/FakeCCLayerTreeHostClient.h: >+ (WebCore::FakeCCLayerTreeHostClient::transferWheelFlingAnimation): >+ * tests/WebCompositorInputHandlerImplTest.cpp: >+ >+2012-03-18 James Robinson <jamesr@chromium.org> >+ > [chromium] Implement fling-by-wheel on compositor thread > https://bugs.webkit.org/show_bug.cgi?id=81462 > >diff --git a/Source/Platform/chromium/public/WebLayerTreeViewClient.h b/Source/Platform/chromium/public/WebLayerTreeViewClient.h >index 5c0b9ef9a2a2c613b11900c13f898f22839b465b..22926ec85edf66602d7b9398d45692ee011558d4 100644 >--- a/Source/Platform/chromium/public/WebLayerTreeViewClient.h >+++ b/Source/Platform/chromium/public/WebLayerTreeViewClient.h >@@ -55,6 +55,11 @@ public: > virtual void didCommitAndDrawFrame() = 0; > virtual void didCompleteSwapBuffers() = 0; > >+ // Transfers an in-progress wheel fling animation that the WebLayerTreeView >+ // can no longer advance to the client to finish out. >+ // FIXME: Remove default impl when clients are all updated >+ virtual void transferWheelFlingAnimation(const WebFloatPoint& flingDelta, const WebPoint& flingPoint, const WebPoint& globalFlingPoint, double startTime, const WebPoint& cumulativeScroll) { } >+ > // Schedules a compositing pass, meaning the client should call > // WebLayerTreeView::composite at a later time. This is only called if the > // compositor thread is disabled; when enabled, the compositor will >diff --git a/Source/WebCore/platform/ActivePlatformGestureAnimation.cpp b/Source/WebCore/platform/ActivePlatformGestureAnimation.cpp >index 18ec7eb34ae2e4e07b56c14a3e02a3378bad9d50..5a100d67c6eef1fd10e4589ddf9254bccb296073 100644 >--- a/Source/WebCore/platform/ActivePlatformGestureAnimation.cpp >+++ b/Source/WebCore/platform/ActivePlatformGestureAnimation.cpp >@@ -37,6 +37,11 @@ PassOwnPtr<ActivePlatformGestureAnimation> ActivePlatformGestureAnimation::creat > return adoptPtr(new ActivePlatformGestureAnimation(curve, target)); > } > >+PassOwnPtr<ActivePlatformGestureAnimation> ActivePlatformGestureAnimation::create(PassOwnPtr<PlatformGestureCurve> curve, PlatformGestureCurveTarget* target, double startTime) >+{ >+ return adoptPtr(new ActivePlatformGestureAnimation(curve, target, startTime)); >+} >+ > ActivePlatformGestureAnimation::~ActivePlatformGestureAnimation() > { > } >@@ -49,6 +54,15 @@ ActivePlatformGestureAnimation::ActivePlatformGestureAnimation(PassOwnPtr<Platfo > { > } > >+ActivePlatformGestureAnimation::ActivePlatformGestureAnimation(PassOwnPtr<PlatformGestureCurve> curve, PlatformGestureCurveTarget* target, double startTime) >+ : m_startTime(startTime) >+ , m_waitingForFirstTick(false) >+ , m_curve(curve) >+ , m_target(target) >+{ >+} >+ >+ > bool ActivePlatformGestureAnimation::animate(double time) > { > if (m_waitingForFirstTick) { >diff --git a/Source/WebCore/platform/ActivePlatformGestureAnimation.h b/Source/WebCore/platform/ActivePlatformGestureAnimation.h >index 9d563e483666dd2ada1b5b05e8984df15bac7024..21f199c07a1fcf34c58c1249f2b84e4c5711bca4 100644 >--- a/Source/WebCore/platform/ActivePlatformGestureAnimation.h >+++ b/Source/WebCore/platform/ActivePlatformGestureAnimation.h >@@ -43,6 +43,7 @@ class ActivePlatformGestureAnimation { > WTF_MAKE_NONCOPYABLE(ActivePlatformGestureAnimation); > public: > static PassOwnPtr<ActivePlatformGestureAnimation> create(PassOwnPtr<PlatformGestureCurve>, PlatformGestureCurveTarget*); >+ static PassOwnPtr<ActivePlatformGestureAnimation> create(PassOwnPtr<PlatformGestureCurve>, PlatformGestureCurveTarget*, double startTime); > ~ActivePlatformGestureAnimation(); > > bool animate(double time); >@@ -50,6 +51,7 @@ public: > private: > // Assumes a valid PlatformGestureCurveTarget that outlives the animation. > ActivePlatformGestureAnimation(PassOwnPtr<PlatformGestureCurve>, PlatformGestureCurveTarget*); >+ ActivePlatformGestureAnimation(PassOwnPtr<PlatformGestureCurve>, PlatformGestureCurveTarget*, double startTime); > > double m_startTime; > bool m_waitingForFirstTick; >diff --git a/Source/WebCore/platform/CrossThreadCopier.h b/Source/WebCore/platform/CrossThreadCopier.h >index 3b6076142cdaac214ad00936fcfb3c504a3fd170..e472eefcb92d5fdfad95084a512d85946d7d6a68 100644 >--- a/Source/WebCore/platform/CrossThreadCopier.h >+++ b/Source/WebCore/platform/CrossThreadCopier.h >@@ -41,6 +41,8 @@ > > namespace WebCore { > >+ class FloatSize; >+ class IntPoint; > class IntRect; > class IntSize; > class KURL; >@@ -70,6 +72,12 @@ namespace WebCore { > template<> struct CrossThreadCopierBase<false, false, ThreadableLoaderOptions> : public CrossThreadCopierPassThrough<ThreadableLoaderOptions> { > }; > >+ template<> struct CrossThreadCopierBase<false, false, FloatSize> : public CrossThreadCopierPassThrough<FloatSize> { >+ }; >+ >+ template<> struct CrossThreadCopierBase<false, false, IntPoint> : public CrossThreadCopierPassThrough<IntPoint> { >+ }; >+ > template<> struct CrossThreadCopierBase<false, false, IntRect> : public CrossThreadCopierPassThrough<IntRect> { > }; > >diff --git a/Source/WebCore/platform/PlatformGestureCurve.h b/Source/WebCore/platform/PlatformGestureCurve.h >index 9221991478ea9c1893f96b3ff0eed7ef64c77c42..b4379e06ddf383da534fb330524ca456d9977d48 100644 >--- a/Source/WebCore/platform/PlatformGestureCurve.h >+++ b/Source/WebCore/platform/PlatformGestureCurve.h >@@ -27,6 +27,7 @@ > > namespace WebCore { > >+class IntPoint; > class PlatformGestureCurveTarget; > > // Abstract interface for curves used by ActivePlatformGestureAnimation. A >@@ -39,6 +40,8 @@ public: > > // Returns false if curve has finished and can no longer be applied. > virtual bool apply(double time, PlatformGestureCurveTarget*) = 0; >+ >+ virtual IntPoint cumulativeScroll() const = 0; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/TouchFlingPlatformGestureCurve.cpp b/Source/WebCore/platform/TouchFlingPlatformGestureCurve.cpp >index 06ed54ac3ac096bc40e165ee2547cda5d934605c..536575f869fff3987e302631110c91fc017b5bb1 100644 >--- a/Source/WebCore/platform/TouchFlingPlatformGestureCurve.cpp >+++ b/Source/WebCore/platform/TouchFlingPlatformGestureCurve.cpp >@@ -35,12 +35,18 @@ using namespace std; > > PassOwnPtr<PlatformGestureCurve> TouchFlingPlatformGestureCurve::create(const FloatPoint& velocity) > { >- return adoptPtr(new TouchFlingPlatformGestureCurve(velocity)); >+ return adoptPtr(new TouchFlingPlatformGestureCurve(velocity, IntPoint::zero())); > } > >-TouchFlingPlatformGestureCurve::TouchFlingPlatformGestureCurve(const FloatPoint& velocity) >+PassOwnPtr<PlatformGestureCurve> TouchFlingPlatformGestureCurve::create(const FloatPoint& velocity, const IntPoint& cumulativeScroll) >+{ >+ return adoptPtr(new TouchFlingPlatformGestureCurve(velocity, cumulativeScroll)); >+} >+ >+TouchFlingPlatformGestureCurve::TouchFlingPlatformGestureCurve(const FloatPoint& velocity, const IntPoint& cumulativeScroll) > : m_velocity(velocity) > , m_timeScaleFactor(1000 / max(1.f, max(fabs(velocity.x()), fabs(velocity.y())))) >+ , m_cumulativeScroll(cumulativeScroll) > { > ASSERT(velocity != FloatPoint::zero()); > } >diff --git a/Source/WebCore/platform/TouchFlingPlatformGestureCurve.h b/Source/WebCore/platform/TouchFlingPlatformGestureCurve.h >index fd52bc4ec74c0b52b75845b4669f656f07d250ee..a6582ca0659b3d4168368feffd80f28353e76718 100644 >--- a/Source/WebCore/platform/TouchFlingPlatformGestureCurve.h >+++ b/Source/WebCore/platform/TouchFlingPlatformGestureCurve.h >@@ -41,12 +41,14 @@ class PlatformGestureCurveTarget; > class TouchFlingPlatformGestureCurve : public PlatformGestureCurve { > public: > static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity); >+ static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity, const IntPoint& cumulativeScroll); > virtual ~TouchFlingPlatformGestureCurve(); > > virtual bool apply(double time, PlatformGestureCurveTarget*); >+ virtual IntPoint cumulativeScroll() const { return m_cumulativeScroll; } > > private: >- explicit TouchFlingPlatformGestureCurve(const FloatPoint& velocity); >+ TouchFlingPlatformGestureCurve(const FloatPoint& velocity, const IntPoint& cumulativeScroll); > > FloatPoint m_velocity; > float m_timeScaleFactor; >diff --git a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h >index b72146165333f23c8c9bbf6c01ddbf067aee1ac2..02a6a1ac94b16294cdb8258d27b1f2430e5e9a9a 100644 >--- a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h >+++ b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h >@@ -44,6 +44,7 @@ public: > virtual ~WheelFlingPlatformGestureCurve(); > > virtual bool apply(double time, PlatformGestureCurveTarget*); >+ virtual IntPoint cumulativeScroll() const { return m_cumulativeScroll; } > > private: > WheelFlingPlatformGestureCurve(const FloatPoint& velocity); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCActiveGestureAnimation.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCActiveGestureAnimation.cpp >index a4af3e59bc5577a886f029be592fc499ad43ba01..68bcf3619049b170192f7646b5e45341465e75a3 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCActiveGestureAnimation.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCActiveGestureAnimation.cpp >@@ -26,6 +26,7 @@ > > #include "cc/CCActiveGestureAnimation.h" > >+#include "IntPoint.h" > #include "cc/CCGestureCurve.h" > > namespace WebCore { >@@ -47,6 +48,11 @@ CCActiveGestureAnimation::~CCActiveGestureAnimation() > { > } > >+IntPoint CCActiveGestureAnimation::cumulativeScroll() const >+{ >+ return m_gestureCurve->cumulativeScroll(); >+} >+ > bool CCActiveGestureAnimation::animate(double time) > { > if (m_waitingForFirstTick) { >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCActiveGestureAnimation.h b/Source/WebCore/platform/graphics/chromium/cc/CCActiveGestureAnimation.h >index 9bcd753704c3594e23bed36b6b654940a854d70d..458dc5bab91dd454ea172c2e96e4f6c030ba8c78 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCActiveGestureAnimation.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCActiveGestureAnimation.h >@@ -33,17 +33,23 @@ namespace WebCore { > > class CCGestureCurve; > class CCGestureCurveTarget; >+class IntPoint; > > class CCActiveGestureAnimation { > WTF_MAKE_NONCOPYABLE(CCActiveGestureAnimation); > public: > static PassOwnPtr<CCActiveGestureAnimation> create(PassOwnPtr<CCGestureCurve>, CCGestureCurveTarget*); >+ > ~CCActiveGestureAnimation(); > > bool animate(double time); > >+ double startTime() const { return m_startTime; } >+ IntPoint cumulativeScroll() const; >+ > private: > CCActiveGestureAnimation(PassOwnPtr<CCGestureCurve>, CCGestureCurveTarget*); >+ CCActiveGestureAnimation(PassOwnPtr<CCGestureCurve>, CCGestureCurveTarget*, double startTime); > > double m_startTime; > double m_waitingForFirstTick; >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCGestureCurve.h b/Source/WebCore/platform/graphics/chromium/cc/CCGestureCurve.h >index 4bc1c0dd806df765e3f2472d2b663645d289c6a5..d7d025ea1a9507510e643208b3b70f6fc0b2940a 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCGestureCurve.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCGestureCurve.h >@@ -42,6 +42,8 @@ public: > virtual ~CCGestureCurve() { } > > virtual bool apply(double time, CCGestureCurveTarget*) = 0; >+ >+ virtual IntPoint cumulativeScroll() const = 0; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCInputHandler.h b/Source/WebCore/platform/graphics/chromium/cc/CCInputHandler.h >index 019d2d835b1c24b3f591e898bd737018f01b8379..1cc91f3a19afc663cebc0ed4a552d1db8adb2028 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCInputHandler.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCInputHandler.h >@@ -81,6 +81,8 @@ public: > // Request a new frame with updated animation state. Typically called by CCInputHandler::animate(). > virtual void scheduleAnimation() = 0; > >+ virtual void transferWheelFlingAnimation(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll) = 0; >+ > protected: > CCInputHandlerClient() { } > virtual ~CCInputHandlerClient() { } >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >index 017820a7c70e1b93fc62a4df47664528697035a1..26b37ae31718493ff8e9f6c99ef205f4e3c18e12 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >@@ -414,6 +414,13 @@ void CCLayerTreeHost::composite() > static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately(); > } > >+void CCLayerTreeHost::transferWheelFlingAnimation(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll) >+{ >+ // We tick animations in CCLayerTreeHost using currentTime(), but the impl thread uses monotonicallyIncreasingTime(). Rebase here before passing times out to the client. >+ double rebasedStartTime = currentTime() - monotonicallyIncreasingTime() + startTime; >+ m_client->transferWheelFlingAnimation(flingDelta, flingPoint, globalFlingPoint, rebasedStartTime, cumulativeScroll); >+} >+ > bool CCLayerTreeHost::updateLayers() > { > if (!m_layerRendererInitialized) { >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >index 89f1be307edfc916d609e085a35522677623ec87..2e60265859fe847b3da82cbe8a079255bab3cc79 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >@@ -59,6 +59,7 @@ public: > virtual void didRecreateContext(bool success) = 0; > virtual void didCommitAndDrawFrame() = 0; > virtual void didCompleteSwapBuffers() = 0; >+ virtual void transferWheelFlingAnimation(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll) = 0; > > // Used only in the single-threaded path. > virtual void scheduleComposite() = 0; >@@ -143,6 +144,7 @@ public: > void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } > void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } > void deleteContentsTexturesOnImplThread(TextureAllocator*); >+ void transferWheelFlingAnimation(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll); > // Returns false if we should abort this frame due to initialization failure. > bool updateLayers(); > >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >index dd2d42a4717aaa0efa5bacc8a3c29f26b024db88..72dbefed8e1a63fe4c4d01c346c819dc0cc40d99 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >@@ -186,6 +186,13 @@ void CCLayerTreeHostImpl::scheduleAnimation() > m_client->setNeedsRedrawOnImplThread(); > } > >+ >+void CCLayerTreeHostImpl::transferWheelFlingAnimation(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll) >+{ >+ >+ m_client->transferWheelFlingAnimationToMainThreadOnImplThread(flingDelta, flingPoint, globalFlingPoint, startTime, cumulativeScroll); >+} >+ > void CCLayerTreeHostImpl::trackDamageForAllSurfaces(CCLayerImpl* rootDrawLayer, const CCLayerList& renderSurfaceLayerList) > { > // For now, we use damage tracking to compute a global scissor. To do this, we must >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h >index 0dae60468242e9b142667d707ca1e5b9402dbe21..8ce2f4056686cc121ec2edbba6e03a92cb1be4f8 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h >@@ -55,6 +55,7 @@ public: > virtual void setNeedsRedrawOnImplThread() = 0; > virtual void setNeedsCommitOnImplThread() = 0; > virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) = 0; >+ virtual void transferWheelFlingAnimationToMainThreadOnImplThread(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll) = 0; > }; > > // CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state >@@ -76,6 +77,7 @@ public: > // To clear an active animation, pass nullptr. > virtual void setActiveGestureAnimation(PassOwnPtr<CCActiveGestureAnimation>); > virtual void scheduleAnimation(); >+ virtual void transferWheelFlingAnimation(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll); > > // Virtual for testing. > virtual void beginCommit(); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h >index ebbd96e2c38822189d2b90b21e6d976a367c0e9c..7e683b7a67eac4df76e403b5577e6d37c8d84d79 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h >@@ -67,6 +67,7 @@ public: > virtual void setNeedsRedrawOnImplThread() { m_layerTreeHost->setNeedsCommit(); } > virtual void setNeedsCommitOnImplThread() { m_layerTreeHost->setNeedsCommit(); } > virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime); >+ virtual void transferWheelFlingAnimationToMainThreadOnImplThread(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll) { ASSERT_NOT_REACHED(); } > > // Called by the legacy path where RenderWidget does the scheduling. > void compositeImmediately(); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp >index e1675223c548077bf40cbbab3dfebd9f6b2b8285..28fde771cf781a20d4ab5d9ee82d20aaaeb31fb1 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp >@@ -296,6 +296,19 @@ void CCThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAni > m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::setAnimationEvents, events, wallClockTime)); > } > >+void CCThreadProxy::transferWheelFlingAnimationToMainThreadOnImplThread(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll) >+{ >+ ASSERT(isImplThread()); >+ TRACE_EVENT0("cc", "CCThreadProxy::transferWheelFlingAnimationToMainThreadOnImplThread"); >+ m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::transferWheelFlingAnimation, flingDelta, flingPoint, globalFlingPoint, startTime, cumulativeScroll)); >+} >+ >+void CCThreadProxy::transferWheelFlingAnimation(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll) >+{ >+ ASSERT(isMainThread()); >+ m_layerTreeHost->transferWheelFlingAnimation(flingDelta, flingPoint, globalFlingPoint, startTime, cumulativeScroll); >+} >+ > void CCThreadProxy::setNeedsRedraw() > { > ASSERT(isMainThread()); >@@ -394,7 +407,7 @@ void CCThreadProxy::scheduledActionBeginFrame() > TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionBeginFrame"); > ASSERT(!m_pendingBeginFrameRequest); > m_pendingBeginFrameRequest = adoptPtr(new BeginFrameAndCommitState()); >- m_pendingBeginFrameRequest->frameBeginTime = 0; >+ m_pendingBeginFrameRequest->frameBeginTime = currentTime(); > m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollDeltas(); > > m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame)); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h >index 9e524a763e2850fd209c13e352612ec5ca3049e1..4e4890f6f2631e7842a39ec27ab85ef48e462444 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h >@@ -76,6 +76,7 @@ public: > virtual void setNeedsRedrawOnImplThread(); > virtual void setNeedsCommitOnImplThread(); > virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime); >+ virtual void transferWheelFlingAnimationToMainThreadOnImplThread(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll); > > // CCSchedulerClient implementation > virtual bool canDraw(); >@@ -105,6 +106,7 @@ private: > void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime); > void beginContextRecreation(); > void tryToRecreateContext(); >+ void transferWheelFlingAnimation(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll); > > // Called on impl thread > struct ReadbackRequest { >diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp >index 50af51fd55d0379513077d3d41ed4b1df0e8798a..8c2f4eda752281244d47f3293b816368600d7c84 100644 >--- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp >+++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp >@@ -68,6 +68,11 @@ public: > m_target->scrollBy(scrollDelta); > } > >+ virtual IntPoint cumulativeScroll() const >+ { >+ return m_curve->cumulativeScroll(); >+ } >+ > private: > PlatformGestureToCCGestureAdapter(PassOwnPtr<PlatformGestureCurve> curve) > : m_curve(curve) >@@ -181,9 +186,9 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h > m_inputHandlerClient->scrollEnd(); > return DidHandle; > case CCInputHandlerClient::ScrollIgnored: >- return DidNotHandle; >- case CCInputHandlerClient::ScrollFailed: > return DropEvent; >+ case CCInputHandlerClient::ScrollFailed: >+ return DidNotHandle; > } > } else if (event.type == WebInputEvent::GestureScrollBegin) { > ASSERT(!m_gestureScrollStarted); >@@ -258,9 +263,11 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h > switch (scrollStatus) { > case CCInputHandlerClient::ScrollStarted: { > TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started"); >- OwnPtr<PlatformGestureCurve> flingCurve = TouchFlingPlatformGestureCurve::create(FloatPoint(-gestureEvent.deltaX, -gestureEvent.deltaY)); >+ OwnPtr<PlatformGestureCurve> flingCurve = TouchFlingPlatformGestureCurve::create(FloatPoint(gestureEvent.deltaX, gestureEvent.deltaY)); > m_wheelFlingAnimation = CCActiveGestureAnimation::create(PlatformGestureToCCGestureAdapter::create(flingCurve.release()), this); >+ m_wheelFlingDelta = FloatSize(gestureEvent.deltaX, gestureEvent.deltaY); > m_wheelFlingPoint = IntPoint(gestureEvent.x, gestureEvent.y); >+ m_wheelFlingGlobalPoint = IntPoint(gestureEvent.globalX, gestureEvent.globalY); > m_inputHandlerClient->scheduleAnimation(); > return DidHandle; > } >@@ -310,8 +317,8 @@ void WebCompositorInputHandlerImpl::scrollBy(const IntPoint& increment) > > WebMouseWheelEvent event; > event.type = WebInputEvent::MouseWheel; >- event.deltaX = -increment.x(); >- event.deltaY = -increment.y(); >+ event.deltaX = increment.x(); >+ event.deltaY = increment.y(); > event.hasPreciseScrollingDeltas = true; > event.x = m_wheelFlingPoint.x(); > event.y = m_wheelFlingPoint.y(); >@@ -319,18 +326,20 @@ void WebCompositorInputHandlerImpl::scrollBy(const IntPoint& increment) > WebCompositorInputHandlerImpl::EventDisposition disposition = handleInputEventInternal(event); > switch (disposition) { > case DidHandle: >+ break; > case DropEvent: > break; > case DidNotHandle: > TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::scrollBy::AbortFling"); >- // FIXME: If we got a DidNotHandle, that means we need to deliver wheels on the main thread. >+ // If we got a DidNotHandle, that means we need to deliver wheels on the main thread. > // In this case we need to schedule a commit and transfer the fling curve over to the main > // thread and run the rest of the wheels from there. > // This can happen when flinging a page that contains a scrollable subarea that we can't > // scroll on the thread if the fling starts outside the subarea but then is flung "under" the > // pointer. >- // For now, just abort the fling. >+ m_inputHandlerClient->transferWheelFlingAnimation(m_wheelFlingDelta, m_wheelFlingPoint, m_wheelFlingGlobalPoint, m_wheelFlingAnimation->startTime(), m_wheelFlingAnimation->cumulativeScroll()); > cancelCurrentFling(); >+ break; > } > } > >diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h >index 7a0b36d57c5a6180286569be827c64e7f11b67a8..aa942f6697d624cf0d41dead6057fa6864bb79f1 100644 >--- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h >+++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h >@@ -26,6 +26,7 @@ > #ifndef WebCompositorInputHandlerImpl_h > #define WebCompositorInputHandlerImpl_h > >+#include "FloatPoint.h" > #include "IntPoint.h" > #include "WebCompositor.h" > #include "WebCompositorInputHandler.h" >@@ -82,7 +83,10 @@ private: > bool cancelCurrentFling(); > > OwnPtr<WebCore::CCActiveGestureAnimation> m_wheelFlingAnimation; >- WebCore::IntPoint m_wheelFlingPoint; // Pointer position for the current fling. >+ // Parameters for the active fling animation, stored in case we need to transfer it out later. >+ WebCore::FloatSize m_wheelFlingDelta; >+ WebCore::IntPoint m_wheelFlingPoint; >+ WebCore::IntPoint m_wheelFlingGlobalPoint; > > WebCompositorInputHandlerClient* m_client; > int m_identifier; >diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp >index 335879b660534a4bc757e51774f32ffdc67e7fec..a3e75139946a6332b0611c424c6a1fbac25e541e 100644 >--- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp >+++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp >@@ -36,6 +36,8 @@ > #include "platform/WebLayerTreeViewClient.h" > #include "platform/WebSize.h" > #include "platform/WebThread.h" >+#include <public/WebFloatPoint.h> >+#include <public/WebPoint.h> > > using namespace WebCore; > >@@ -107,6 +109,12 @@ void WebLayerTreeViewImpl::didCompleteSwapBuffers() > m_client->didCompleteSwapBuffers(); > } > >+void WebLayerTreeViewImpl::transferWheelFlingAnimation(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll) >+{ >+ if (m_client) >+ m_client->transferWheelFlingAnimation(WebFloatPoint(flingDelta.width(), flingDelta.height()), flingPoint, globalFlingPoint, startTime, cumulativeScroll); >+} >+ > void WebLayerTreeViewImpl::scheduleComposite() > { > if (m_client) >diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h >index b1b26d0fc338604fe5cf38071f50a8c3586452fb..1de021c62474e7e8bd027541934eba048169651f 100644 >--- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h >+++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h >@@ -48,6 +48,7 @@ private: > virtual void didRecreateContext(bool success); > virtual void didCommitAndDrawFrame(); > virtual void didCompleteSwapBuffers(); >+ virtual void transferWheelFlingAnimation(const WebCore::FloatSize& flingDelta, const WebCore::IntPoint& flingPoint, const WebCore::IntPoint& globalFlingPoint, double startTime, const WebCore::IntPoint& cumulativeScroll); > > // Only used in the single threaded path. > virtual void scheduleComposite(); >diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp >index 5b885403e2de8b863adb87b0ffe6adbf6dd8dab4..7474e42196b2f19d9290c15495a7992224000166 100644 >--- a/Source/WebKit/chromium/src/WebViewImpl.cpp >+++ b/Source/WebKit/chromium/src/WebViewImpl.cpp >@@ -31,10 +31,10 @@ > #include "config.h" > #include "WebViewImpl.h" > >-#include "AutofillPopupMenuClient.h" > #include "AXObjectCache.h" >+#include "ActivePlatformGestureAnimation.h" >+#include "AutofillPopupMenuClient.h" > #include "BackForwardListChromium.h" >-#include "cc/CCProxy.h" > #include "CSSStyleSelector.h" > #include "CSSValueKeywords.h" > #include "Chrome.h" >@@ -109,6 +109,7 @@ > #include "SpeechRecognitionClient.h" > #include "TextIterator.h" > #include "Timer.h" >+#include "TouchFlingPlatformGestureCurve.h" > #include "TraceEvent.h" > #include "TypingCommand.h" > #include "UserGestureIndicator.h" >@@ -118,31 +119,34 @@ > #include "WebCompositorImpl.h" > #include "WebDevToolsAgentImpl.h" > #include "WebDevToolsAgentPrivate.h" >-#include "platform/WebDragData.h" > #include "WebFrameImpl.h" >-#include "platform/WebGraphicsContext3D.h" >-#include "platform/WebImage.h" > #include "WebInputElement.h" > #include "WebInputEvent.h" > #include "WebInputEventConversion.h" > #include "WebKit.h" >-#include "platform/WebKitPlatformSupport.h" >-#include "platform/WebLayer.h" >-#include "platform/WebLayerTreeView.h" > #include "WebMediaPlayerAction.h" > #include "WebNode.h" > #include "WebPlugin.h" > #include "WebPluginAction.h" > #include "WebPluginContainerImpl.h" >-#include "platform/WebPoint.h" > #include "WebPopupMenuImpl.h" > #include "WebRange.h" >-#include "platform/WebRect.h" > #include "WebRuntimeFeatures.h" > #include "WebSettingsImpl.h" >+#include "WebViewClient.h" >+#include "WheelEvent.h" >+#include "cc/CCProxy.h" >+#include "platform/WebDragData.h" >+#include "platform/WebGraphicsContext3D.h" >+#include "platform/WebImage.h" >+#include "platform/WebKitPlatformSupport.h" >+#include "platform/WebLayer.h" >+#include "platform/WebLayerTreeView.h" >+#include "platform/WebRect.h" > #include "platform/WebString.h" > #include "platform/WebVector.h" >-#include "WebViewClient.h" >+#include <public/WebFloatPoint.h> >+#include <public/WebPoint.h> > #include <wtf/ByteArray.h> > #include <wtf/CurrentTime.h> > #include <wtf/MainThread.h> >@@ -408,6 +412,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client) > #endif > > m_inspectorSettingsMap = adoptPtr(new SettingsMap); >+ >+ m_lastWheelPosition = WebPoint(-1, -1); >+ m_lastWheelGlobalPosition = WebPoint(-1, -1); > } > > WebViewImpl::~WebViewImpl() >@@ -603,11 +610,71 @@ bool WebViewImpl::mouseWheel(const WebMouseWheelEvent& event) > return mainFrameImpl()->frame()->eventHandler()->handleWheelEvent(platformEvent); > } > >+void WebViewImpl::scrollBy(const WebCore::IntPoint& delta) >+{ >+ WebMouseWheelEvent syntheticWheel; >+ const float tickDivisor = (float)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; >+ >+ 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: { >+ // FIXME: remove this in a subsequent patch revision. >+ TRACE_EVENT_INSTANT2("webkit", "WebViewImpl::gestureEvent::GestureFlingStart", "deltaX", event.deltaX, "deltaY", event.deltaY); >+ m_lastWheelPosition = WebPoint(event.x, event.y); >+ m_lastWheelGlobalPosition = WebPoint(event.globalX, event.globalY); >+ ASSERT(!m_gestureAnimation); >+ // FIXME: Make the curve parametrizable from the browser. >+ m_gestureAnimation = ActivePlatformGestureAnimation::create(TouchFlingPlatformGestureCurve::create(FloatPoint(event.deltaX, event.deltaY)), this); >+ scheduleAnimation(); >+ return false; >+ } >+ case WebInputEvent::GestureFlingCancel: >+ // FIXME: put this into a sub-function? >+ TRACE_EVENT_INSTANT0("webkit", "WebViewImpl::gestureEvent::GestureFlingCancel"); >+ m_gestureAnimation.clear(); >+ return false; >+ 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::transferWheelFlingAnimation(const WebFloatPoint& flingDelta, const WebPoint& flingPoint, const WebPoint& globalFlingPoint, double startTime, const WebPoint& cumulativeScroll) >+{ >+ TRACE_EVENT_INSTANT0("webkit", "WebViewImpl::transferWheelFlingAnimation"); >+ ASSERT(!m_gestureAnimation); >+ m_lastWheelPosition = flingPoint; >+ m_lastWheelGlobalPosition = globalFlingPoint; >+ OwnPtr<PlatformGestureCurve> curve = TouchFlingPlatformGestureCurve::create(flingDelta, IntPoint(cumulativeScroll)); >+ m_gestureAnimation = ActivePlatformGestureAnimation::create(curve.release(), this, startTime); >+ scheduleAnimation(); > } > > void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec) >@@ -1283,6 +1350,17 @@ void WebViewImpl::updateAnimations(double frameBeginTime) > #if ENABLE(REQUEST_ANIMATION_FRAME) > TRACE_EVENT("WebViewImpl::updateAnimations", this, 0); > >+ // Create synthetic wheel events as necessary for fling. >+ if (m_gestureAnimation) { >+ if (m_gestureAnimation->animate(frameBeginTime)) { >+ TRACE_EVENT_INSTANT0("webkit", "WebViewImpl::animate::fling continue"); >+ scheduleAnimation(); >+ } else { >+ TRACE_EVENT_INSTANT0("webkit", "WebViewImpl::animate::fling over"); >+ m_gestureAnimation.clear(); >+ } >+ } >+ > WebFrameImpl* webframe = mainFrameImpl(); > if (!webframe) > return; >@@ -2838,6 +2916,8 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa > m_observedNewNavigation = false; > if (!isNavigationWithinPage) > m_pageScaleFactorIsSet = false; >+ >+ m_gestureAnimation.clear(); > } > > void WebViewImpl::layoutUpdated(WebFrameImpl* webframe) >diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h >index 9d93969f8cf1fa604a3e95137dfe20881c199347..cadc1fe2651603918a0c5a61031d4b7a914d6531 100644 >--- a/Source/WebKit/chromium/src/WebViewImpl.h >+++ b/Source/WebKit/chromium/src/WebViewImpl.h >@@ -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 HistoryItem; > class HitTestResult; > class KeyboardEvent; > class Page; >+class PlatformGestureCurveTarget; > class PlatformKeyboardEvent; > class PopupContainer; > class PopupMenuClient; >@@ -96,7 +99,7 @@ class WebMouseWheelEvent; > 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, >@@ -258,6 +261,7 @@ public: > virtual void didCommitAndDrawFrame(); > virtual void didCompleteSwapBuffers(); > virtual void scheduleComposite(); >+ virtual void transferWheelFlingAnimation(const WebFloatPoint& flingDelta, const WebPoint& flingPoint, const WebPoint& globalFlingPoint, double startTime, const WebPoint& cumulativeScroll); > > // WebViewImpl > >@@ -333,6 +337,9 @@ public: > 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 +725,9 @@ private: > #if ENABLE(MEDIA_STREAM) > UserMediaClientImpl m_userMediaClientImpl; > #endif >+ OwnPtr<WebCore::ActivePlatformGestureAnimation> m_gestureAnimation; >+ WebPoint m_lastWheelPosition; >+ WebPoint m_lastWheelGlobalPosition; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp >index a192ba557bf0ea16c21e4c04242cb25d090a1763..4974c1107f374460343b7213e9d0bcac6ebf625a 100644 >--- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp >+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp >@@ -54,6 +54,7 @@ public: > virtual void setNeedsRedrawOnImplThread() { m_didRequestRedraw = true; } > virtual void setNeedsCommitOnImplThread() { m_didRequestCommit = true; } > virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) { } >+ virtual void transferWheelFlingAnimationToMainThreadOnImplThread(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll) { } > > static void expectClearedScrollDeltasRecursive(CCLayerImpl* layer) > { >diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp >index 702bbf1639b43b16aef3abb6606290498c0d6615..09d76e90131b92ee1fbc67a79a556c78304ebc10 100644 >--- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp >+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp >@@ -256,6 +256,9 @@ public: > { > } > >+ virtual void transferWheelFlingAnimation(const FloatSize&, const IntPoint&, const IntPoint&, double, const IntPoint&) { } >+ >+ > private: > explicit MockLayerTreeHostClient(TestHooks* testHooks) : m_testHooks(testHooks) { } > >diff --git a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h >index 38876d737fb52aa6d03c71bffe41728c8cccf0b5..0695f74f857afe39a4f3e801a16f8054fa98f47a 100755 >--- a/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h >+++ b/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h >@@ -45,6 +45,7 @@ public: > virtual void didRecreateContext(bool success) { } > virtual void didCommitAndDrawFrame() { } > virtual void didCompleteSwapBuffers() { } >+ virtual void transferWheelFlingAnimation(const FloatSize& flingDelta, const IntPoint& flingPoint, const IntPoint& globalFlingPoint, double startTime, const IntPoint& cumulativeScroll) { } > > // Used only in the single-threaded path. > virtual void scheduleComposite() { } >diff --git a/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp b/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp >index a05708c3e8b5a4e4180442c1db7d3696427ccc4f..4a7f160457f0661e4f8c6015fa3b8c092b678655 100644 >--- a/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp >+++ b/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp >@@ -62,6 +62,8 @@ public: > MOCK_METHOD1(scrollBy, void(const WebCore::IntSize&)); > MOCK_METHOD0(scrollEnd, void()); > >+ MOCK_METHOD5(transferWheelFlingAnimation, void(const WebCore::FloatSize& flingDelta, const WebCore::IntPoint& flingPoint, const WebCore::IntPoint& globalFlingPoint, double startTime, const WebCore::IntPoint& cumulativeScroll)); >+ > private: > virtual void startPageScaleAnimation(const WebCore::IntSize& targetPosition, > bool anchorPoint, >@@ -308,21 +310,81 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimates) > EXPECT_CALL(m_mockInputHandler, scrollEnd()); > m_inputHandler->animate(10.1); > >+ // If we cancel the fling, the next animation should be a no-op and should not result in another >+ // frame being requested. >+ gesture.type = WebKit::WebInputEvent::GestureFlingCancel; >+ EXPECT_CALL(m_mockClient, didHandleInputEvent()); >+ m_inputHandler->handleInputEvent(gesture); >+ >+ EXPECT_CALL(m_mockInputHandler, scheduleAnimation()).Times(0); >+ EXPECT_CALL(m_mockInputHandler, scrollBegin(testing::_, testing::_)).Times(0); >+ m_inputHandler->animate(10.3); >+} >+ >+TEST_F(WebCompositorInputHandlerImplTest, gestureFlingTransfer) >+{ >+ // We should handle the entire sequence ourselves. >+ EXPECT_CALL(m_mockClient, didNotHandleInputEvent(::testing::_)).Times(0); >+ >+ // On the fling start, we should schedule an animation but not actually start >+ // scrolling. >+ gesture.type = WebKit::WebInputEvent::GestureFlingStart; >+ WebCore::FloatSize flingDelta = WebCore::FloatSize(1000, 0); >+ WebCore::IntPoint flingPoint = WebCore::IntPoint(7, 13); >+ WebCore::IntPoint flingGlobalPoint = WebCore::IntPoint(17, 23); >+ gesture.deltaX = flingDelta.width(); >+ gesture.deltaY = flingDelta.height(); >+ gesture.x = flingPoint.x(); >+ gesture.y = flingPoint.y(); >+ gesture.globalX = flingGlobalPoint.x(); >+ gesture.globalY = flingGlobalPoint.y(); >+ EXPECT_CALL(m_mockClient, didHandleInputEvent()); >+ EXPECT_CALL(m_mockInputHandler, scheduleAnimation()); >+ EXPECT_CALL(m_mockInputHandler, scrollBegin(testing::_, testing::_)) >+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); >+ m_inputHandler->handleInputEvent(gesture); >+ >+ // The first animate call should let us pick up an animation start time, but we >+ // shouldn't actually move anywhere just yet. The first frame after the fling start >+ // will typically include the last scroll from the gesture that lead to the scroll >+ // (either wheel or gesture scroll), so there should be no visible hitch. >+ EXPECT_CALL(m_mockInputHandler, scheduleAnimation()); >+ EXPECT_CALL(m_mockInputHandler, scrollBegin(testing::_, testing::_)).Times(0); >+ m_inputHandler->animate(10); >+ >+ // The second call should start scrolling in the -X direction. >+ EXPECT_CALL(m_mockInputHandler, scheduleAnimation()); >+ EXPECT_CALL(m_mockInputHandler, scrollBegin(testing::_, testing::_)) >+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); >+ EXPECT_CALL(m_mockInputHandler, scrollBy(testing::Property(&WebCore::IntSize::width, testing::Lt(0)))); >+ EXPECT_CALL(m_mockInputHandler, scrollEnd()); >+ m_inputHandler->animate(10.1); >+ > // Let's say on the third call we hit a non-scrollable region. We should abort the fling and not scroll. >- // FIXME: We also need to do some work to transfer the rest of this fling to the main thread. >- // Add tests for this once it's implemented. >+ // We also should pass the current fling parameters out to the client so the rest of the fling can be >+ // transferred to the main thread. > EXPECT_CALL(m_mockInputHandler, scheduleAnimation()); > EXPECT_CALL(m_mockInputHandler, scrollBegin(testing::_, testing::_)) >- .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollIgnored)); >+ .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollFailed)); > EXPECT_CALL(m_mockInputHandler, scrollBy(testing::_)).Times(0); > EXPECT_CALL(m_mockInputHandler, scrollEnd()).Times(0); >+ // Expected wheel fling animation parameters: >+ // *) flingDelta and flingPoint should match the original GestureFlingStart event >+ // *) startTime should be 10 to match the time parameter of the first animate() call after the GestureFlingStart >+ // *) cumulativeScroll depends on the curve, but since we've animated in the -X direction the X value should be < 0 >+ EXPECT_CALL(m_mockInputHandler, transferWheelFlingAnimation(flingDelta, flingPoint, flingGlobalPoint, 10, testing::Property(&WebCore::IntPoint::x, testing::Gt(0)))); > m_inputHandler->animate(10.2); > >- // Since we've aborted the fling, the next animation should be a no-op and should not result in another >- // frame being requested. >+ // Once the fling is transferred, we should stop scrolling. > EXPECT_CALL(m_mockInputHandler, scheduleAnimation()).Times(0); > EXPECT_CALL(m_mockInputHandler, scrollBegin(testing::_, testing::_)).Times(0); > m_inputHandler->animate(10.3); >+ >+ // Since we've transferred the fling to the main thread, we need to pass the next GestureFlingCancel to the main >+ // thread as well. >+ EXPECT_CALL(m_mockClient, didNotHandleInputEvent(true)); >+ gesture.type = WebKit::WebInputEvent::GestureFlingCancel; >+ m_inputHandler->handleInputEvent(gesture); > } > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 81479
:
132520
|
132542
|
132651
|
132658
|
132731
|
132733
|
132969
|
133630
|
133710