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-20120319173511.patch (text/plain), 54.54 KB, created by
James Robinson
on 2012-03-19 17:35:12 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
James Robinson
Created:
2012-03-19 17:35:12 PDT
Size:
54.54 KB
patch
obsolete
>Subversion Revision: 111274 >diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog >index 7a76083cf19661cae3be9fa72b193c7ba451f3e4..8e1aae38fe82d75dc08bf6d26c5ed02c3339e81d 100644 >--- a/Source/Platform/ChangeLog >+++ b/Source/Platform/ChangeLog >@@ -1,3 +1,22 @@ >+2012-03-19 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!). >+ >+ Add APIs for transfering an in-progress wheel fling from a WebLayerTreeView out to its client. >+ >+ * Platform.gypi: >+ * chromium/public/WebActiveWheelFlingParameters.h: Copied from Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h. >+ (WebKit): >+ (WebActiveWheelFlingParameters): >+ (WebKit::WebActiveWheelFlingParameters::WebActiveWheelFlingParameters): >+ * chromium/public/WebLayerTreeViewClient.h: >+ (WebKit): >+ (WebLayerTreeViewClient): >+ (WebKit::WebLayerTreeViewClient::transferWheelFlingAnimation): >+ > 2012-03-19 Sheriff Bot <webkit.review.bot@gmail.com> > > Unreviewed, rolling out r111207. >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index fbb49d197fb194a1421b2bd7d17a002b93df0676..133d94a12855f7666006bdecca1f92b125283fc4 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,81 @@ >+2012-03-19 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!). >+ >+ Adds the ability to transfer a wheel fling from the compositor thread to the main thread if we hit a non-wheel >+ scrollable area. This can happen if we scroll a scrollable area "under" the mouse pointer position or if we get >+ a commit with updated wheel handler or scrollable area data while the fling is in progress. In this case, we >+ grab the current animation parameters off of the curve and pass them out to the compositor's client to resume. >+ >+ WebCompositorInputHandlerImplTest updated to cover the transfering logic. >+ >+ * WebCore.gypi: >+ * 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): >+ (WebCore::TouchFlingPlatformGestureCurve::apply): >+ * platform/TouchFlingPlatformGestureCurve.h: >+ (TouchFlingPlatformGestureCurve): >+ (WebCore::TouchFlingPlatformGestureCurve::cumulativeScroll): >+ * platform/WheelFlingPlatformGestureCurve.cpp: >+ (WebCore::WheelFlingPlatformGestureCurve::apply): >+ * platform/WheelFlingPlatformGestureCurve.h: >+ (WebCore::WheelFlingPlatformGestureCurve::cumulativeScroll): >+ (WheelFlingPlatformGestureCurve): >+ * platform/graphics/chromium/ActiveWheelFlingParameters.h: Copied from Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h. >+ (WebCore): >+ (ActiveWheelFlingParameters): >+ (WebCore::ActiveWheelFlingParameters::ActiveWheelFlingParameters): >+ * 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: >+ (WebCore): >+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: >+ (WebCore::CCLayerTreeHost::transferWheelFlingAnimation): >+ (WebCore): >+ * platform/graphics/chromium/cc/CCLayerTreeHost.h: >+ (WebCore): >+ (CCLayerTreeHostClient): >+ (CCLayerTreeHost): >+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: >+ (WebCore::CCLayerTreeHostImpl::transferWheelFlingAnimation): >+ (WebCore): >+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: >+ (WebCore): >+ (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-19 Eric Seidel <eric@webkit.org> > > Fix the chromium world. >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index c0c3fedad70deca703d3ae574092c357e1e91548..fd0a5bc8bb524be4f3eef17a653fcea3d9a003d5 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,38 @@ >+2012-03-19 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::handleGestureFling): >+ (WebKit::WebCompositorInputHandlerImpl::scrollBy): >+ * src/WebCompositorInputHandlerImpl.h: >+ (WebCore): >+ * src/WebLayerTreeViewImpl.cpp: >+ (WebKit::WebLayerTreeViewImpl::transferWheelFlingAnimation): >+ (WebKit): >+ * src/WebLayerTreeViewImpl.h: >+ (WebCore): >+ (WebLayerTreeViewImpl): >+ * src/WebViewImpl.cpp: >+ (WebKit::WebViewImpl::gestureEvent): >+ (WebKit::WebViewImpl::transferWheelFlingAnimation): >+ (WebKit): >+ * src/WebViewImpl.h: >+ (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 >diff --git a/Source/Platform/Platform.gypi b/Source/Platform/Platform.gypi >index afa14713f5d6aacb8319d75a67736a6f23b1349a..8ecf8813a06fa763a642d4f86acb9e85ab30cc62 100644 >--- a/Source/Platform/Platform.gypi >+++ b/Source/Platform/Platform.gypi >@@ -31,6 +31,7 @@ > { > 'variables': { > 'platform_files': [ >+ 'chromium/public/WebActiveWheelFlingParameters.h', > 'chromium/public/WebCString.h', > 'chromium/public/WebCanvas.h', > 'chromium/public/WebColor.h', >diff --git a/Source/Platform/chromium/public/WebActiveWheelFlingParameters.h b/Source/Platform/chromium/public/WebActiveWheelFlingParameters.h >new file mode 100644 >index 0000000000000000000000000000000000000000..9a4596e62de3d8987885884080d224ee85e13c69 >--- /dev/null >+++ b/Source/Platform/chromium/public/WebActiveWheelFlingParameters.h >@@ -0,0 +1,54 @@ >+/* >+ * Copyright (C) 2012 Google Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef WebActiveWheelFlingParameters_h >+#define WebActiveWheelFlingParameters_h >+ >+#include "WebCommon.h" >+ >+#include "WebFloatPoint.h" >+#include "WebPoint.h" >+#include "WebSize.h" >+ >+namespace WebKit { >+ >+struct WebActiveWheelFlingParameters { >+ WebFloatPoint delta; >+ WebPoint point; >+ WebPoint globalPoint; >+ int modifiers; >+ WebSize cumulativeScroll; >+ double startTime; >+ >+ WebActiveWheelFlingParameters() >+ : modifiers(0) >+ , startTime(0) >+ { >+ } >+}; >+ >+} >+ >+#endif >diff --git a/Source/Platform/chromium/public/WebLayerTreeViewClient.h b/Source/Platform/chromium/public/WebLayerTreeViewClient.h >index 5c0b9ef9a2a2c613b11900c13f898f22839b465b..48bd9dcf973a717a27b91975f55be860c324438a 100644 >--- a/Source/Platform/chromium/public/WebLayerTreeViewClient.h >+++ b/Source/Platform/chromium/public/WebLayerTreeViewClient.h >@@ -27,6 +27,7 @@ > #define WebLayerTreeViewClient_h > > namespace WebKit { >+struct WebActiveWheelFlingParameters; > class WebGraphicsContext3D; > struct WebSize; > class WebThread; >@@ -55,6 +56,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 WebActiveWheelFlingParameters&) { } >+ > // 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/WebCore.gypi b/Source/WebCore/WebCore.gypi >index 386efb28d9b290f2b59c188972e3edcd230d6e9b..d9468801b714797ab0ffec0b069e736ec46b86f8 100644 >--- a/Source/WebCore/WebCore.gypi >+++ b/Source/WebCore/WebCore.gypi >@@ -3358,6 +3358,7 @@ > 'platform/graphics/cg/PathCG.cpp', > 'platform/graphics/cg/PatternCG.cpp', > 'platform/graphics/cg/TransformationMatrixCG.cpp', >+ 'platform/graphics/chromium/ActiveWheelFlingParameters.h', > 'platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp', > 'platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h', > 'platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp', >diff --git a/Source/WebCore/platform/ActivePlatformGestureAnimation.cpp b/Source/WebCore/platform/ActivePlatformGestureAnimation.cpp >index 18ec7eb34ae2e4e07b56c14a3e02a3378bad9d50..6a013adfb445d6dc953d43978f49850137cc0eff 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,14 @@ 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..8962cee944f118c5f3ea719b835c9eff9824c8dc 100644 >--- a/Source/WebCore/platform/CrossThreadCopier.h >+++ b/Source/WebCore/platform/CrossThreadCopier.h >@@ -41,6 +41,7 @@ > > namespace WebCore { > >+ struct ActiveWheelFlingParameters; > class IntRect; > class IntSize; > class KURL; >@@ -70,6 +71,9 @@ namespace WebCore { > template<> struct CrossThreadCopierBase<false, false, ThreadableLoaderOptions> : public CrossThreadCopierPassThrough<ThreadableLoaderOptions> { > }; > >+ template<> struct CrossThreadCopierBase<false, false, ActiveWheelFlingParameters> : public CrossThreadCopierPassThrough<ActiveWheelFlingParameters> { >+ }; >+ > 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..e0ed24397fa8846d7a4e4688921f3b6d32283cac 100644 >--- a/Source/WebCore/platform/PlatformGestureCurve.h >+++ b/Source/WebCore/platform/PlatformGestureCurve.h >@@ -27,6 +27,7 @@ > > namespace WebCore { > >+class IntSize; > 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 IntSize cumulativeScroll() const = 0; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/TouchFlingPlatformGestureCurve.cpp b/Source/WebCore/platform/TouchFlingPlatformGestureCurve.cpp >index 06ed54ac3ac096bc40e165ee2547cda5d934605c..d5e6336c10a1ff54a61e5fe9b727a8e52784b24f 100644 >--- a/Source/WebCore/platform/TouchFlingPlatformGestureCurve.cpp >+++ b/Source/WebCore/platform/TouchFlingPlatformGestureCurve.cpp >@@ -35,11 +35,17 @@ using namespace std; > > PassOwnPtr<PlatformGestureCurve> TouchFlingPlatformGestureCurve::create(const FloatPoint& velocity) > { >- return adoptPtr(new TouchFlingPlatformGestureCurve(velocity)); >+ return adoptPtr(new TouchFlingPlatformGestureCurve(velocity, IntSize())); > } > >-TouchFlingPlatformGestureCurve::TouchFlingPlatformGestureCurve(const FloatPoint& velocity) >+PassOwnPtr<PlatformGestureCurve> TouchFlingPlatformGestureCurve::create(const FloatPoint& velocity, const IntSize& cumulativeScroll) >+{ >+ return adoptPtr(new TouchFlingPlatformGestureCurve(velocity, cumulativeScroll)); >+} >+ >+TouchFlingPlatformGestureCurve::TouchFlingPlatformGestureCurve(const FloatPoint& velocity, const IntSize& cumulativeScroll) > : m_velocity(velocity) >+ , m_cumulativeScroll(cumulativeScroll) > , m_timeScaleFactor(1000 / max(1.f, max(fabs(velocity.x()), fabs(velocity.y())))) > { > ASSERT(velocity != FloatPoint::zero()); >@@ -72,7 +78,7 @@ bool TouchFlingPlatformGestureCurve::apply(double time, PlatformGestureCurveTarg > displacement = 1.0; > > // Keep track of integer portion of scroll thus far, and prepare increment. >- IntPoint scroll(displacement * m_velocity.x(), displacement * m_velocity.y()); >+ IntSize scroll(displacement * m_velocity.x(), displacement * m_velocity.y()); > IntPoint scrollIncrement(scroll - m_cumulativeScroll); > m_cumulativeScroll = scroll; > >diff --git a/Source/WebCore/platform/TouchFlingPlatformGestureCurve.h b/Source/WebCore/platform/TouchFlingPlatformGestureCurve.h >index fd52bc4ec74c0b52b75845b4669f656f07d250ee..16aefe2574e5178ad83e51d1871d2d37b28bd32c 100644 >--- a/Source/WebCore/platform/TouchFlingPlatformGestureCurve.h >+++ b/Source/WebCore/platform/TouchFlingPlatformGestureCurve.h >@@ -41,16 +41,18 @@ class PlatformGestureCurveTarget; > class TouchFlingPlatformGestureCurve : public PlatformGestureCurve { > public: > static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity); >+ static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity, const IntSize& cumulativeScroll); > virtual ~TouchFlingPlatformGestureCurve(); > > virtual bool apply(double time, PlatformGestureCurveTarget*); >+ virtual IntSize cumulativeScroll() const { return m_cumulativeScroll; } > > private: >- explicit TouchFlingPlatformGestureCurve(const FloatPoint& velocity); >+ TouchFlingPlatformGestureCurve(const FloatPoint& velocity, const IntSize& cumulativeScroll); > > FloatPoint m_velocity; >+ IntSize m_cumulativeScroll; > float m_timeScaleFactor; >- IntPoint m_cumulativeScroll; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.cpp b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.cpp >index c9f17328979cb7c72ff39f7ecc21110f433bc399..ebd788fe459a6c817baaea08b1a9ec23492ebf8a 100644 >--- a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.cpp >+++ b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.cpp >@@ -59,7 +59,7 @@ bool WheelFlingPlatformGestureCurve::apply(double time, PlatformGestureCurveTarg > // FIXME: consider making the value of sigma settable in the constructor. > static double twoSigmaSquaredInverse = 16; // sigma = 0.25 > float cdf = 1 - exp(-time * time * twoSigmaSquaredInverse); >- IntPoint scroll(cdf * m_velocity.x(), cdf * m_velocity.y()); >+ IntSize scroll(cdf * m_velocity.x(), cdf * m_velocity.y()); > IntPoint scrollIncrement(scroll - m_cumulativeScroll); > m_cumulativeScroll = scroll; > >diff --git a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h >index b72146165333f23c8c9bbf6c01ddbf067aee1ac2..29f151fc1b2f08a5912be50ff79cc695bd9c5aa7 100644 >--- a/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h >+++ b/Source/WebCore/platform/WheelFlingPlatformGestureCurve.h >@@ -44,12 +44,13 @@ public: > virtual ~WheelFlingPlatformGestureCurve(); > > virtual bool apply(double time, PlatformGestureCurveTarget*); >+ virtual IntSize cumulativeScroll() const { return m_cumulativeScroll; } > > private: > WheelFlingPlatformGestureCurve(const FloatPoint& velocity); > > FloatPoint m_velocity; >- IntPoint m_cumulativeScroll; >+ IntSize m_cumulativeScroll; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/graphics/chromium/ActiveWheelFlingParameters.h b/Source/WebCore/platform/graphics/chromium/ActiveWheelFlingParameters.h >new file mode 100644 >index 0000000000000000000000000000000000000000..568caa7963af276244e56bd93f1a81d775575262 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/chromium/ActiveWheelFlingParameters.h >@@ -0,0 +1,51 @@ >+/* >+ * Copyright (C) 2012 Google Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND >+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF >+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef ActiveWheelFlingParameters_h >+#define ActiveWheelFlingParameters_h >+ >+#include "FloatSize.h" >+#include "IntPoint.h" >+ >+namespace WebCore { >+ >+struct ActiveWheelFlingParameters { >+ FloatSize delta; >+ IntPoint point; >+ IntPoint globalPoint; >+ int modifiers; >+ IntSize cumulativeScroll; >+ double startTime; >+ >+ ActiveWheelFlingParameters() >+ : modifiers(0) >+ , startTime(0) >+ { >+ } >+}; >+ >+} >+ >+#endif >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCActiveGestureAnimation.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCActiveGestureAnimation.cpp >index a4af3e59bc5577a886f029be592fc499ad43ba01..7e9cc62a0c48ab24961dfb0c8f989ff2b3b199f4 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 "IntSize.h" > #include "cc/CCGestureCurve.h" > > namespace WebCore { >@@ -47,6 +48,11 @@ CCActiveGestureAnimation::~CCActiveGestureAnimation() > { > } > >+IntSize 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..3d507594b3821ae717eb09194ec730d46551f635 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 IntSize; > > 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; } >+ IntSize 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..cc79f71801e422f628922ab61e64e4c835b41c8f 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 IntSize 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 76608d9fc1d0da139a4930bc5047c08aeb8b2df4..dcd0eed0ee0664d46d7513af4800d2325dfb2b1d 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCInputHandler.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCInputHandler.h >@@ -29,6 +29,7 @@ > > namespace WebCore { > >+struct ActiveWheelFlingParameters; > class CCActiveGestureAnimation; > class CCGestureCurveTarget; > class IntPoint; >@@ -81,6 +82,8 @@ public: > // Request another callback to CCInputHandler::animate(). > virtual void scheduleAnimation() = 0; > >+ virtual void transferWheelFlingAnimation(const ActiveWheelFlingParameters&) = 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..b0ffa504b96671740624920b9d2b2f8e76763b4e 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >@@ -26,6 +26,7 @@ > > #include "cc/CCLayerTreeHost.h" > >+#include "ActiveWheelFlingParameters.h" > #include "LayerChromium.h" > #include "LayerPainterChromium.h" > #include "LayerRendererChromium.h" >@@ -414,6 +415,15 @@ void CCLayerTreeHost::composite() > static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately(); > } > >+void CCLayerTreeHost::transferWheelFlingAnimation(const ActiveWheelFlingParameters& parameters) >+{ >+ // We tick animations in CCLayerTreeHost using currentTime(), but the impl thread uses monotonicallyIncreasingTime(). Rebase here before passing times out to the client. >+ double timeShift = currentTime() - monotonicallyIncreasingTime(); >+ ActiveWheelFlingParameters parametersWithShiftedTime = parameters; >+ parametersWithShiftedTime.startTime += timeShift; >+ m_client->transferWheelFlingAnimation(parametersWithShiftedTime); >+} >+ > 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..12a839e105f1f230f46d8a1dff4213a9d8a76572 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >@@ -42,6 +42,7 @@ > > namespace WebCore { > >+struct ActiveWheelFlingParameters; > class CCLayerTreeHostImpl; > class CCTextureUpdater; > class GraphicsContext3D; >@@ -59,6 +60,7 @@ public: > virtual void didRecreateContext(bool success) = 0; > virtual void didCommitAndDrawFrame() = 0; > virtual void didCompleteSwapBuffers() = 0; >+ virtual void transferWheelFlingAnimation(const ActiveWheelFlingParameters&) = 0; > > // Used only in the single-threaded path. > virtual void scheduleComposite() = 0; >@@ -143,6 +145,7 @@ public: > void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } > void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } > void deleteContentsTexturesOnImplThread(TextureAllocator*); >+ virtual void transferWheelFlingAnimation(const ActiveWheelFlingParameters&); > // 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..8ec5d4db491b68d2ad71468526e2f8a4930a2223 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >@@ -186,6 +186,11 @@ void CCLayerTreeHostImpl::scheduleAnimation() > m_client->setNeedsRedrawOnImplThread(); > } > >+void CCLayerTreeHostImpl::transferWheelFlingAnimation(const ActiveWheelFlingParameters& parameters) >+{ >+ m_client->transferWheelFlingAnimationToMainThreadOnImplThread(parameters); >+} >+ > 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..50586291fd8df3144a58d7697bb066b5d13de989 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h >@@ -37,6 +37,7 @@ > > namespace WebCore { > >+struct ActiveWheelFlingParameters; > class CCActiveGestureAnimation; > class CCCompletionEvent; > class CCPageScaleAnimation; >@@ -55,6 +56,7 @@ public: > virtual void setNeedsRedrawOnImplThread() = 0; > virtual void setNeedsCommitOnImplThread() = 0; > virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) = 0; >+ virtual void transferWheelFlingAnimationToMainThreadOnImplThread(const ActiveWheelFlingParameters&) = 0; > }; > > // CCLayerTreeHostImpl owns the CCLayerImpl tree as well as associated rendering state >@@ -76,6 +78,7 @@ public: > // To clear an active animation, pass nullptr. > virtual void setActiveGestureAnimation(PassOwnPtr<CCActiveGestureAnimation>); > virtual void scheduleAnimation(); >+ virtual void transferWheelFlingAnimation(const ActiveWheelFlingParameters&); > > // 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..f830a8f728b82eeafe51db667b4633f04909d8c1 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); >+ void transferWheelFlingAnimationToMainThreadOnImplThread(const ActiveWheelFlingParameters&) { 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..83d5b9fb09cbca1a7b5a6a968298aebcfe93797e 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp >@@ -26,6 +26,7 @@ > > #include "cc/CCThreadProxy.h" > >+#include "ActiveWheelFlingParameters.h" > #include "GraphicsContext3D.h" > #include "TraceEvent.h" > #include "cc/CCDelayBasedTimeSource.h" >@@ -296,6 +297,19 @@ void CCThreadProxy::postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAni > m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::setAnimationEvents, events, wallClockTime)); > } > >+void CCThreadProxy::transferWheelFlingAnimationToMainThreadOnImplThread(const ActiveWheelFlingParameters& parameters) >+{ >+ ASSERT(isImplThread()); >+ TRACE_EVENT_INSTANT0("cc", "CCThreadProxy::transferWheelFlingAnimationToMainThreadOnImplThread"); >+ m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::transferWheelFlingAnimation, parameters)); >+} >+ >+void CCThreadProxy::transferWheelFlingAnimation(ActiveWheelFlingParameters parameters) >+{ >+ ASSERT(isMainThread()); >+ m_layerTreeHost->transferWheelFlingAnimation(parameters); >+} >+ > void CCThreadProxy::setNeedsRedraw() > { > ASSERT(isMainThread()); >@@ -394,7 +408,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..d98a80fbec92dac3a485f9445903cbe6eb1bf273 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 ActiveWheelFlingParameters&); > > // CCSchedulerClient implementation > virtual bool canDraw(); >@@ -105,6 +106,7 @@ private: > void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime); > void beginContextRecreation(); > void tryToRecreateContext(); >+ void transferWheelFlingAnimation(ActiveWheelFlingParameters); > > // Called on impl thread > struct ReadbackRequest { >diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp >index 96a7987f333e67107a4bf9c8c8fc00bde8efb834..8da2313aa6e4c7b02563492fc0904db48799de2f 100644 >--- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp >+++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp >@@ -27,6 +27,7 @@ > > #include "WebCompositorInputHandlerImpl.h" > >+#include "ActiveWheelFlingParameters.h" > #include "PlatformGestureCurveTarget.h" > #include "TouchFlingPlatformGestureCurve.h" > #include "TraceEvent.h" >@@ -68,6 +69,11 @@ public: > m_target->scrollBy(scrollDelta); > } > >+ virtual IntSize cumulativeScroll() const >+ { >+ return m_curve->cumulativeScroll(); >+ } >+ > private: > PlatformGestureToCCGestureAdapter(PassOwnPtr<PlatformGestureCurve> curve) > : m_curve(curve) >@@ -258,9 +264,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_wheelFlingPoint = IntPoint(gestureEvent.x, gestureEvent.y); >+ m_wheelFlingParameters.delta = FloatSize(gestureEvent.deltaX, gestureEvent.deltaY); >+ m_wheelFlingParameters.point = IntPoint(gestureEvent.x, gestureEvent.y); >+ m_wheelFlingParameters.globalPoint = IntPoint(gestureEvent.globalX, gestureEvent.globalY); > m_inputHandlerClient->scheduleAnimation(); > return DidHandle; > } >@@ -309,30 +317,35 @@ void WebCompositorInputHandlerImpl::scrollBy(const IntPoint& increment) > return; > > TRACE_EVENT2("cc", "WebCompositorInputHandlerImpl::scrollBy", "x", increment.x(), "y", increment.y()); >- >- WebMouseWheelEvent event; >- event.type = WebInputEvent::MouseWheel; >- event.deltaX = -increment.x(); >- event.deltaY = -increment.y(); >- event.hasPreciseScrollingDeltas = true; >- event.x = m_wheelFlingPoint.x(); >- event.y = m_wheelFlingPoint.y(); >- >- WebCompositorInputHandlerImpl::EventDisposition disposition = handleInputEventInternal(event); >+ WebMouseWheelEvent syntheticWheel; >+ syntheticWheel.type = WebInputEvent::MouseWheel; >+ syntheticWheel.deltaX = increment.x(); >+ syntheticWheel.deltaY = increment.y(); >+ syntheticWheel.hasPreciseScrollingDeltas = true; >+ syntheticWheel.x = m_wheelFlingParameters.point.x(); >+ syntheticWheel.y = m_wheelFlingParameters.point.y(); >+ syntheticWheel.globalX= m_wheelFlingParameters.globalPoint.x(); >+ syntheticWheel.globalY = m_wheelFlingParameters.globalPoint.y(); >+ syntheticWheel.modifiers = m_wheelFlingParameters.modifiers; >+ >+ WebCompositorInputHandlerImpl::EventDisposition disposition = handleInputEventInternal(syntheticWheel); > switch (disposition) { > case DidHandle: > 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_wheelFlingParameters.startTime = m_wheelFlingAnimation->startTime(); >+ m_wheelFlingParameters.cumulativeScroll = m_wheelFlingAnimation->cumulativeScroll(); >+ m_inputHandlerClient->transferWheelFlingAnimation(m_wheelFlingParameters); > cancelCurrentFling(); >+ break; > } > } > >diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h >index 9809029d2b0b4698c57bfbe511266ab7995665fd..1e38e24e46aba878c56f65accf2f9e6cb6249020 100644 >--- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h >+++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h >@@ -26,7 +26,7 @@ > #ifndef WebCompositorInputHandlerImpl_h > #define WebCompositorInputHandlerImpl_h > >-#include "IntPoint.h" >+#include "ActiveWheelFlingParameters.h" > #include "WebCompositor.h" > #include "WebCompositorInputHandler.h" > #include "WebInputEvent.h" >@@ -41,6 +41,7 @@ class Mutex; > } > > namespace WebCore { >+class IntPoint; > class CCGestureCurveTarget; > class CCInputHandlerClient; > class CCThread; >@@ -84,7 +85,8 @@ 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::ActiveWheelFlingParameters m_wheelFlingParameters; > > WebCompositorInputHandlerClient* m_client; > int m_identifier; >diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp >index 335879b660534a4bc757e51774f32ffdc67e7fec..6c8d6ed3a8e710eb2a1621b04c6f17d06d9b2747 100644 >--- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp >+++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp >@@ -26,16 +26,20 @@ > #include "config.h" > #include "WebLayerTreeViewImpl.h" > >+#include "ActiveWheelFlingParameters.h" > #include "CCThreadImpl.h" > #include "GraphicsContext3DPrivate.h" > #include "LayerChromium.h" > #include "cc/CCThreadProxy.h" >-#include "platform/WebGraphicsContext3D.h" >-#include "platform/WebLayer.h" >-#include "platform/WebLayerTreeView.h" >-#include "platform/WebLayerTreeViewClient.h" >-#include "platform/WebSize.h" > #include "platform/WebThread.h" >+#include <public/WebActiveWheelFlingParameters.h> >+#include <public/WebFloatPoint.h> >+#include <public/WebGraphicsContext3D.h> >+#include <public/WebLayer.h> >+#include <public/WebLayerTreeView.h> >+#include <public/WebLayerTreeViewClient.h> >+#include <public/WebPoint.h> >+#include <public/WebSize.h> > > using namespace WebCore; > >@@ -107,6 +111,20 @@ void WebLayerTreeViewImpl::didCompleteSwapBuffers() > m_client->didCompleteSwapBuffers(); > } > >+void WebLayerTreeViewImpl::transferWheelFlingAnimation(const ActiveWheelFlingParameters& parameters) >+{ >+ if (m_client) { >+ WebActiveWheelFlingParameters webParameters; >+ webParameters.delta = WebFloatPoint(parameters.delta.width(), parameters.delta.height()); >+ webParameters.point = parameters.point; >+ webParameters.globalPoint = parameters.point; >+ webParameters.modifiers = parameters.modifiers; >+ webParameters.startTime = parameters.startTime; >+ webParameters.cumulativeScroll = parameters.cumulativeScroll; >+ m_client->transferWheelFlingAnimation(webParameters); >+ } >+} >+ > void WebLayerTreeViewImpl::scheduleComposite() > { > if (m_client) >diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h >index b1b26d0fc338604fe5cf38071f50a8c3586452fb..6a94942f093a2af457d911e3794b3938060a8c6a 100644 >--- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h >+++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h >@@ -30,6 +30,10 @@ > #include "cc/CCLayerTreeHost.h" > #include <wtf/PassRefPtr.h> > >+namespace WebCore { >+struct ActiveWheelFlingParameters; >+} >+ > namespace WebKit { > class WebLayer; > class WebLayerTreeViewClient; >@@ -48,6 +52,7 @@ private: > virtual void didRecreateContext(bool success); > virtual void didCommitAndDrawFrame(); > virtual void didCompleteSwapBuffers(); >+ virtual void transferWheelFlingAnimation(const WebCore::ActiveWheelFlingParameters&); > > // 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 4f59c9005e691fd92e6c88abf9eeb835ef0b5703..a202586c9d50143b9f8dcddef05489857397fde2 100644 >--- a/Source/WebKit/chromium/src/WebViewImpl.cpp >+++ b/Source/WebKit/chromium/src/WebViewImpl.cpp >@@ -31,11 +31,10 @@ > #include "config.h" > #include "WebViewImpl.h" > >+#include "AXObjectCache.h" > #include "ActivePlatformGestureAnimation.h" > #include "AutofillPopupMenuClient.h" >-#include "AXObjectCache.h" > #include "BackForwardListChromium.h" >-#include "cc/CCProxy.h" > #include "CSSStyleSelector.h" > #include "CSSValueKeywords.h" > #include "Chrome.h" >@@ -119,32 +118,35 @@ > #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 "platform/WebString.h" >-#include "platform/WebVector.h" > #include "WebViewClient.h" > #include "WheelEvent.h" >+#include "cc/CCProxy.h" >+#include "platform/WebDragData.h" >+#include "platform/WebImage.h" >+#include "platform/WebKitPlatformSupport.h" >+#include "platform/WebString.h" >+#include "platform/WebVector.h" >+#include <public/WebActiveWheelFlingParameters.h> >+#include <public/WebFloatPoint.h> >+#include <public/WebGraphicsContext3D.h> >+#include <public/WebLayer.h> >+#include <public/WebLayerTreeView.h> >+#include <public/WebPoint.h> >+#include <public/WebRect.h> > #include <wtf/ByteArray.h> > #include <wtf/CurrentTime.h> > #include <wtf/MainThread.h> >@@ -630,6 +632,7 @@ bool WebViewImpl::gestureEvent(const WebGestureEvent& event) > { > switch (event.type) { > case WebInputEvent::GestureFlingStart: { >+ 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); > m_flingModifier = event.modifiers; >@@ -639,6 +642,7 @@ bool WebViewImpl::gestureEvent(const WebGestureEvent& event) > return true; > } > case WebInputEvent::GestureFlingCancel: >+ TRACE_EVENT_INSTANT0("webkit", "WebViewImpl::gestureEvent::GestureFlingCancel"); > m_gestureAnimation.clear(); > return true; > case WebInputEvent::GestureScrollBegin: >@@ -659,6 +663,18 @@ bool WebViewImpl::gestureEvent(const WebGestureEvent& event) > return false; > } > >+void WebViewImpl::transferWheelFlingAnimation(const WebActiveWheelFlingParameters& parameters) >+{ >+ TRACE_EVENT_INSTANT0("webkit", "WebViewImpl::transferWheelFlingAnimation"); >+ ASSERT(!m_gestureAnimation); >+ m_lastWheelPosition = parameters.point; >+ m_lastWheelGlobalPosition = parameters.globalPoint; >+ m_flingModifier = parameters.modifiers; >+ OwnPtr<PlatformGestureCurve> curve = TouchFlingPlatformGestureCurve::create(parameters.delta, parameters.cumulativeScroll); >+ m_gestureAnimation = ActivePlatformGestureAnimation::create(curve.release(), this, parameters.startTime); >+ scheduleAnimation(); >+} >+ > void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec) > { > if (!m_layerTreeView.isNull()) >diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h >index 22938ad6bd6c4975f74fe37e415487feeca1215b..063d8f7203c104848245d3cb87d38c716bffbe34 100644 >--- a/Source/WebKit/chromium/src/WebViewImpl.h >+++ b/Source/WebKit/chromium/src/WebViewImpl.h >@@ -261,6 +261,7 @@ public: > virtual void didCommitAndDrawFrame(); > virtual void didCompleteSwapBuffers(); > virtual void scheduleComposite(); >+ virtual void transferWheelFlingAnimation(const WebActiveWheelFlingParameters&); > > // WebViewImpl > >diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp >index a192ba557bf0ea16c21e4c04242cb25d090a1763..a4aeb06b0d75a6e7cc25df3ee1ef71c0ef292f37 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 ActiveWheelFlingParameters&) { } > > static void expectClearedScrollDeltasRecursive(CCLayerImpl* layer) > { >diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp >index 702bbf1639b43b16aef3abb6606290498c0d6615..fcfe1b623a2939c71d9ca6678a7d49a759c481ce 100644 >--- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp >+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp >@@ -256,6 +256,8 @@ public: > { > } > >+ virtual void transferWheelFlingAnimation(const ActiveWheelFlingParameters&) { } >+ > 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..8ddb10a8a259ca6d90f0b3bd2f3eebcfe0aea882 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 ActiveWheelFlingParameters&) { } > > // 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 fa8247b110c07eb157fd544902649e1db50f0d06..89bb5783e4a0dc88d26c38cc7b90983b9ff27f02 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_METHOD1(transferWheelFlingAnimation, void(const WebCore::ActiveWheelFlingParameters&)); >+ > private: > virtual void startPageScaleAnimation(const WebCore::IntSize& targetPosition, > bool anchorPoint, >@@ -339,7 +341,15 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimates) > // On the fling start, we should schedule an animation but not actually start > // scrolling. > gesture.type = WebKit::WebInputEvent::GestureFlingStart; >- gesture.deltaX = -1000; >+ 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_mockCCInputHandlerClient, scheduleAnimation()); > EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) > .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); >@@ -356,24 +366,36 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimates) > > testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); > >- // The second call should start scrolling in the +X direction. >+ // The second call should start scrolling in the -X direction. > EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()); > EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) > .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollStarted)); >- EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::Property(&WebCore::IntSize::width, testing::Gt(0)))); >+ EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::Property(&WebCore::IntSize::width, testing::Lt(0)))); > EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd()); > m_inputHandler->animate(10.1); > > testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); > > // 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_mockCCInputHandlerClient, scheduleAnimation()); > EXPECT_CALL(m_mockCCInputHandlerClient, scrollBegin(testing::_, testing::_)) > .WillOnce(testing::Return(WebCore::CCInputHandlerClient::ScrollFailed)); > EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_)).Times(0); > EXPECT_CALL(m_mockCCInputHandlerClient, 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_mockCCInputHandlerClient, transferWheelFlingAnimation(testing::AllOf( >+ testing::Field(&WebCore::ActiveWheelFlingParameters::delta, testing::Eq(flingDelta)), >+ testing::Field(&WebCore::ActiveWheelFlingParameters::point, testing::Eq(flingPoint)), >+ testing::Field(&WebCore::ActiveWheelFlingParameters::globalPoint, testing::Eq(flingGlobalPoint)), >+ testing::Field(&WebCore::ActiveWheelFlingParameters::startTime, testing::Eq(10)), >+ testing::Field(&WebCore::ActiveWheelFlingParameters::cumulativeScroll, >+ testing::Property(&WebCore::IntSize::width, testing::Gt(0)))))); > m_inputHandler->animate(10.2); > > testing::Mock::VerifyAndClearExpectations(&m_mockCCInputHandlerClient); >@@ -383,6 +405,12 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimates) > EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation()).Times(0); > EXPECT_CALL(m_mockCCInputHandlerClient, 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