Title: [140825] trunk/Source/WebCore
Revision
140825
Author
[email protected]
Date
2013-01-25 06:39:22 -0800 (Fri, 25 Jan 2013)

Log Message

[TexMap] Flickering after transitions on Apple HTML5 demo
https://bugs.webkit.org/show_bug.cgi?id=102501

Patch by Alexander Paschenko <[email protected]> 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140824 => 140825)


--- trunk/Source/WebCore/ChangeLog	2013-01-25 14:38:35 UTC (rev 140824)
+++ trunk/Source/WebCore/ChangeLog	2013-01-25 14:39:22 UTC (rev 140825)
@@ -1,3 +1,49 @@
+2013-01-25  Alexander Paschenko  <[email protected]>
+
+        [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ä  <[email protected]>
 
         Refactor InspectorMemoryAgent: memory data as a map.

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (140824 => 140825)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2013-01-25 14:38:35 UTC (rev 140824)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2013-01-25 14:39:22 UTC (rev 140825)
@@ -296,7 +296,25 @@
     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,7 +425,18 @@
 
     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 @@
     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::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
 }
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (140824 => 140825)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2013-01-25 14:38:35 UTC (rev 140824)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2013-01-25 14:39:22 UTC (rev 140825)
@@ -83,6 +83,11 @@
         , 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 @@
     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 @@
     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;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to