Diff
Modified: trunk/Source/WebKit2/ChangeLog (124804 => 124805)
--- trunk/Source/WebKit2/ChangeLog 2012-08-06 22:30:12 UTC (rev 124804)
+++ trunk/Source/WebKit2/ChangeLog 2012-08-06 23:01:06 UTC (rev 124805)
@@ -1,3 +1,59 @@
+2012-08-06 No'am Rosenthal <noam.rosent...@nokia.com>
+
+ [Qt] Use GraphicsLayerAnimation in LayerTreeCoordinator
+ https://bugs.webkit.org/show_bug.cgi?id=93147
+
+ Reviewed by Kenneth Rohde Christiansen
+
+ Allow controlling animations outside of WebCore. This is an intermediate step before moving
+ to threaded animations.
+
+ CoordinatedGraphicsLayer maintains the GraphicsLayerAnimation structures, and applies the
+ animation interpolation at the right time, before syncing the rest of the layer info and
+ the visible contents rect.
+
+ This also allows sending shorter IPC messages for animated opacity/transform changes,
+ without the rest of the layer info.
+
+ * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp:
+ (WebKit::LayerTreeCoordinatorProxy::setLayerAnimatedOpacity):
+ (WebKit):
+ (WebKit::LayerTreeCoordinatorProxy::setLayerAnimatedTransform):
+ * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h:
+ (LayerTreeCoordinatorProxy):
+ * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in:
+ * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
+ (WebKit::LayerTreeRenderer::setAnimatedOpacity):
+ (WebKit):
+ (WebKit::LayerTreeRenderer::setAnimatedTransform):
+ * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
+ (LayerTreeRenderer):
+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
+ (WebCore::CoordinatedGraphicsLayer::didChangeAnimatedProperties):
+ (WebCore):
+ (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
+ (WebCore::CoordinatedGraphicsLayer::syncLayerState):
+ (WebCore::CoordinatedGraphicsLayer::syncAnimatedProperties):
+ (WebCore::CoordinatedGraphicsLayer::syncCompositingStateForThisLayerOnly):
+ (WebCore::CoordinatedGraphicsLayer::computeTransformedVisibleRect):
+ account for the animated transform in the visible rect.
+
+ (WebCore::CoordinatedGraphicsLayer::addAnimation):
+ (WebCore::CoordinatedGraphicsLayer::pauseAnimation):
+ (WebCore::CoordinatedGraphicsLayer::removeAnimation):
+ (WebCore::CoordinatedGraphicsLayer::animationStartedTimerFired):
+ (WebCore::CoordinatedGraphicsLayer::setAnimatedTransform):
+ (WebCore::CoordinatedGraphicsLayer::setAnimatedOpacity):
+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:
+ (CoordinatedGraphicsLayerClient):
+ (CoordinatedGraphicsLayer):
+ * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp:
+ (WebKit):
+ (WebKit::LayerTreeCoordinator::setLayerAnimatedOpacity):
+ (WebKit::LayerTreeCoordinator::setLayerAnimatedTransform):
+ * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h:
+ (LayerTreeCoordinator):
+
2012-08-06 Anders Carlsson <ander...@apple.com>
If the Apple Java plug-in is blocked and no runtime is installed, don't load it
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp (124804 => 124805)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp 2012-08-06 22:30:12 UTC (rev 124804)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp 2012-08-06 23:01:06 UTC (rev 124805)
@@ -138,6 +138,16 @@
dispatchUpdate(bind(&LayerTreeRenderer::setContentsSize, m_renderer.get(), contentsSize));
}
+void LayerTreeCoordinatorProxy::setLayerAnimatedOpacity(uint32_t id, float opacity)
+{
+ dispatchUpdate(bind(&LayerTreeRenderer::setAnimatedOpacity, m_renderer.get(), id, opacity));
+}
+
+void LayerTreeCoordinatorProxy::setLayerAnimatedTransform(uint32_t id, const WebCore::TransformationMatrix& transform)
+{
+ dispatchUpdate(bind(&LayerTreeRenderer::setAnimatedTransform, m_renderer.get(), id, transform));
+}
+
void LayerTreeCoordinatorProxy::setVisibleContentsRect(const FloatRect& rect, float scale, const FloatPoint& trajectoryVector)
{
// Inform the renderer to adjust viewport-fixed layers.
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h (124804 => 124805)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h 2012-08-06 22:30:12 UTC (rev 124804)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h 2012-08-06 23:01:06 UTC (rev 124805)
@@ -74,6 +74,8 @@
void syncCanvas(uint32_t id, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken);
void purgeBackingStores();
LayerTreeRenderer* layerTreeRenderer() const { return m_renderer.get(); }
+ void setLayerAnimatedOpacity(uint32_t, float);
+ void setLayerAnimatedTransform(uint32_t, const WebCore::TransformationMatrix&);
protected:
void dispatchUpdate(const Function<void()>&);
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in (124804 => 124805)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in 2012-08-06 22:30:12 UTC (rev 124804)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in 2012-08-06 23:01:06 UTC (rev 124805)
@@ -34,5 +34,7 @@
DidRenderFrame()
DidChangeScrollPosition(WebCore::IntPoint position)
SyncCanvas(uint32_t id, WebCore::IntSize canvasSize, uint32_t graphicsSurfaceToken)
+ SetLayerAnimatedOpacity(uint32_t id, float opacity)
+ SetLayerAnimatedTransform(uint32_t id, WebCore::TransformationMatrix transform)
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp (124804 => 124805)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp 2012-08-06 22:30:12 UTC (rev 124804)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp 2012-08-06 23:01:06 UTC (rev 124805)
@@ -461,6 +461,22 @@
callOnMainThread(bind(&LayerTreeRenderer::purgeBackingStores, this));
}
+void LayerTreeRenderer::setAnimatedOpacity(uint32_t id, float opacity)
+{
+ GraphicsLayer* layer = layerByID(id);
+ ASSERT(layer);
+
+ layer->setOpacity(opacity);
+}
+
+void LayerTreeRenderer::setAnimatedTransform(uint32_t id, const WebCore::TransformationMatrix& transform)
+{
+ GraphicsLayer* layer = layerByID(id);
+ ASSERT(layer);
+
+ layer->setTransform(transform);
+}
+
void LayerTreeRenderer::purgeBackingStores()
{
if (m_layerTreeCoordinatorProxy)
Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h (124804 => 124805)
--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h 2012-08-06 22:30:12 UTC (rev 124804)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h 2012-08-06 23:01:06 UTC (rev 124805)
@@ -89,6 +89,8 @@
void flushLayerChanges();
void createImage(int64_t, PassRefPtr<ShareableBitmap>);
void destroyImage(int64_t);
+ void setAnimatedOpacity(uint32_t, float);
+ void setAnimatedTransform(uint32_t, const WebCore::TransformationMatrix&);
private:
PassOwnPtr<WebCore::GraphicsLayer> createLayer(WebLayerID);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp (124804 => 124805)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp 2012-08-06 22:30:12 UTC (rev 124804)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp 2012-08-06 23:01:06 UTC (rev 124805)
@@ -68,6 +68,13 @@
client()->notifySyncRequired(this);
}
+void CoordinatedGraphicsLayer::didChangeAnimatedProperties()
+{
+ m_shouldSyncAnimatedProperties = true;
+ if (client())
+ client()->notifySyncRequired(this);
+}
+
void CoordinatedGraphicsLayer::didChangeChildren()
{
m_shouldSyncChildren = true;
@@ -114,6 +121,7 @@
, m_CoordinatedGraphicsLayerClient(0)
, m_contentsScale(1)
, m_canvasPlatformLayer(0)
+ , m_animationStartedTimer(this, &CoordinatedGraphicsLayer::animationStartedTimerFired)
{
static WebLayerID nextLayerID = 1;
m_id = nextLayerID++;
@@ -489,9 +497,27 @@
m_layerInfo.replica = toWebLayerID(replicaLayer());
m_layerInfo.size = size();
m_layerInfo.transform = transform();
+ if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitTransform))
+ m_effectiveTransform = transform();
+ if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity))
+ m_effectiveOpacity = opacity();
m_CoordinatedGraphicsLayerClient->syncLayerState(m_id, m_layerInfo);
}
+void CoordinatedGraphicsLayer::syncAnimatedProperties()
+{
+ m_animations.apply(this);
+ if (!m_shouldSyncAnimatedProperties)
+ return;
+
+ m_shouldSyncAnimatedProperties = true;
+ if (m_effectiveOpacity != opacity())
+ m_CoordinatedGraphicsLayerClient->setLayerAnimatedOpacity(id(), m_effectiveOpacity);
+ if (m_effectiveTransform != transform())
+ m_CoordinatedGraphicsLayerClient->setLayerAnimatedTransform(id(), m_effectiveTransform);
+}
+
+
void CoordinatedGraphicsLayer::syncCanvas()
{
if (!m_canvasNeedsDisplay)
@@ -519,9 +545,10 @@
{
// The remote image might have been released by purgeBackingStores.
ensureImageBackingStore();
+ syncLayerState();
+ syncAnimatedProperties();
computeTransformedVisibleRect();
syncChildren();
- syncLayerState();
#if ENABLE(CSS_FILTERS)
syncFilters();
#endif
@@ -723,7 +750,7 @@
if (!m_shouldUpdateVisibleRect)
return;
m_shouldUpdateVisibleRect = false;
- m_layerTransform.setLocalTransform(transform());
+ m_layerTransform.setLocalTransform(m_effectiveTransform);
m_layerTransform.setPosition(position());
m_layerTransform.setAnchorPoint(anchorPoint());
m_layerTransform.setSize(size());
@@ -754,5 +781,52 @@
return false;
}
+bool CoordinatedGraphicsLayer::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset)
+{
+ ASSERT(!keyframesName.isEmpty());
+
+ if (!anim || anim->isEmptyOrZeroDuration() || valueList.size() < 2 || (valueList.property() != AnimatedPropertyWebkitTransform && valueList.property() != AnimatedPropertyOpacity))
+ return false;
+
+ bool listsMatch = false;
+ bool ignoredHasBigRotation;
+
+ if (valueList.property() == AnimatedPropertyWebkitTransform)
+ listsMatch = validateTransformOperations(valueList, ignoredHasBigRotation) >= 0;
+
+ m_animations.add(keyframesName, GraphicsLayerAnimation(valueList, boxSize, anim, timeOffset, listsMatch));
+ m_animationStartedTimer.startOneShot(0);
+ didChangeLayerState();
+ return true;
}
+
+void CoordinatedGraphicsLayer::pauseAnimation(const String& animationName, double timeOffset)
+{
+ m_animations.pause(animationName, timeOffset);
+}
+
+void CoordinatedGraphicsLayer::removeAnimation(const String& animationName)
+{
+ m_animations.remove(animationName);
+}
+
+void CoordinatedGraphicsLayer::animationStartedTimerFired(Timer<CoordinatedGraphicsLayer>*)
+{
+ client()->notifyAnimationStarted(this, /* DOM time */ WTF::currentTime());
+}
+
+void CoordinatedGraphicsLayer::setAnimatedTransform(const TransformationMatrix& transform)
+{
+ m_effectiveTransform = transform;
+ didChangeAnimatedProperties();
+ m_shouldUpdateVisibleRect = true;
+}
+
+void CoordinatedGraphicsLayer::setAnimatedOpacity(float opacity)
+{
+ m_effectiveOpacity = opacity;
+ didChangeAnimatedProperties();
+}
+
+}
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h (124804 => 124805)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h 2012-08-06 22:30:12 UTC (rev 124804)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h 2012-08-06 23:01:06 UTC (rev 124805)
@@ -24,6 +24,7 @@
#include "CoordinatedTile.h"
#include "FloatPoint3D.h"
#include "GraphicsLayer.h"
+#include "GraphicsLayerAnimation.h"
#include "GraphicsLayerTransform.h"
#include "Image.h"
#include "IntSize.h"
@@ -63,6 +64,10 @@
#if PLATFORM(QT)
virtual void syncCanvas(WebLayerID, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken) = 0;
#endif
+
+ virtual void setLayerAnimatedOpacity(WebLayerID, float) = 0;
+ virtual void setLayerAnimatedTransform(WebLayerID, const WebCore::TransformationMatrix&) = 0;
+
virtual void attachLayer(WebCore::CoordinatedGraphicsLayer*) = 0;
virtual void detachLayer(WebCore::CoordinatedGraphicsLayer*) = 0;
virtual void syncFixedLayers() = 0;
@@ -74,7 +79,8 @@
class CoordinatedGraphicsLayer : public WebCore::GraphicsLayer
, public TiledBackingStoreClient
- , public WebKit::CoordinatedTileClient {
+ , public WebKit::CoordinatedTileClient
+ , public GraphicsLayerAnimation::Client {
public:
CoordinatedGraphicsLayer(GraphicsLayerClient*);
virtual ~CoordinatedGraphicsLayer();
@@ -159,6 +165,14 @@
void updateContentBuffers();
void purgeBackingStores();
+ // GraphicsLayerAnimation::Client
+ virtual void setAnimatedTransform(const TransformationMatrix&);
+ virtual void setAnimatedOpacity(float);
+
+ virtual bool addAnimation(const KeyframeValueList&, const IntSize&, const Animation*, const String&, double);
+ virtual void pauseAnimation(const String&, double);
+ virtual void removeAnimation(const String&);
+
private:
virtual void willBeDestroyed();
WebKit::WebLayerID m_id;
@@ -172,10 +186,12 @@
bool m_shouldSyncLayerState: 1;
bool m_shouldSyncChildren: 1;
bool m_shouldSyncFilters: 1;
+ bool m_shouldSyncAnimatedProperties: 1;
bool m_fixedToViewport : 1;
bool m_canvasNeedsDisplay : 1;
void notifyChange();
+ void didChangeAnimatedProperties();
void didChangeGeometry();
void didChangeLayerState();
void didChangeChildren();
@@ -183,6 +199,9 @@
void didChangeFilters();
#endif
+ float m_effectiveOpacity;
+ TransformationMatrix m_effectiveTransform;
+
void createBackingStore();
bool selfOrAncestorHaveNonAffineTransforms();
@@ -190,14 +209,19 @@
void adjustContentsScale();
void computeTransformedVisibleRect();
void syncLayerParameters();
+ void syncAnimatedProperties();
void setShouldUpdateVisibleRect();
float effectiveContentsScale();
+ void animationStartedTimerFired(WebCore::Timer<CoordinatedGraphicsLayer>*);
+
WebKit::CoordinatedGraphicsLayerClient* m_CoordinatedGraphicsLayerClient;
OwnPtr<WebCore::TiledBackingStore> m_mainBackingStore;
OwnPtr<WebCore::TiledBackingStore> m_previousBackingStore;
float m_contentsScale;
PlatformLayer* m_canvasPlatformLayer;
+ Timer<CoordinatedGraphicsLayer> m_animationStartedTimer;
+ GraphicsLayerAnimations m_animations;
};
CoordinatedGraphicsLayer* toCoordinatedGraphicsLayer(GraphicsLayer*);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp (124804 => 124805)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp 2012-08-06 22:30:12 UTC (rev 124804)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp 2012-08-06 23:01:06 UTC (rev 124805)
@@ -530,6 +530,19 @@
return m_visibleContentsRect;
}
+
+void LayerTreeCoordinator::setLayerAnimatedOpacity(WebLayerID id, float opacity)
+{
+ m_shouldSyncFrame = true;
+ m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetLayerAnimatedOpacity(id, opacity));
+}
+
+void LayerTreeCoordinator::setLayerAnimatedTransform(WebLayerID id, const TransformationMatrix& transform)
+{
+ m_shouldSyncFrame = true;
+ m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetLayerAnimatedTransform(id, transform));
+}
+
void LayerTreeCoordinator::setVisibleContentsRect(const IntRect& rect, float scale, const FloatPoint& trajectoryVector)
{
bool contentsRectDidChange = rect != m_visibleContentsRect;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h (124804 => 124805)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h 2012-08-06 22:30:12 UTC (rev 124804)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h 2012-08-06 23:01:06 UTC (rev 124805)
@@ -77,6 +77,8 @@
virtual void syncLayerState(WebLayerID, const WebLayerInfo&);
virtual void syncLayerChildren(WebLayerID, const Vector<WebLayerID>&);
+ virtual void setLayerAnimatedOpacity(WebLayerID, float);
+ virtual void setLayerAnimatedTransform(WebLayerID, const WebCore::TransformationMatrix&);
#if ENABLE(CSS_FILTERS)
virtual void syncLayerFilters(WebLayerID, const WebCore::FilterOperations&);
#endif