Changeset 107357 in webkit
- Timestamp:
- Feb 9, 2012 9:51:57 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r107352 r107357 1 2012-02-09 W. James MacLean <wjmaclean@chromium.org> 2 3 [chromium] Add support for starting page/scale animations on CC impl thread from WebViewImpl 4 https://bugs.webkit.org/show_bug.cgi?id=77872 5 6 Reviewed by James Robinson. 7 8 Added unit test. 9 10 Provides a pathway to invoke CCLayerTreeHostImpl::startPageScaleAnimation() from 11 WebViewImpl. This is intended to support scale and scroll animations, such as WebInputEvent::GestureDoubleTap. 12 13 * platform/CrossThreadCopier.h: 14 (WebCore): 15 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 16 (WebCore::CCLayerTreeHost::startPageScaleAnimation): 17 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 18 (CCLayerTreeHost): 19 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: 20 (CCLayerTreeHostImpl): 21 * platform/graphics/chromium/cc/CCProxy.h: 22 (CCProxy): 23 * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: 24 (WebCore::CCSingleThreadProxy::startPageScaleAnimation): 25 (WebCore): 26 * platform/graphics/chromium/cc/CCSingleThreadProxy.h: 27 (CCSingleThreadProxy): 28 * platform/graphics/chromium/cc/CCThreadProxy.cpp: 29 (WebCore::CCThreadProxy::startPageScaleAnimation): 30 (WebCore): 31 (WebCore::CCThreadProxy::requestStartPageScaleAnimationOnImplThread): 32 * platform/graphics/chromium/cc/CCThreadProxy.h: 33 (CCThreadProxy): 34 1 35 2012-02-09 Xianzhu Wang <wangxianzhu@chromium.org> 2 36 -
trunk/Source/WebCore/platform/CrossThreadCopier.h
r96066 r107357 43 43 44 44 class IntRect; 45 class IntSize; 45 46 class KURL; 46 47 class ResourceError; … … 71 72 72 73 template<> struct CrossThreadCopierBase<false, false, IntRect> : public CrossThreadCopierPassThrough<IntRect> { 74 }; 75 76 template<> struct CrossThreadCopierBase<false, false, IntSize> : public CrossThreadCopierPassThrough<IntSize> { 73 77 }; 74 78 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r107282 r107357 357 357 } 358 358 359 void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec) 360 { 361 m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, durationSec); 362 } 359 363 360 364 void CCLayerTreeHost::loseCompositorContext(int numTimes) -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r107177 r107357 189 189 bool updateLayers(); 190 190 191 void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec); 192 191 193 void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&); 192 194 void applyScrollAndScale(const CCScrollAndScaleSet&); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
r107243 r107357 118 118 void setFullRootLayerDamage(); 119 119 120 void startPageScaleAnimation(const IntSize& tragetPosition, bool useAnchor, float scale, double durationSec); 121 120 122 protected: 121 123 CCLayerTreeHostImpl(const CCSettings&, CCLayerTreeHostImplClient*); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h
r107177 r107357 58 58 virtual bool compositeAndReadback(void *pixels, const IntRect&) = 0; 59 59 60 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec) = 0; 61 60 62 virtual void finishAllRendering() = 0; 61 63 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp
r107243 r107357 94 94 } 95 95 96 void CCSingleThreadProxy::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec) 97 { 98 m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scale, monotonicallyIncreasingTime() * 1000.0, durationSec * 1000.0); 99 } 100 96 101 GraphicsContext3D* CCSingleThreadProxy::context() 97 102 { -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h
r107177 r107357 43 43 // CCProxy implementation 44 44 virtual bool compositeAndReadback(void *pixels, const IntRect&); 45 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec); 45 46 virtual GraphicsContext3D* context(); 46 47 virtual void finishAllRendering(); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r107243 r107357 134 134 } 135 135 136 void CCThreadProxy::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec) 137 { 138 ASSERT(CCProxy::isMainThread()); 139 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::requestStartPageScaleAnimationOnImplThread, targetPosition, useAnchor, scale, durationSec)); 140 } 141 142 void CCThreadProxy::requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double durationSec) 143 { 144 ASSERT(CCProxy::isImplThread()); 145 if (m_layerTreeHostImpl) 146 m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scale, monotonicallyIncreasingTime() * 1000.0, durationSec * 1000.0); 147 } 148 136 149 GraphicsContext3D* CCThreadProxy::context() 137 150 { -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h
r107243 r107357 50 50 // CCProxy implementation 51 51 virtual bool compositeAndReadback(void *pixels, const IntRect&); 52 virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec); 52 53 virtual GraphicsContext3D* context(); 53 54 virtual void finishAllRendering(); … … 98 99 void beginFrameCompleteOnImplThread(CCCompletionEvent*); 99 100 void requestReadbackOnImplThread(ReadbackRequest*); 101 void requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double durationSec); 100 102 void finishAllRenderingOnImplThread(CCCompletionEvent*); 101 103 void initializeImplOnImplThread(CCCompletionEvent*); -
trunk/Source/WebKit/chromium/ChangeLog
r107291 r107357 1 2012-02-09 W. James MacLean <wjmaclean@chromium.org> 2 3 [chromium] Add support for starting page/scale animations on CC impl thread from WebViewImpl 4 https://bugs.webkit.org/show_bug.cgi?id=77872 5 6 Reviewed by James Robinson. 7 8 Provides a pathway to invoke CCLayerTreeHostImpl::startPageScaleAnimation() from 9 WebViewImpl. This is intended to support scale and scroll animations, such as WebInputEvent::GestureDoubleTap. 10 11 * src/WebViewImpl.cpp: 12 (WebKit): 13 (WebKit::WebViewImpl::startPageScaleAnimation): 14 * src/WebViewImpl.h: 15 (WebViewImpl): 16 * tests/CCLayerTreeHostTest.cpp: 17 (WTF): 18 (CCLayerTreeHostTestStartPageScaleAnimation): 19 (WTF::CCLayerTreeHostTestStartPageScaleAnimation::CCLayerTreeHostTestStartPageScaleAnimation): 20 (WTF::CCLayerTreeHostTestStartPageScaleAnimation::beginTest): 21 (WTF::CCLayerTreeHostTestStartPageScaleAnimation::requestStartPageScaleAnimation): 22 (WTF::CCLayerTreeHostTestStartPageScaleAnimation::drawLayersOnCCThread): 23 (WTF::CCLayerTreeHostTestStartPageScaleAnimation::applyScrollAndScale): 24 (WTF::CCLayerTreeHostTestStartPageScaleAnimation::commitCompleteOnCCThread): 25 (WTF::CCLayerTreeHostTestStartPageScaleAnimation::afterTest): 26 (WTF::TEST_F): 27 1 28 2012-02-09 John Bates <jbates@google.com> 2 29 -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r107243 r107357 624 624 return handled; 625 625 } 626 627 void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec) 628 { 629 if (m_layerTreeHost) 630 m_layerTreeHost->startPageScaleAnimation(IntSize(scroll.x(), scroll.y()), useAnchor, newScale, durationSec); 631 } 626 632 #endif 627 633 -
trunk/Source/WebKit/chromium/src/WebViewImpl.h
r107243 r107357 46 46 #include "GraphicsLayer.h" 47 47 #include "InspectorClientImpl.h" 48 #include "IntPoint.h" 48 49 #include "IntRect.h" 49 50 #include "NotificationPresenterImpl.h" … … 316 317 bool mouseWheel(const WebMouseWheelEvent&); 317 318 bool gestureEvent(const WebGestureEvent&); 319 void startPageScaleAnimation(const WebCore::IntPoint& targetPosition, bool useAnchor, float newScale, double durationSec); 318 320 bool keyEvent(const WebKeyboardEvent&); 319 321 bool charEvent(const WebKeyboardEvent&); -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
r107177 r107357 939 939 } 940 940 941 // Verifies that startPageScaleAnimation events propagate correctly from CCLayerTreeHost to 942 // CCLayerTreeHostImpl in the MT compositor. 943 class CCLayerTreeHostTestStartPageScaleAnimation : public CCLayerTreeHostTest { 944 public: 945 946 CCLayerTreeHostTestStartPageScaleAnimation() 947 : m_animationRequested(false) 948 { 949 } 950 951 virtual void beginTest() 952 { 953 m_layerTreeHost->rootLayer()->setScrollable(true); 954 m_layerTreeHost->rootLayer()->setScrollPosition(IntPoint()); 955 postSetNeedsRedrawToMainThread(); 956 } 957 958 static void requestStartPageScaleAnimation(void* self) 959 { 960 CCLayerTreeHostTestStartPageScaleAnimation* test = static_cast<CCLayerTreeHostTestStartPageScaleAnimation*>(self); 961 if (test->layerTreeHost()) 962 test->layerTreeHost()->startPageScaleAnimation(IntSize(), false, 1.25, 0); 963 } 964 965 virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) 966 { 967 impl->rootLayer()->setScrollable(true); 968 impl->rootLayer()->setScrollPosition(IntPoint()); 969 impl->setPageScaleFactorAndLimits(impl->pageScale(), 0.5, 2); 970 971 // We request animation only once. 972 if (!m_animationRequested) { 973 callOnMainThread(CCLayerTreeHostTestStartPageScaleAnimation::requestStartPageScaleAnimation, this); 974 m_animationRequested = true; 975 } 976 } 977 978 virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale) 979 { 980 IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition(); 981 m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta); 982 m_layerTreeHost->setPageScale(scale); 983 } 984 985 virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) 986 { 987 impl->processScrollDeltas(); 988 // We get one commit before the first draw, and the animation doesn't happen until the second draw, 989 // so results available on the third commit. 990 if (impl->frameNumber() == 2) { 991 EXPECT_EQ(1.25, impl->pageScale()); 992 endTest(); 993 } else 994 postSetNeedsRedrawToMainThread(); 995 } 996 997 virtual void afterTest() 998 { 999 } 1000 1001 private: 1002 bool m_animationRequested; 1003 }; 1004 1005 TEST_F(CCLayerTreeHostTestStartPageScaleAnimation, runTest) 1006 { 1007 runTest(true); 1008 } 1009 941 1010 class CCLayerTreeHostTestSetVisible : public CCLayerTreeHostTest { 942 1011 public:
Note: See TracChangeset
for help on using the changeset viewer.