diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
commit | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch) | |
tree | 24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp | |
parent | 69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff) | |
download | qtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz |
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp index 82e58f3f2..bd92f7249 100644 --- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp +++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp @@ -88,6 +88,10 @@ LayerTreeRenderer::LayerTreeRenderer(LayerTreeCoordinatorProxy* layerTreeCoordin : m_layerTreeCoordinatorProxy(layerTreeCoordinatorProxy) , m_rootLayerID(InvalidWebLayerID) , m_isActive(false) + , m_animationsLocked(false) +#if ENABLE(REQUEST_ANIMATION_FRAME) + , m_animationFrameRequested(false) +#endif { } @@ -120,6 +124,8 @@ void LayerTreeRenderer::paintToCurrentGLContext(const TransformationMatrix& matr return; layer->setTextureMapper(m_textureMapper.get()); + if (!m_animationsLocked) + layer->applyAnimationsRecursively(); m_textureMapper->beginPainting(PaintFlags); m_textureMapper->beginClip(TransformationMatrix(), clipRect); @@ -132,8 +138,31 @@ void LayerTreeRenderer::paintToCurrentGLContext(const TransformationMatrix& matr layer->paint(); m_textureMapper->endClip(); m_textureMapper->endPainting(); + + if (layer->descendantsOrSelfHaveRunningAnimations()) + dispatchOnMainThread(bind(&LayerTreeRenderer::updateViewport, this)); + +#if ENABLE(REQUEST_ANIMATION_FRAME) + if (m_animationFrameRequested) { + m_animationFrameRequested = false; + dispatchOnMainThread(bind(&LayerTreeRenderer::animationFrameReady, this)); + } +#endif +} + +#if ENABLE(REQUEST_ANIMATION_FRAME) +void LayerTreeRenderer::animationFrameReady() +{ + if (m_layerTreeCoordinatorProxy) + m_layerTreeCoordinatorProxy->animationFrameReady(); } +void LayerTreeRenderer::requestAnimationFrame() +{ + m_animationFrameRequested = true; +} +#endif + void LayerTreeRenderer::paintToGraphicsContext(BackingStore::PlatformGraphicsContext painter) { if (!m_textureMapper) @@ -393,6 +422,9 @@ void LayerTreeRenderer::flushLayerChanges() { m_renderedContentsScrollPosition = m_pendingRenderedContentsScrollPosition; + // Since the frame has now been rendered, we can safely unlock the animations until the next layout. + setAnimationsLocked(false); + m_rootLayer->flushCompositingState(FloatRect()); commitTileOperations(); @@ -430,8 +462,16 @@ void LayerTreeRenderer::syncRemoteContent() // We enqueue messages and execute them during paint, as they require an active GL context. ensureRootLayer(); - for (size_t i = 0; i < m_renderQueue.size(); ++i) - m_renderQueue[i](); + Vector<Function<void()> > renderQueue; + bool calledOnMainThread = WTF::isMainThread(); + if (!calledOnMainThread) + m_renderQueueMutex.lock(); + renderQueue.swap(m_renderQueue); + if (!calledOnMainThread) + m_renderQueueMutex.unlock(); + + for (size_t i = 0; i < renderQueue.size(); ++i) + renderQueue[i](); m_renderQueue.clear(); } @@ -461,20 +501,17 @@ void LayerTreeRenderer::purgeGLResources() dispatchOnMainThread(bind(&LayerTreeRenderer::purgeBackingStores, this)); } -void LayerTreeRenderer::setAnimatedOpacity(uint32_t id, float opacity) +void LayerTreeRenderer::setLayerAnimations(WebLayerID id, const GraphicsLayerAnimations& animations) { - GraphicsLayer* layer = layerByID(id); - ASSERT(layer); - - layer->setOpacity(opacity); + GraphicsLayerTextureMapper* layer = toGraphicsLayerTextureMapper(layerByID(id)); + if (!layer) + return; + layer->setAnimations(animations); } -void LayerTreeRenderer::setAnimatedTransform(uint32_t id, const WebCore::TransformationMatrix& transform) +void LayerTreeRenderer::setAnimationsLocked(bool locked) { - GraphicsLayer* layer = layerByID(id); - ASSERT(layer); - - layer->setTransform(transform); + m_animationsLocked = locked; } void LayerTreeRenderer::purgeBackingStores() @@ -493,6 +530,8 @@ void LayerTreeRenderer::appendUpdate(const Function<void()>& function) if (!m_isActive) return; + ASSERT(isMainThread()); + MutexLocker locker(m_renderQueueMutex); m_renderQueue.append(function); } |