Title: [153875] trunk/Source/WebCore
Revision
153875
Author
[email protected]
Date
2013-08-08 19:40:10 -0700 (Thu, 08 Aug 2013)

Log Message

Fix ASSERT(m_contentsSolidColor.isValid()) assertion on iOS at nytimes.com
https://bugs.webkit.org/show_bug.cgi?id=119603

Reviewed by Dean Jackson.

On iOS it's possible for a GraphicsLayer to transition between having
a solid background color, and containing media. This happens on nytimes.com
when playing video.

In this case, GraphicsLayerCA::updateContentsColorLayer() would assert
because m_contentsLayer had been already set up to contain media, but
it would be trying to update the color.

Fix by bailing from all the updateContents* functions if there is no
contents layer, or that layer exists for a different purpose.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateContentsMediaLayer):
(WebCore::GraphicsLayerCA::updateContentsCanvasLayer):
(WebCore::GraphicsLayerCA::updateContentsColorLayer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (153874 => 153875)


--- trunk/Source/WebCore/ChangeLog	2013-08-09 02:12:02 UTC (rev 153874)
+++ trunk/Source/WebCore/ChangeLog	2013-08-09 02:40:10 UTC (rev 153875)
@@ -1,3 +1,26 @@
+2013-08-08  Simon Fraser  <[email protected]>
+
+        Fix ASSERT(m_contentsSolidColor.isValid()) assertion on iOS at nytimes.com
+        https://bugs.webkit.org/show_bug.cgi?id=119603
+
+        Reviewed by Dean Jackson.
+
+        On iOS it's possible for a GraphicsLayer to transition between having
+        a solid background color, and containing media. This happens on nytimes.com
+        when playing video.
+        
+        In this case, GraphicsLayerCA::updateContentsColorLayer() would assert
+        because m_contentsLayer had been already set up to contain media, but
+        it would be trying to update the color.
+        
+        Fix by bailing from all the updateContents* functions if there is no
+        contents layer, or that layer exists for a different purpose.
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::updateContentsMediaLayer):
+        (WebCore::GraphicsLayerCA::updateContentsCanvasLayer):
+        (WebCore::GraphicsLayerCA::updateContentsColorLayer):
+
 2013-08-08  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r153847.

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (153874 => 153875)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2013-08-09 02:12:02 UTC (rev 153874)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2013-08-09 02:40:10 UTC (rev 153875)
@@ -1727,37 +1727,40 @@
 
 void GraphicsLayerCA::updateContentsMediaLayer()
 {
+    if (!m_contentsLayer || m_contentsLayerPurpose != ContentsLayerForMedia)
+        return;
+
     // Video layer was set as m_contentsLayer, and will get parented in updateSublayerList().
-    if (m_contentsLayer) {
-        setupContentsLayer(m_contentsLayer.get());
-        updateContentsRect();
-    }
+    setupContentsLayer(m_contentsLayer.get());
+    updateContentsRect();
 }
 
 void GraphicsLayerCA::updateContentsCanvasLayer()
 {
+    if (!m_contentsLayer || m_contentsLayerPurpose != ContentsLayerForCanvas)
+        return;
+
     // CanvasLayer was set as m_contentsLayer, and will get parented in updateSublayerList().
-    if (m_contentsLayer) {
-        setupContentsLayer(m_contentsLayer.get());
-        m_contentsLayer->setNeedsDisplay();
-        updateContentsRect();
-    }
+    setupContentsLayer(m_contentsLayer.get());
+    m_contentsLayer->setNeedsDisplay();
+    updateContentsRect();
 }
 
 void GraphicsLayerCA::updateContentsColorLayer()
 {
     // Color layer was set as m_contentsLayer, and will get parented in updateSublayerList().
-    if (m_contentsLayer) {
-        setupContentsLayer(m_contentsLayer.get());
-        updateContentsRect();
-        ASSERT(m_contentsSolidColor.isValid()); // An invalid color should have removed the contents layer.
-        m_contentsLayer->setBackgroundColor(m_contentsSolidColor);
+    if (!m_contentsLayer || m_contentsLayerPurpose != ContentsLayerForBackgroundColor)
+        return;
 
-        if (m_contentsLayerClones) {
-            LayerMap::const_iterator end = m_contentsLayerClones->end();
-            for (LayerMap::const_iterator it = m_contentsLayerClones->begin(); it != end; ++it)
-                it->value->setBackgroundColor(m_contentsSolidColor);
-        }
+    setupContentsLayer(m_contentsLayer.get());
+    updateContentsRect();
+    ASSERT(m_contentsSolidColor.isValid());
+    m_contentsLayer->setBackgroundColor(m_contentsSolidColor);
+
+    if (m_contentsLayerClones) {
+        LayerMap::const_iterator end = m_contentsLayerClones->end();
+        for (LayerMap::const_iterator it = m_contentsLayerClones->begin(); it != end; ++it)
+            it->value->setBackgroundColor(m_contentsSolidColor);
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to