[TexMap] Flickering after transitions on Apple HTML5 demo
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2013 14:39:22 +0000 (14:39 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2013 14:39:22 +0000 (14:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=102501

Patch by Alexander Paschenko <alexander.pashenko@lge.com> on 2013-01-25
Reviewed by Noam Rosenthal.

The problem is caused by inconsistent state of TextureMapperLayer's transformation matrix
and opacity data during and after the end of animation.
This patch solves the problem by introducing three additional private flags
to TextureMapperLayer:
m_shouldUpdateCurrentTransformFromGraphicsLayer,
m_shouldUpdateCurrentOpacityFromGraphicsLayer, and
m_shouldUpdateCurrentFiltersFromGraphicsLayer.
The latter has been introduced in order to avoid similar future problems
with m_currentFilters.
On these flags' basis, TextureMapperLayer is able to decide whether to update
its inner state or not.
These flags themselves are set based on GraphicsLayerTextureMapper's changeMask
which indicates what details of the state have been changed since the last sync.

No new tests - this doesn't expose any testable surface.
Eyes-only check has been made to ensure that the problem is gone now.

* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::setAnimatedTransform):
sets m_shouldUpdateCurrentTransformFromGraphicsLayer to false and
updates m_currentTransform based on the updated state from GraphicsLayerAnimation.
(WebCore):
(WebCore::TextureMapperLayer::setAnimatedOpacity):
sets m_shouldUpdateCurrentOpacityFromGraphicsLayer to false and
updates m_currentOpacity based on the updated state from GraphicsLayerAnimation.
(WebCore::TextureMapperLayer::setAnimatedFilters):
sets m_shouldUpdateCurrentFiltersFromGraphicsLayer to false and
updates m_currentFilters based on the updated state from GraphicsLayerAnimation.
(WebCore::TextureMapperLayer::flushCompositingStateForThisLayerOnly):
sets m_shouldUpdateCurrent* flags based on GLTM's changeMask. Also illegal modification
of m_currentTransform that caused flickering has been removed from this method.
(WebCore::TextureMapperLayer::syncAnimations): updates m_currentTransform and/or
m_currentOpacity and/or m_currentFilters if corresponding flags allow to do so.
* platform/graphics/texmap/TextureMapperLayer.h:
(WebCore::TextureMapperLayer::TextureMapperLayer): aforementioned flags
get initialized in ctor.
(TextureMapperLayer): aforementioned flags are declared in the class.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140825 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h

index 20d0a92fe67977d724bba1a48a6948f4b33b823e..5e3f2e160285f3e6cbe8900e116989044c6f1860 100644 (file)
@@ -1,3 +1,49 @@
+2013-01-25  Alexander Paschenko  <alexander.pashenko@lge.com>
+
+        [TexMap] Flickering after transitions on Apple HTML5 demo
+        https://bugs.webkit.org/show_bug.cgi?id=102501
+
+        Reviewed by Noam Rosenthal.
+
+        The problem is caused by inconsistent state of TextureMapperLayer's transformation matrix
+        and opacity data during and after the end of animation.
+        This patch solves the problem by introducing three additional private flags
+        to TextureMapperLayer:
+        m_shouldUpdateCurrentTransformFromGraphicsLayer,
+        m_shouldUpdateCurrentOpacityFromGraphicsLayer, and
+        m_shouldUpdateCurrentFiltersFromGraphicsLayer.
+        The latter has been introduced in order to avoid similar future problems
+        with m_currentFilters.
+        On these flags' basis, TextureMapperLayer is able to decide whether to update
+        its inner state or not.
+        These flags themselves are set based on GraphicsLayerTextureMapper's changeMask
+        which indicates what details of the state have been changed since the last sync.
+
+        No new tests - this doesn't expose any testable surface.
+        Eyes-only check has been made to ensure that the problem is gone now.
+
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperLayer::setAnimatedTransform):
+        sets m_shouldUpdateCurrentTransformFromGraphicsLayer to false and
+        updates m_currentTransform based on the updated state from GraphicsLayerAnimation.
+        (WebCore):
+        (WebCore::TextureMapperLayer::setAnimatedOpacity):
+        sets m_shouldUpdateCurrentOpacityFromGraphicsLayer to false and
+        updates m_currentOpacity based on the updated state from GraphicsLayerAnimation.
+        (WebCore::TextureMapperLayer::setAnimatedFilters):
+        sets m_shouldUpdateCurrentFiltersFromGraphicsLayer to false and
+        updates m_currentFilters based on the updated state from GraphicsLayerAnimation.
+        (WebCore::TextureMapperLayer::flushCompositingStateForThisLayerOnly):
+        sets m_shouldUpdateCurrent* flags based on GLTM's changeMask. Also illegal modification
+        of m_currentTransform that caused flickering has been removed from this method.
+        (WebCore::TextureMapperLayer::syncAnimations): updates m_currentTransform and/or
+        m_currentOpacity and/or m_currentFilters if corresponding flags allow to do so.
+        * platform/graphics/texmap/TextureMapperLayer.h:
+        (WebCore::TextureMapperLayer::TextureMapperLayer): aforementioned flags
+        get initialized in ctor.
+        (TextureMapperLayer): aforementioned flags are declared in the class.
+
+
 2013-01-25  Marja Hölttä  <marja@chromium.org>
 
         Refactor InspectorMemoryAgent: memory data as a map.
index 8e80b1942359fbc8ca60d813fb97316f33915642..f94c16d1091c78f0e6e382b90c3b6f9ef06d03d3 100644 (file)
@@ -296,7 +296,25 @@ void TextureMapperLayer::paintSelfAndChildrenWithReplica(const TextureMapperPain
     paintSelfAndChildren(options);
 }
 
+void TextureMapperLayer::setAnimatedTransform(const TransformationMatrix& matrix)
+{
+    m_shouldUpdateCurrentTransformFromGraphicsLayer = false;
+    m_currentTransform.setLocalTransform(matrix);
+}
+
+void TextureMapperLayer::setAnimatedOpacity(float opacity)
+{
+    m_shouldUpdateCurrentOpacityFromGraphicsLayer = false;
+    m_currentOpacity = opacity;
+}
+
 #if ENABLE(CSS_FILTERS)
+void TextureMapperLayer::setAnimatedFilters(const FilterOperations& filters)
+{
+    m_shouldUpdateCurrentFiltersFromGraphicsLayer = false;
+    m_currentFilters = filters;
+}
+
 static bool shouldKeepContentTexture(const FilterOperations& filters)
 {
     for (size_t i = 0; i < filters.size(); ++i) {
@@ -407,6 +425,17 @@ void TextureMapperLayer::flushCompositingStateForThisLayerOnly(GraphicsLayerText
 
     if (changeMask & AnimationChange)
         m_animations = graphicsLayer->m_animations;
+    
+    if (changeMask & TransformChange)
+        m_shouldUpdateCurrentTransformFromGraphicsLayer = true;
+
+    if (changeMask & OpacityChange)
+        m_shouldUpdateCurrentOpacityFromGraphicsLayer = true;
+
+#if ENABLE(CSS_FILTERS)
+    if (changeMask & FilterChange)
+        m_shouldUpdateCurrentFiltersFromGraphicsLayer = true;
+#endif
 
     if (changeMask & RepaintCountChange)
         m_state.repaintCount = graphicsLayer->repaintCount();
@@ -444,7 +473,6 @@ void TextureMapperLayer::flushCompositingStateForThisLayerOnly(GraphicsLayerText
     m_currentTransform.setAnchorPoint(m_state.anchorPoint);
     m_currentTransform.setSize(m_state.size);
     m_currentTransform.setFlattening(!m_state.preserves3D);
-    m_currentTransform.setLocalTransform(m_state.transform);
     m_currentTransform.setChildrenTransform(m_state.childrenTransform);
 
     syncAnimations();
@@ -519,13 +547,14 @@ void TextureMapperLayer::applyAnimationsRecursively()
 void TextureMapperLayer::syncAnimations()
 {
     m_animations.apply(this);
-    if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitTransform))
-        setAnimatedTransform(m_state.transform);
-    if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity))
-        setAnimatedOpacity(m_state.opacity);
+    if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitTransform) && m_shouldUpdateCurrentTransformFromGraphicsLayer)
+        m_currentTransform.setLocalTransform(m_state.transform);
+    if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity) && m_shouldUpdateCurrentOpacityFromGraphicsLayer)
+        m_currentOpacity = m_state.opacity;
+
 #if ENABLE(CSS_FILTERS)
-    if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitFilter))
-        setAnimatedFilters(m_state.filters);
+    if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitFilter) && m_shouldUpdateCurrentFiltersFromGraphicsLayer)
+        m_currentFilters = m_state.filters;
 #endif
 }
 
index 575bb27eb7a874c184b581ed2bd435d1015a83b1..e5be2b1abd5cd6fc89cae2b5659201245f795f83 100644 (file)
@@ -83,6 +83,11 @@ public:
         , m_contentsLayer(0)
         , m_currentOpacity(1)
         , m_centerZ(0)
+        , m_shouldUpdateCurrentTransformFromGraphicsLayer(true)
+        , m_shouldUpdateCurrentOpacityFromGraphicsLayer(true)
+#if ENABLE(CSS_FILTERS)
+        , m_shouldUpdateCurrentFiltersFromGraphicsLayer(true)
+#endif
         , m_textureMapper(0)
     { }
 
@@ -127,10 +132,10 @@ private:
     void paintSelfAndChildrenWithReplica(const TextureMapperPaintOptions&);
 
     // GraphicsLayerAnimation::Client
-    virtual void setAnimatedTransform(const TransformationMatrix& matrix) OVERRIDE { m_currentTransform.setLocalTransform(matrix); }
-    virtual void setAnimatedOpacity(float opacity) OVERRIDE { m_currentOpacity = opacity; }
+    virtual void setAnimatedTransform(const TransformationMatrix&) OVERRIDE;
+    virtual void setAnimatedOpacity(float) OVERRIDE;
 #if ENABLE(CSS_FILTERS)
-    virtual void setAnimatedFilters(const FilterOperations& filters) OVERRIDE { m_currentFilters = filters; }
+    virtual void setAnimatedFilters(const FilterOperations&) OVERRIDE;
 #endif
 
     void syncAnimations();
@@ -160,6 +165,12 @@ private:
     FilterOperations m_currentFilters;
 #endif
     float m_centerZ;
+    
+    bool m_shouldUpdateCurrentTransformFromGraphicsLayer;
+    bool m_shouldUpdateCurrentOpacityFromGraphicsLayer;
+#if ENABLE(CSS_FILTERS)
+    bool m_shouldUpdateCurrentFiltersFromGraphicsLayer;
+#endif
 
     struct State {
         FloatPoint pos;