Diff
Modified: trunk/Source/WebCore/ChangeLog (107356 => 107357)
--- trunk/Source/WebCore/ChangeLog 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebCore/ChangeLog 2012-02-10 05:51:57 UTC (rev 107357)
@@ -1,3 +1,37 @@
+2012-02-09 W. James MacLean <[email protected]>
+
+ [chromium] Add support for starting page/scale animations on CC impl thread from WebViewImpl
+ https://bugs.webkit.org/show_bug.cgi?id=77872
+
+ Reviewed by James Robinson.
+
+ Added unit test.
+
+ Provides a pathway to invoke CCLayerTreeHostImpl::startPageScaleAnimation() from
+ WebViewImpl. This is intended to support scale and scroll animations, such as WebInputEvent::GestureDoubleTap.
+
+ * platform/CrossThreadCopier.h:
+ (WebCore):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::startPageScaleAnimation):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+ (CCLayerTreeHost):
+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
+ (CCLayerTreeHostImpl):
+ * platform/graphics/chromium/cc/CCProxy.h:
+ (CCProxy):
+ * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
+ (WebCore::CCSingleThreadProxy::startPageScaleAnimation):
+ (WebCore):
+ * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
+ (CCSingleThreadProxy):
+ * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+ (WebCore::CCThreadProxy::startPageScaleAnimation):
+ (WebCore):
+ (WebCore::CCThreadProxy::requestStartPageScaleAnimationOnImplThread):
+ * platform/graphics/chromium/cc/CCThreadProxy.h:
+ (CCThreadProxy):
+
2012-02-09 Xianzhu Wang <[email protected]>
[Chromium] TiledLayerChromium::protectVisibleTileTextures() should only protect the visible textures
Modified: trunk/Source/WebCore/platform/CrossThreadCopier.h (107356 => 107357)
--- trunk/Source/WebCore/platform/CrossThreadCopier.h 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebCore/platform/CrossThreadCopier.h 2012-02-10 05:51:57 UTC (rev 107357)
@@ -42,6 +42,7 @@
namespace WebCore {
class IntRect;
+ class IntSize;
class KURL;
class ResourceError;
class ResourceRequest;
@@ -72,6 +73,9 @@
template<> struct CrossThreadCopierBase<false, false, IntRect> : public CrossThreadCopierPassThrough<IntRect> {
};
+ template<> struct CrossThreadCopierBase<false, false, IntSize> : public CrossThreadCopierPassThrough<IntSize> {
+ };
+
// Custom copy methods.
template<typename T> struct CrossThreadCopierBase<false, true, T> {
typedef typename WTF::RemoveTemplate<T, RefPtr>::Type TypeWithoutRefPtr;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (107356 => 107357)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2012-02-10 05:51:57 UTC (rev 107357)
@@ -356,6 +356,10 @@
m_proxy->setNeedsCommit();
}
+void CCLayerTreeHost::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec)
+{
+ m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, durationSec);
+}
void CCLayerTreeHost::loseCompositorContext(int numTimes)
{
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (107356 => 107357)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2012-02-10 05:51:57 UTC (rev 107357)
@@ -188,6 +188,8 @@
// Returns false if we should abort this frame due to initialization failure.
bool updateLayers();
+ void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec);
+
void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&);
void applyScrollAndScale(const CCScrollAndScaleSet&);
void startRateLimiter(GraphicsContext3D*);
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h (107356 => 107357)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h 2012-02-10 05:51:57 UTC (rev 107357)
@@ -117,6 +117,8 @@
// layer properties. This function overrides the damage region for the next draw cycle.
void setFullRootLayerDamage();
+ void startPageScaleAnimation(const IntSize& tragetPosition, bool useAnchor, float scale, double durationSec);
+
protected:
CCLayerTreeHostImpl(const CCSettings&, CCLayerTreeHostImplClient*);
CCLayerTreeHostImplClient* m_client;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h (107356 => 107357)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h 2012-02-10 05:51:57 UTC (rev 107357)
@@ -57,6 +57,8 @@
virtual bool compositeAndReadback(void *pixels, const IntRect&) = 0;
+ virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec) = 0;
+
virtual void finishAllRendering() = 0;
virtual bool isStarted() const = 0;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp (107356 => 107357)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp 2012-02-10 05:51:57 UTC (rev 107357)
@@ -93,6 +93,11 @@
return true;
}
+void CCSingleThreadProxy::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec)
+{
+ m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scale, monotonicallyIncreasingTime() * 1000.0, durationSec * 1000.0);
+}
+
GraphicsContext3D* CCSingleThreadProxy::context()
{
ASSERT(CCProxy::isMainThread());
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h (107356 => 107357)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h 2012-02-10 05:51:57 UTC (rev 107357)
@@ -42,6 +42,7 @@
// CCProxy implementation
virtual bool compositeAndReadback(void *pixels, const IntRect&);
+ virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec);
virtual GraphicsContext3D* context();
virtual void finishAllRendering();
virtual bool isStarted() const;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (107356 => 107357)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp 2012-02-10 05:51:57 UTC (rev 107357)
@@ -133,6 +133,19 @@
m_schedulerOnImplThread->setNeedsForcedRedraw();
}
+void CCThreadProxy::startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec)
+{
+ ASSERT(CCProxy::isMainThread());
+ CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::requestStartPageScaleAnimationOnImplThread, targetPosition, useAnchor, scale, durationSec));
+}
+
+void CCThreadProxy::requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double durationSec)
+{
+ ASSERT(CCProxy::isImplThread());
+ if (m_layerTreeHostImpl)
+ m_layerTreeHostImpl->startPageScaleAnimation(targetPosition, useAnchor, scale, monotonicallyIncreasingTime() * 1000.0, durationSec * 1000.0);
+}
+
GraphicsContext3D* CCThreadProxy::context()
{
return 0;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h (107356 => 107357)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h 2012-02-10 05:51:57 UTC (rev 107357)
@@ -49,6 +49,7 @@
// CCProxy implementation
virtual bool compositeAndReadback(void *pixels, const IntRect&);
+ virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec);
virtual GraphicsContext3D* context();
virtual void finishAllRendering();
virtual bool isStarted() const;
@@ -97,6 +98,7 @@
void obtainBeginFrameAndCommitTaskFromCCThread(CCCompletionEvent*, CCThread::Task**);
void beginFrameCompleteOnImplThread(CCCompletionEvent*);
void requestReadbackOnImplThread(ReadbackRequest*);
+ void requestStartPageScaleAnimationOnImplThread(IntSize targetPosition, bool useAnchor, float scale, double durationSec);
void finishAllRenderingOnImplThread(CCCompletionEvent*);
void initializeImplOnImplThread(CCCompletionEvent*);
void initializeContextOnImplThread(GraphicsContext3D*);
Modified: trunk/Source/WebKit/chromium/ChangeLog (107356 => 107357)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-02-10 05:51:57 UTC (rev 107357)
@@ -1,3 +1,30 @@
+2012-02-09 W. James MacLean <[email protected]>
+
+ [chromium] Add support for starting page/scale animations on CC impl thread from WebViewImpl
+ https://bugs.webkit.org/show_bug.cgi?id=77872
+
+ Reviewed by James Robinson.
+
+ Provides a pathway to invoke CCLayerTreeHostImpl::startPageScaleAnimation() from
+ WebViewImpl. This is intended to support scale and scroll animations, such as WebInputEvent::GestureDoubleTap.
+
+ * src/WebViewImpl.cpp:
+ (WebKit):
+ (WebKit::WebViewImpl::startPageScaleAnimation):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF):
+ (CCLayerTreeHostTestStartPageScaleAnimation):
+ (WTF::CCLayerTreeHostTestStartPageScaleAnimation::CCLayerTreeHostTestStartPageScaleAnimation):
+ (WTF::CCLayerTreeHostTestStartPageScaleAnimation::beginTest):
+ (WTF::CCLayerTreeHostTestStartPageScaleAnimation::requestStartPageScaleAnimation):
+ (WTF::CCLayerTreeHostTestStartPageScaleAnimation::drawLayersOnCCThread):
+ (WTF::CCLayerTreeHostTestStartPageScaleAnimation::applyScrollAndScale):
+ (WTF::CCLayerTreeHostTestStartPageScaleAnimation::commitCompleteOnCCThread):
+ (WTF::CCLayerTreeHostTestStartPageScaleAnimation::afterTest):
+ (WTF::TEST_F):
+
2012-02-09 John Bates <[email protected]>
[Chromium] Add chromium-style tracing support
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (107356 => 107357)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-02-10 05:51:57 UTC (rev 107357)
@@ -623,6 +623,12 @@
return handled;
}
+
+void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec)
+{
+ if (m_layerTreeHost)
+ m_layerTreeHost->startPageScaleAnimation(IntSize(scroll.x(), scroll.y()), useAnchor, newScale, durationSec);
+}
#endif
bool WebViewImpl::keyEvent(const WebKeyboardEvent& event)
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (107356 => 107357)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.h 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h 2012-02-10 05:51:57 UTC (rev 107357)
@@ -45,6 +45,7 @@
#include "GraphicsContext3D.h"
#include "GraphicsLayer.h"
#include "InspectorClientImpl.h"
+#include "IntPoint.h"
#include "IntRect.h"
#include "NotificationPresenterImpl.h"
#include "PageOverlayList.h"
@@ -315,6 +316,7 @@
void mouseDoubleClick(const WebMouseEvent&);
bool mouseWheel(const WebMouseWheelEvent&);
bool gestureEvent(const WebGestureEvent&);
+ void startPageScaleAnimation(const WebCore::IntPoint& targetPosition, bool useAnchor, float newScale, double durationSec);
bool keyEvent(const WebKeyboardEvent&);
bool charEvent(const WebKeyboardEvent&);
bool touchEvent(const WebTouchEvent&);
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (107356 => 107357)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-02-10 05:45:10 UTC (rev 107356)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-02-10 05:51:57 UTC (rev 107357)
@@ -938,6 +938,75 @@
runTestThreaded();
}
+// Verifies that startPageScaleAnimation events propagate correctly from CCLayerTreeHost to
+// CCLayerTreeHostImpl in the MT compositor.
+class CCLayerTreeHostTestStartPageScaleAnimation : public CCLayerTreeHostTest {
+public:
+
+ CCLayerTreeHostTestStartPageScaleAnimation()
+ : m_animationRequested(false)
+ {
+ }
+
+ virtual void beginTest()
+ {
+ m_layerTreeHost->rootLayer()->setScrollable(true);
+ m_layerTreeHost->rootLayer()->setScrollPosition(IntPoint());
+ postSetNeedsRedrawToMainThread();
+ }
+
+ static void requestStartPageScaleAnimation(void* self)
+ {
+ CCLayerTreeHostTestStartPageScaleAnimation* test = static_cast<CCLayerTreeHostTestStartPageScaleAnimation*>(self);
+ if (test->layerTreeHost())
+ test->layerTreeHost()->startPageScaleAnimation(IntSize(), false, 1.25, 0);
+ }
+
+ virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
+ {
+ impl->rootLayer()->setScrollable(true);
+ impl->rootLayer()->setScrollPosition(IntPoint());
+ impl->setPageScaleFactorAndLimits(impl->pageScale(), 0.5, 2);
+
+ // We request animation only once.
+ if (!m_animationRequested) {
+ callOnMainThread(CCLayerTreeHostTestStartPageScaleAnimation::requestStartPageScaleAnimation, this);
+ m_animationRequested = true;
+ }
+ }
+
+ virtual void applyScrollAndScale(const IntSize& scrollDelta, float scale)
+ {
+ IntPoint position = m_layerTreeHost->rootLayer()->scrollPosition();
+ m_layerTreeHost->rootLayer()->setScrollPosition(position + scrollDelta);
+ m_layerTreeHost->setPageScale(scale);
+ }
+
+ virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
+ {
+ impl->processScrollDeltas();
+ // We get one commit before the first draw, and the animation doesn't happen until the second draw,
+ // so results available on the third commit.
+ if (impl->frameNumber() == 2) {
+ EXPECT_EQ(1.25, impl->pageScale());
+ endTest();
+ } else
+ postSetNeedsRedrawToMainThread();
+ }
+
+ virtual void afterTest()
+ {
+ }
+
+private:
+ bool m_animationRequested;
+};
+
+TEST_F(CCLayerTreeHostTestStartPageScaleAnimation, runTest)
+{
+ runTest(true);
+}
+
class CCLayerTreeHostTestSetVisible : public CCLayerTreeHostTest {
public: