summaryrefslogtreecommitdiffstats
path: root/webkit/compositor_bindings
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-08 01:45:24 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-08 01:45:24 +0000
commit0f077a5f3e29d65a06794f44c31703421e1099b5 (patch)
treee03e164915723038aae056b913078d5ece62679b /webkit/compositor_bindings
parent495972babd62847cc623537adfadefe95bb728f7 (diff)
downloadchromium_src-0f077a5f3e29d65a06794f44c31703421e1099b5.zip
chromium_src-0f077a5f3e29d65a06794f44c31703421e1099b5.tar.gz
chromium_src-0f077a5f3e29d65a06794f44c31703421e1099b5.tar.bz2
Update cc snapshot to r127918
TBR=nduca@chromium.org BUG= Review URL: https://chromiumcodereview.appspot.com/10917153 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155554 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/compositor_bindings')
-rw-r--r--webkit/compositor_bindings/LayerChromiumTest.cpp30
-rw-r--r--webkit/compositor_bindings/PlatformGestureCurve.h29
-rw-r--r--webkit/compositor_bindings/PlatformGestureCurveTarget.h23
-rw-r--r--webkit/compositor_bindings/TextureLayerChromiumTest.cpp13
-rw-r--r--webkit/compositor_bindings/TiledLayerChromiumTest.cpp14
-rw-r--r--webkit/compositor_bindings/TouchpadFlingPlatformGestureCurve.h45
-rw-r--r--webkit/compositor_bindings/WebCompositorImpl.cpp6
-rw-r--r--webkit/compositor_bindings/WebCompositorImpl.h6
-rw-r--r--webkit/compositor_bindings/WebContentLayerImpl.cpp9
-rw-r--r--webkit/compositor_bindings/WebContentLayerImpl.h3
-rw-r--r--webkit/compositor_bindings/WebLayerTest.cpp21
-rw-r--r--webkit/compositor_bindings/WebLayerTreeViewImpl.cpp16
-rw-r--r--webkit/compositor_bindings/WebLayerTreeViewImpl.h2
-rw-r--r--webkit/compositor_bindings/WebLayerTreeViewTest.cpp8
-rw-r--r--webkit/compositor_bindings/WebToCCInputHandlerAdapter.cpp108
-rw-r--r--webkit/compositor_bindings/WebToCCInputHandlerAdapter.h34
-rw-r--r--webkit/compositor_bindings/WheelFlingPlatformGestureCurve.h38
-rw-r--r--webkit/compositor_bindings/compositor_bindings.gyp15
-rw-r--r--webkit/compositor_bindings/web_compositor_support_impl.cc2
19 files changed, 226 insertions, 196 deletions
diff --git a/webkit/compositor_bindings/LayerChromiumTest.cpp b/webkit/compositor_bindings/LayerChromiumTest.cpp
index 4838f84..5b9bb72 100644
--- a/webkit/compositor_bindings/LayerChromiumTest.cpp
+++ b/webkit/compositor_bindings/LayerChromiumTest.cpp
@@ -12,9 +12,9 @@
#include "CCSingleThreadProxy.h"
#include "FakeCCLayerTreeHostClient.h"
#include "LayerPainterChromium.h"
+#include "WebCompositorInitializer.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include <public/WebCompositor.h>
#include <public/WebTransformationMatrix.h>
using namespace WebCore;
@@ -54,11 +54,15 @@ public:
class LayerChromiumTest : public testing::Test {
+public:
+ LayerChromiumTest()
+ : m_compositorInitializer(0)
+ {
+ }
+
protected:
virtual void SetUp()
{
- // Initialize without threading support.
- WebKit::WebCompositor::initialize(0);
m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost);
}
@@ -76,7 +80,6 @@ protected:
m_layerTreeHost->setRootLayer(0);
m_layerTreeHost.clear();
- WebKit::WebCompositor::shutdown();
}
void verifyTestTreeInitialState() const
@@ -129,6 +132,7 @@ protected:
OwnPtr<MockCCLayerTreeHost> m_layerTreeHost;
RefPtr<LayerChromium> m_parent, m_child1, m_child2, m_child3, m_grandChild1, m_grandChild2, m_grandChild3;
+ WebCompositorInitializer m_compositorInitializer;
};
TEST_F(LayerChromiumTest, basicCreateAndDestroy)
@@ -615,7 +619,7 @@ void assertLayerTreeHostMatchesForSubtree(LayerChromium* layer, CCLayerTreeHost*
TEST(LayerChromiumLayerTreeHostTest, enteringTree)
{
- WebKit::WebCompositor::initialize(0);
+ WebCompositorInitializer compositorInitializer(0);
RefPtr<LayerChromium> parent = LayerChromium::create();
RefPtr<LayerChromium> child = LayerChromium::create();
RefPtr<LayerChromium> mask = LayerChromium::create();
@@ -642,12 +646,11 @@ TEST(LayerChromiumLayerTreeHostTest, enteringTree)
assertLayerTreeHostMatchesForSubtree(parent.get(), 0);
layerTreeHost.clear();
- WebKit::WebCompositor::shutdown();
}
TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree)
{
- WebKit::WebCompositor::initialize(0);
+ WebCompositorInitializer compositorInitializer(0);
RefPtr<LayerChromium> parent = LayerChromium::create();
OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
@@ -673,12 +676,11 @@ TEST(LayerChromiumLayerTreeHostTest, addingLayerSubtree)
layerTreeHost->setRootLayer(0);
layerTreeHost.clear();
- WebKit::WebCompositor::shutdown();
}
TEST(LayerChromiumLayerTreeHostTest, changeHost)
{
- WebKit::WebCompositor::initialize(0);
+ WebCompositorInitializer compositorInitializer(0);
RefPtr<LayerChromium> parent = LayerChromium::create();
RefPtr<LayerChromium> child = LayerChromium::create();
RefPtr<LayerChromium> mask = LayerChromium::create();
@@ -706,12 +708,11 @@ TEST(LayerChromiumLayerTreeHostTest, changeHost)
secondLayerTreeHost->setRootLayer(0);
firstLayerTreeHost.clear();
secondLayerTreeHost.clear();
- WebKit::WebCompositor::shutdown();
}
TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree)
{
- WebKit::WebCompositor::initialize(0);
+ WebCompositorInitializer compositorInitializer(0);
RefPtr<LayerChromium> firstParent = LayerChromium::create();
RefPtr<LayerChromium> firstChild = LayerChromium::create();
RefPtr<LayerChromium> secondParent = LayerChromium::create();
@@ -743,12 +744,11 @@ TEST(LayerChromiumLayerTreeHostTest, changeHostInSubtree)
secondLayerTreeHost->setRootLayer(0);
firstLayerTreeHost.clear();
secondLayerTreeHost.clear();
- WebKit::WebCompositor::shutdown();
}
TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer)
{
- WebKit::WebCompositor::initialize(0);
+ WebCompositorInitializer compositorInitializer(0);
RefPtr<LayerChromium> parent = LayerChromium::create();
RefPtr<LayerChromium> mask = LayerChromium::create();
RefPtr<LayerChromium> replica = LayerChromium::create();
@@ -780,19 +780,17 @@ TEST(LayerChromiumLayerTreeHostTest, replaceMaskAndReplicaLayer)
// Test over, cleanup time.
layerTreeHost->setRootLayer(0);
layerTreeHost.clear();
- WebKit::WebCompositor::shutdown();
}
TEST(LayerChromiumLayerTreeHostTest, destroyHostWithNonNullRootLayer)
{
- WebKit::WebCompositor::initialize(0);
+ WebCompositorInitializer compositorInitializer(0);
RefPtr<LayerChromium> root = LayerChromium::create();
RefPtr<LayerChromium> child = LayerChromium::create();
root->addChild(child);
OwnPtr<FakeCCLayerTreeHost> layerTreeHost(FakeCCLayerTreeHost::create());
layerTreeHost->setRootLayer(root);
layerTreeHost.clear();
- WebKit::WebCompositor::shutdown();
}
class MockLayerChromium : public LayerChromium {
diff --git a/webkit/compositor_bindings/PlatformGestureCurve.h b/webkit/compositor_bindings/PlatformGestureCurve.h
deleted file mode 100644
index 5669742..0000000
--- a/webkit/compositor_bindings/PlatformGestureCurve.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PlatformGestureCurve_h
-#define PlatformGestureCurve_h
-
-namespace WebCore {
-
-class PlatformGestureCurveTarget;
-
-// Abstract interface for curves used by ActivePlatformGestureAnimation. A
-// PlatformGestureCurve defines the animation parameters as a function of time
-// (zero-based), and applies the parameters directly to the target of the
-// animation.
-class PlatformGestureCurve {
-public:
- virtual ~PlatformGestureCurve() { }
-
- // Returns a name of the curve for use in debugging.
- virtual const char* debugName() const = 0;
-
- // Returns false if curve has finished and can no longer be applied.
- virtual bool apply(double time, PlatformGestureCurveTarget*) = 0;
-};
-
-} // namespace WebCore
-
-#endif
diff --git a/webkit/compositor_bindings/PlatformGestureCurveTarget.h b/webkit/compositor_bindings/PlatformGestureCurveTarget.h
deleted file mode 100644
index 41e96d6..0000000
--- a/webkit/compositor_bindings/PlatformGestureCurveTarget.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PlatformGestureCurveTarget_h
-#define PlatformGestureCurveTarget_h
-
-namespace WebCore {
-
-class IntPoint;
-
-class PlatformGestureCurveTarget {
-public:
- virtual void scrollBy(const IntPoint&) = 0;
- // FIXME: add interfaces for scroll(), etc.
-
-protected:
- virtual ~PlatformGestureCurveTarget() { }
-};
-
-} // namespace WebCore
-
-#endif
diff --git a/webkit/compositor_bindings/TextureLayerChromiumTest.cpp b/webkit/compositor_bindings/TextureLayerChromiumTest.cpp
index b038ac0..947872d 100644
--- a/webkit/compositor_bindings/TextureLayerChromiumTest.cpp
+++ b/webkit/compositor_bindings/TextureLayerChromiumTest.cpp
@@ -8,9 +8,9 @@
#include "CCLayerTreeHost.h"
#include "FakeCCLayerTreeHostClient.h"
+#include "WebCompositorInitializer.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include <public/WebCompositor.h>
using namespace WebCore;
using ::testing::Mock;
@@ -36,11 +36,15 @@ private:
class TextureLayerChromiumTest : public testing::Test {
+public:
+ TextureLayerChromiumTest()
+ : m_compositorInitializer(0)
+ {
+ }
+
protected:
virtual void SetUp()
{
- // Initialize without threading support.
- WebKit::WebCompositor::initialize(0);
m_layerTreeHost = adoptPtr(new MockCCLayerTreeHost);
}
@@ -51,10 +55,11 @@ protected:
m_layerTreeHost->setRootLayer(0);
m_layerTreeHost.clear();
- WebKit::WebCompositor::shutdown();
}
OwnPtr<MockCCLayerTreeHost> m_layerTreeHost;
+private:
+ WebKitTests::WebCompositorInitializer m_compositorInitializer;
};
TEST_F(TextureLayerChromiumTest, syncImplWhenChangingTextureId)
diff --git a/webkit/compositor_bindings/TiledLayerChromiumTest.cpp b/webkit/compositor_bindings/TiledLayerChromiumTest.cpp
index 029a8a7..7a36566 100644
--- a/webkit/compositor_bindings/TiledLayerChromiumTest.cpp
+++ b/webkit/compositor_bindings/TiledLayerChromiumTest.cpp
@@ -17,8 +17,8 @@
#include "FakeCCGraphicsContext.h"
#include "FakeCCLayerTreeHostClient.h"
#include "LayerPainterChromium.h"
+#include "WebCompositorInitializer.h"
#include <gtest/gtest.h>
-#include <public/WebCompositor.h>
#include <public/WebTransformationMatrix.h>
using namespace WebCore;
@@ -50,11 +50,11 @@ private:
class TiledLayerChromiumTest : public testing::Test {
public:
TiledLayerChromiumTest()
- : m_context(WebKit::createFakeCCGraphicsContext())
+ : m_compositorInitializer(0)
+ , m_context(WebKit::createFakeCCGraphicsContext())
, m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool))
, m_occlusion(0)
{
- WebKit::WebCompositor::initialize(0);
DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
m_resourceProvider = CCResourceProvider::create(m_context.get());
}
@@ -62,11 +62,8 @@ public:
virtual ~TiledLayerChromiumTest()
{
textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider.get());
- {
- DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
- m_resourceProvider.clear();
- }
- WebKit::WebCompositor::shutdown();
+ DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked;
+ m_resourceProvider.clear();
}
// Helper classes and functions that set the current thread to be the impl thread
@@ -151,6 +148,7 @@ public:
}
public:
+ WebKitTests::WebCompositorInitializer m_compositorInitializer;
OwnPtr<CCGraphicsContext> m_context;
OwnPtr<CCResourceProvider> m_resourceProvider;
CCTextureUpdateQueue m_queue;
diff --git a/webkit/compositor_bindings/TouchpadFlingPlatformGestureCurve.h b/webkit/compositor_bindings/TouchpadFlingPlatformGestureCurve.h
deleted file mode 100644
index 072e914..0000000
--- a/webkit/compositor_bindings/TouchpadFlingPlatformGestureCurve.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef TouchpadFlingPlatformGestureCurve_h
-#define TouchpadFlingPlatformGestureCurve_h
-
-#include "FloatPoint.h"
-#include "PlatformGestureCurve.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace WebCore {
-
-class PlatformGestureCurveTarget;
-
-// Implementation of PlatformGestureCurve suitable for touch pad/screen-based
-// fling scroll. Starts with a flat velocity profile based on 'velocity', which
-// tails off to zero. Time is scaled to that duration of the fling is proportional
-// the initial velocity.
-class TouchpadFlingPlatformGestureCurve : public PlatformGestureCurve {
-public:
- static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity, IntPoint cumulativeScroll = IntPoint());
- static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity, float p0, float p1, float p2, float p3, float p4, float curveDuration, IntPoint cumulativeScroll = IntPoint());
- virtual ~TouchpadFlingPlatformGestureCurve();
-
- virtual const char* debugName() const OVERRIDE;
- virtual bool apply(double monotonicTime, PlatformGestureCurveTarget*) OVERRIDE;
-
-private:
- TouchpadFlingPlatformGestureCurve(const FloatPoint& velocity, float p0, float p1, float p2, float p3, float p4, float curveDuration, const IntPoint& cumulativeScroll);
-
- FloatPoint m_displacementRatio;
- IntPoint m_cumulativeScroll;
- float m_coeffs[5];
- float m_timeOffset;
- float m_curveDuration;
- float m_positionOffset;
-
- static const int m_maxSearchIterations;
-};
-
-} // namespace WebCore
-
-#endif
diff --git a/webkit/compositor_bindings/WebCompositorImpl.cpp b/webkit/compositor_bindings/WebCompositorImpl.cpp
index 530fa9b..8fd9f45 100644
--- a/webkit/compositor_bindings/WebCompositorImpl.cpp
+++ b/webkit/compositor_bindings/WebCompositorImpl.cpp
@@ -26,9 +26,9 @@ void WebCompositor::initialize(WebThread* implThread)
WebCompositorImpl::initialize(implThread);
}
-bool WebCompositor::threadingEnabled()
+bool WebCompositor::isThreadingEnabled()
{
- return WebCompositorImpl::threadingEnabled();
+ return WebCompositorImpl::isThreadingEnabled();
}
void WebCompositor::shutdown()
@@ -69,7 +69,7 @@ void WebCompositorImpl::initialize(WebThread* implThread)
CCProxy::setImplThread(0);
}
-bool WebCompositorImpl::threadingEnabled()
+bool WebCompositorImpl::isThreadingEnabled()
{
return s_implThread;
}
diff --git a/webkit/compositor_bindings/WebCompositorImpl.h b/webkit/compositor_bindings/WebCompositorImpl.h
index 8c386bc..68ae94a 100644
--- a/webkit/compositor_bindings/WebCompositorImpl.h
+++ b/webkit/compositor_bindings/WebCompositorImpl.h
@@ -24,13 +24,11 @@ class WebCompositorImpl : public WebCompositor {
public:
static bool initialized();
-private:
-
- friend class WebCompositor;
static void initialize(WebThread* implThread);
- static bool threadingEnabled();
+ static bool isThreadingEnabled();
static void shutdown();
+private:
static bool s_initialized;
static WebCore::CCThread* s_mainThread;
static WebCore::CCThread* s_implThread;
diff --git a/webkit/compositor_bindings/WebContentLayerImpl.cpp b/webkit/compositor_bindings/WebContentLayerImpl.cpp
index 05775a3..2705ff6 100644
--- a/webkit/compositor_bindings/WebContentLayerImpl.cpp
+++ b/webkit/compositor_bindings/WebContentLayerImpl.cpp
@@ -44,9 +44,14 @@ void WebContentLayerImpl::setDoubleSided(bool doubleSided)
m_layer->layer()->setDoubleSided(doubleSided);
}
-void WebContentLayerImpl::setContentsScale(float scale)
+void WebContentLayerImpl::setBoundsContainPageScale(bool boundsContainPageScale)
{
- m_layer->layer()->setContentsScale(scale);
+ return m_layer->layer()->setBoundsContainPageScale(boundsContainPageScale);
+}
+
+bool WebContentLayerImpl::boundsContainPageScale() const
+{
+ return m_layer->layer()->boundsContainPageScale();
}
void WebContentLayerImpl::setUseLCDText(bool enable)
diff --git a/webkit/compositor_bindings/WebContentLayerImpl.h b/webkit/compositor_bindings/WebContentLayerImpl.h
index f11a0f3..aee3906 100644
--- a/webkit/compositor_bindings/WebContentLayerImpl.h
+++ b/webkit/compositor_bindings/WebContentLayerImpl.h
@@ -21,7 +21,8 @@ public:
// WebContentLayer implementation.
virtual WebLayer* layer() OVERRIDE;
virtual void setDoubleSided(bool) OVERRIDE;
- virtual void setContentsScale(float) OVERRIDE;
+ virtual void setBoundsContainPageScale(bool) OVERRIDE;
+ virtual bool boundsContainPageScale() const OVERRIDE;
virtual void setUseLCDText(bool) OVERRIDE;
virtual void setDrawCheckerboardForMissingTiles(bool) OVERRIDE;
diff --git a/webkit/compositor_bindings/WebLayerTest.cpp b/webkit/compositor_bindings/WebLayerTest.cpp
index 09b26f47..52bcf909 100644
--- a/webkit/compositor_bindings/WebLayerTest.cpp
+++ b/webkit/compositor_bindings/WebLayerTest.cpp
@@ -6,9 +6,9 @@
#include <public/WebLayer.h>
#include "CompositorFakeWebGraphicsContext3D.h"
+#include "WebCompositorInitializer.h"
#include "WebLayerImpl.h"
#include "WebLayerTreeViewTestCommon.h"
-#include <public/WebCompositor.h>
#include <public/WebContentLayer.h>
#include <public/WebContentLayerClient.h>
#include <public/WebExternalTextureLayer.h>
@@ -19,6 +19,7 @@
#include <public/WebLayerTreeViewClient.h>
#include <public/WebRect.h>
#include <public/WebSize.h>
+#include <public/WebSolidColorLayer.h>
#include <gmock/gmock.h>
@@ -38,10 +39,13 @@ public:
class WebLayerTest : public Test {
public:
+ WebLayerTest()
+ : m_compositorInitializer(0)
+ {
+ }
+
virtual void SetUp()
{
- // Initialize without threading support.
- WebKit::WebCompositor::initialize(0);
m_rootLayer = adoptPtr(WebLayer::create());
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
EXPECT_TRUE(m_view = adoptPtr(WebLayerTreeView::create(&m_client, *m_rootLayer, WebLayerTreeView::Settings())));
@@ -54,10 +58,10 @@ public:
EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
m_rootLayer.clear();
m_view.clear();
- WebKit::WebCompositor::shutdown();
}
protected:
+ WebKitTests::WebCompositorInitializer m_compositorInitializer;
MockWebLayerTreeViewClient m_client;
OwnPtr<WebLayer> m_rootLayer;
OwnPtr<WebLayerTreeView> m_view;
@@ -120,7 +124,7 @@ TEST_F(WebLayerTest, Client)
EXPECT_EQ(point, layer->position());
// Texture layer.
- EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber());
+ EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
OwnPtr<WebExternalTextureLayer> textureLayer = adoptPtr(WebExternalTextureLayer::create());
m_rootLayer->addChild(textureLayer->layer());
Mock::VerifyAndClearExpectations(&m_client);
@@ -151,6 +155,13 @@ TEST_F(WebLayerTest, Client)
contentLayer->layer()->setDrawsContent(false);
Mock::VerifyAndClearExpectations(&m_client);
EXPECT_FALSE(contentLayer->layer()->drawsContent());
+
+ // Solid color layer.
+ EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1));
+ OwnPtr<WebSolidColorLayer> solidColorLayer = adoptPtr(WebSolidColorLayer::create());
+ m_rootLayer->addChild(solidColorLayer->layer());
+ Mock::VerifyAndClearExpectations(&m_client);
+
}
class MockScrollClient : public WebLayerScrollClient {
diff --git a/webkit/compositor_bindings/WebLayerTreeViewImpl.cpp b/webkit/compositor_bindings/WebLayerTreeViewImpl.cpp
index 7bfcff1..d4f455d 100644
--- a/webkit/compositor_bindings/WebLayerTreeViewImpl.cpp
+++ b/webkit/compositor_bindings/WebLayerTreeViewImpl.cpp
@@ -6,10 +6,13 @@
#include "WebLayerTreeViewImpl.h"
#include "CCFontAtlas.h"
+#include "CCInputHandler.h"
#include "CCLayerTreeHost.h"
#include "LayerChromium.h"
#include "WebLayerImpl.h"
+#include "WebToCCInputHandlerAdapter.h"
#include <public/WebGraphicsContext3D.h>
+#include <public/WebInputHandler.h>
#include <public/WebLayer.h>
#include <public/WebLayerTreeView.h>
#include <public/WebLayerTreeViewClient.h>
@@ -70,11 +73,6 @@ void WebLayerTreeViewImpl::clearRootLayer()
m_layerTreeHost->setRootLayer(PassRefPtr<LayerChromium>());
}
-int WebLayerTreeViewImpl::compositorIdentifier()
-{
- return m_layerTreeHost->compositorIdentifier();
-}
-
void WebLayerTreeViewImpl::setViewportSize(const WebSize& layoutViewportSize, const WebSize& deviceViewportSize)
{
if (!deviceViewportSize.isEmpty())
@@ -227,6 +225,14 @@ void WebLayerTreeViewImpl::didRecreateOutputSurface(bool success)
m_client->didRecreateOutputSurface(success);
}
+PassOwnPtr<CCInputHandler> WebLayerTreeViewImpl::createInputHandler()
+{
+ OwnPtr<WebInputHandler> handler = adoptPtr(m_client->createInputHandler());
+ if (handler)
+ return WebToCCInputHandlerAdapter::create(handler.release());
+ return nullptr;
+}
+
void WebLayerTreeViewImpl::willCommit()
{
m_client->willCommit();
diff --git a/webkit/compositor_bindings/WebLayerTreeViewImpl.h b/webkit/compositor_bindings/WebLayerTreeViewImpl.h
index bccd1c0..e795f5a 100644
--- a/webkit/compositor_bindings/WebLayerTreeViewImpl.h
+++ b/webkit/compositor_bindings/WebLayerTreeViewImpl.h
@@ -30,7 +30,6 @@ public:
virtual void setSurfaceReady() OVERRIDE;
virtual void setRootLayer(const WebLayer&) OVERRIDE;
virtual void clearRootLayer() OVERRIDE;
- virtual int compositorIdentifier() OVERRIDE;
virtual void setViewportSize(const WebSize& layoutViewportSize, const WebSize& deviceViewportSize = WebSize()) OVERRIDE;
virtual WebSize layoutViewportSize() const OVERRIDE;
virtual WebSize deviceViewportSize() const OVERRIDE;
@@ -60,6 +59,7 @@ public:
virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE;
virtual PassOwnPtr<WebCompositorOutputSurface> createOutputSurface() OVERRIDE;
virtual void didRecreateOutputSurface(bool success) OVERRIDE;
+ virtual PassOwnPtr<WebCore::CCInputHandler> createInputHandler() OVERRIDE;
virtual void willCommit() OVERRIDE;
virtual void didCommit() OVERRIDE;
virtual void didCommitAndDrawFrame() OVERRIDE;
diff --git a/webkit/compositor_bindings/WebLayerTreeViewTest.cpp b/webkit/compositor_bindings/WebLayerTreeViewTest.cpp
index d09b8067..f9e8d1a 100644
--- a/webkit/compositor_bindings/WebLayerTreeViewTest.cpp
+++ b/webkit/compositor_bindings/WebLayerTreeViewTest.cpp
@@ -11,7 +11,7 @@
#include "WebLayerTreeViewTestCommon.h"
#include <gmock/gmock.h>
#include <public/Platform.h>
-#include <public/WebCompositor.h>
+#include <public/WebCompositorSupport.h>
#include <public/WebLayer.h>
#include <public/WebLayerTreeViewClient.h>
#include <public/WebThread.h>
@@ -53,7 +53,7 @@ public:
m_rootLayer.clear();
m_view.clear();
- WebKit::WebCompositor::shutdown();
+ WebKit::Platform::current()->compositorSupport()->shutdown();
}
protected:
@@ -70,7 +70,7 @@ protected:
virtual void initializeCompositor() OVERRIDE
{
- WebKit::WebCompositor::initialize(0);
+ WebKit::Platform::current()->compositorSupport()->initialize(0);
}
virtual WebLayerTreeViewClient* client() OVERRIDE
@@ -149,7 +149,7 @@ protected:
virtual void initializeCompositor() OVERRIDE
{
m_webThread = adoptPtr(WebKit::Platform::current()->createThread("WebLayerTreeViewTest"));
- WebCompositor::initialize(m_webThread.get());
+ WebKit::Platform::current()->compositorSupport()->initialize(m_webThread.get());
}
virtual WebLayerTreeViewClient* client() OVERRIDE
diff --git a/webkit/compositor_bindings/WebToCCInputHandlerAdapter.cpp b/webkit/compositor_bindings/WebToCCInputHandlerAdapter.cpp
new file mode 100644
index 0000000..a306b79
--- /dev/null
+++ b/webkit/compositor_bindings/WebToCCInputHandlerAdapter.cpp
@@ -0,0 +1,108 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+
+#include "WebToCCInputHandlerAdapter.h"
+
+#include <public/WebInputHandlerClient.h>
+
+#define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \
+ COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), mismatching_enums)
+
+COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusOnMainThread, CCInputHandlerClient::ScrollOnMainThread);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusStarted, CCInputHandlerClient::ScrollStarted);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusIgnored, CCInputHandlerClient::ScrollIgnored);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeGesture, CCInputHandlerClient::Gesture);
+COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeWheel, CCInputHandlerClient::Wheel);
+
+namespace WebKit {
+
+PassOwnPtr<WebToCCInputHandlerAdapter> WebToCCInputHandlerAdapter::create(PassOwnPtr<WebInputHandler> handler)
+{
+ return adoptPtr(new WebToCCInputHandlerAdapter(handler));
+}
+
+WebToCCInputHandlerAdapter::WebToCCInputHandlerAdapter(PassOwnPtr<WebInputHandler> handler)
+ : m_handler(handler)
+{
+}
+
+WebToCCInputHandlerAdapter::~WebToCCInputHandlerAdapter()
+{
+}
+
+class WebToCCInputHandlerAdapter::ClientAdapter : public WebInputHandlerClient {
+public:
+ ClientAdapter(WebCore::CCInputHandlerClient* client)
+ : m_client(client)
+ {
+ }
+
+ virtual ~ClientAdapter()
+ {
+ }
+
+ virtual ScrollStatus scrollBegin(WebPoint point, ScrollInputType type) OVERRIDE
+ {
+ return static_cast<WebInputHandlerClient::ScrollStatus>(m_client->scrollBegin(point, static_cast<WebCore::CCInputHandlerClient::ScrollInputType>(type)));
+ }
+
+ virtual void scrollBy(WebPoint point, WebSize offset) OVERRIDE
+ {
+ m_client->scrollBy(point, offset);
+ }
+
+ virtual void scrollEnd() OVERRIDE
+ {
+ m_client->scrollEnd();
+ }
+
+ virtual void pinchGestureBegin() OVERRIDE
+ {
+ m_client->pinchGestureBegin();
+ }
+
+ virtual void pinchGestureUpdate(float magnifyDelta, WebPoint anchor) OVERRIDE
+ {
+ m_client->pinchGestureUpdate(magnifyDelta, anchor);
+ }
+
+ virtual void pinchGestureEnd() OVERRIDE
+ {
+ m_client->pinchGestureEnd();
+ }
+
+ virtual void startPageScaleAnimation(WebSize targetPosition,
+ bool anchorPoint,
+ float pageScale,
+ double startTime,
+ double duration) OVERRIDE
+ {
+ m_client->startPageScaleAnimation(targetPosition, anchorPoint, pageScale, startTime, duration);
+ }
+
+ virtual void scheduleAnimation() OVERRIDE
+ {
+ m_client->scheduleAnimation();
+ }
+
+private:
+ WebCore::CCInputHandlerClient* m_client;
+};
+
+
+void WebToCCInputHandlerAdapter::bindToClient(WebCore::CCInputHandlerClient* client)
+{
+ m_clientAdapter = adoptPtr(new ClientAdapter(client));
+ m_handler->bindToClient(m_clientAdapter.get());
+}
+
+void WebToCCInputHandlerAdapter::animate(double monotonicTime)
+{
+ m_handler->animate(monotonicTime);
+}
+
+}
+
diff --git a/webkit/compositor_bindings/WebToCCInputHandlerAdapter.h b/webkit/compositor_bindings/WebToCCInputHandlerAdapter.h
new file mode 100644
index 0000000..0984e84
--- /dev/null
+++ b/webkit/compositor_bindings/WebToCCInputHandlerAdapter.h
@@ -0,0 +1,34 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WebToCCInputHandlerAdapter_h
+#define WebToCCInputHandlerAdapter_h
+
+#include "CCInputHandler.h"
+#include <public/WebInputHandler.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+
+namespace WebKit {
+
+class WebToCCInputHandlerAdapter : public WebCore::CCInputHandler {
+public:
+ static PassOwnPtr<WebToCCInputHandlerAdapter> create(PassOwnPtr<WebInputHandler>);
+ virtual ~WebToCCInputHandlerAdapter();
+
+ // WebCore::CCInputHandler implementation.
+ virtual void bindToClient(WebCore::CCInputHandlerClient*) OVERRIDE;
+ virtual void animate(double monotonicTime) OVERRIDE;
+
+private:
+ explicit WebToCCInputHandlerAdapter(PassOwnPtr<WebInputHandler>);
+
+ class ClientAdapter;
+ OwnPtr<ClientAdapter> m_clientAdapter;
+ OwnPtr<WebInputHandler> m_handler;
+};
+
+}
+
+#endif // WebToCCInputHandlerAdapter_h
diff --git a/webkit/compositor_bindings/WheelFlingPlatformGestureCurve.h b/webkit/compositor_bindings/WheelFlingPlatformGestureCurve.h
deleted file mode 100644
index 2ff1f46..0000000
--- a/webkit/compositor_bindings/WheelFlingPlatformGestureCurve.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WheelFlingPlatformGestureCurve_h
-#define WheelFlingPlatformGestureCurve_h
-
-#include "FloatPoint.h"
-#include "PlatformGestureCurve.h"
-#include <wtf/OwnPtr.h>
-#include <wtf/PassOwnPtr.h>
-
-namespace WebCore {
-
-class PlatformGestureCurveTarget;
-
-// Implementation of PlatformGestureCurve suitable for mouse wheel-based fling
-// scroll. A Rayleigh distribtution curve is used to define the velocity profile,
-// so velocity starts at zero, accelerates to a maximum proportional to 'velocity',
-// then gently tails off to zero again.
-class WheelFlingPlatformGestureCurve : public PlatformGestureCurve {
-public:
- static PassOwnPtr<PlatformGestureCurve> create(const FloatPoint& velocity);
- virtual ~WheelFlingPlatformGestureCurve();
-
- virtual const char* debugName() const OVERRIDE;
- virtual bool apply(double time, PlatformGestureCurveTarget*) OVERRIDE;
-
-private:
- explicit WheelFlingPlatformGestureCurve(const FloatPoint& velocity);
-
- FloatPoint m_velocity;
- IntPoint m_cumulativeScroll;
-};
-
-} // namespace WebCore
-
-#endif
diff --git a/webkit/compositor_bindings/compositor_bindings.gyp b/webkit/compositor_bindings/compositor_bindings.gyp
index 6fb8d3c..eadc3bb 100644
--- a/webkit/compositor_bindings/compositor_bindings.gyp
+++ b/webkit/compositor_bindings/compositor_bindings.gyp
@@ -9,17 +9,12 @@
'webkit_compositor_bindings_sources': [
'CCThreadImpl.cpp',
'CCThreadImpl.h',
- 'PlatformGestureCurve.h',
- 'PlatformGestureCurveTarget.h',
- 'TouchpadFlingPlatformGestureCurve.h',
'WebAnimationCurveCommon.cpp',
'WebAnimationCurveCommon.h',
'WebAnimationImpl.cpp',
'WebAnimationImpl.h',
'WebCompositorImpl.cpp',
'WebCompositorImpl.h',
- 'WebCompositorInputHandlerImpl.cpp',
- 'WebCompositorInputHandlerImpl.h',
'WebContentLayerImpl.cpp',
'WebContentLayerImpl.h',
'WebExternalTextureLayerImpl.cpp',
@@ -32,17 +27,18 @@
'WebImageLayerImpl.h',
'WebLayerImpl.cpp',
'WebLayerImpl.h',
+ 'WebToCCInputHandlerAdapter.cpp',
+ 'WebToCCInputHandlerAdapter.h',
'WebLayerTreeViewImpl.cpp',
'WebLayerTreeViewImpl.h',
'WebScrollbarLayerImpl.cpp',
'WebScrollbarLayerImpl.h',
'WebSolidColorLayerImpl.cpp',
'WebSolidColorLayerImpl.h',
- 'WebTransformAnimationCurveImpl.cpp',
- 'WebTransformAnimationCurveImpl.h',
'WebVideoLayerImpl.cpp',
'WebVideoLayerImpl.h',
- 'WheelFlingPlatformGestureCurve.h',
+ 'WebTransformAnimationCurveImpl.cpp',
+ 'WebTransformAnimationCurveImpl.h',
],
'conditions': [
['inside_chromium_build==0', {
@@ -80,6 +76,9 @@
'webkit_compositor_bindings',
'../../third_party/WebKit/Source/WTF/WTF.gyp/WTF.gyp:wtf',
],
+ 'defines': [
+ 'USE_LIBCC_FOR_COMPOSITOR',
+ ],
}],
],
},
diff --git a/webkit/compositor_bindings/web_compositor_support_impl.cc b/webkit/compositor_bindings/web_compositor_support_impl.cc
index f80efd6..c66c3de 100644
--- a/webkit/compositor_bindings/web_compositor_support_impl.cc
+++ b/webkit/compositor_bindings/web_compositor_support_impl.cc
@@ -5,6 +5,8 @@
#include "webkit/compositor_bindings/web_compositor_support_impl.h"
#if defined(USE_LIBCC_FOR_COMPOSITOR)
+#include "config.h"
+#include "base/memory/scoped_ptr.h"
#include "webkit/compositor_bindings/WebLayerImpl.h"
#include "webkit/compositor_bindings/WebLayerTreeViewImpl.h"
#include "webkit/compositor_bindings/WebCompositorImpl.h"