Title: [96160] trunk
Revision
96160
Author
[email protected]
Date
2011-09-27 14:47:30 -0700 (Tue, 27 Sep 2011)

Log Message

Add a mechanism to test for the compositing tree mutated during painting
https://bugs.webkit.org/show_bug.cgi?id=68738

Patch by James Robinson <[email protected]> on 2011-09-27
Reviewed by Adam Barth.

Source/WebCore:

Sets a static bool during GraphicsLayer::paintGraphicsLayerContents and ASSERT()s that we never create or
destroy a GraphicsLayer inside this function. Painting should never mutate the GraphicsLayer tree.

Test: compositing/video/video-with-invalid-source.html

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer):
(WebCore::GraphicsLayer::~GraphicsLayer):
(WebCore::GraphicsLayer::paintGraphicsLayerContents):

LayoutTests:

Adds a test that caused compositing to be disabled during painting before r95863 due to a video load failing.

* compositing/video/video-with-invalid-source-expected.txt: Added.
* compositing/video/video-with-invalid-source.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96159 => 96160)


--- trunk/LayoutTests/ChangeLog	2011-09-27 21:45:54 UTC (rev 96159)
+++ trunk/LayoutTests/ChangeLog	2011-09-27 21:47:30 UTC (rev 96160)
@@ -1,3 +1,15 @@
+2011-09-27  James Robinson  <[email protected]>
+
+        Add a mechanism to test for the compositing tree mutated during painting
+        https://bugs.webkit.org/show_bug.cgi?id=68738
+
+        Reviewed by Adam Barth.
+
+        Adds a test that caused compositing to be disabled during painting before r95863 due to a video load failing.
+
+        * compositing/video/video-with-invalid-source-expected.txt: Added.
+        * compositing/video/video-with-invalid-source.html: Added.
+
 2011-09-27  Ojan Vafai  <[email protected]>
 
         take padding/border on flexbox into account with direction:rtl

Added: trunk/LayoutTests/compositing/video/video-with-invalid-source-expected.txt (0 => 96160)


--- trunk/LayoutTests/compositing/video/video-with-invalid-source-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/video/video-with-invalid-source-expected.txt	2011-09-27 21:47:30 UTC (rev 96160)
@@ -0,0 +1 @@
+PASS

Added: trunk/LayoutTests/compositing/video/video-with-invalid-source.html (0 => 96160)


--- trunk/LayoutTests/compositing/video/video-with-invalid-source.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/video/video-with-invalid-source.html	2011-09-27 21:47:30 UTC (rev 96160)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.waitUntilDone();
+    layoutTestController.dumpAsText();
+}
+
+function test() {
+    var v = document.createElement("video");
+    document.body.appendChild(v);
+    var src = ""
+    src.src = ""
+    v.appendChild(src);
+    src.addEventListener("error", function() {
+       if (window.layoutTestController) {
+            layoutTestController.display();
+            // If we didn't crash here, yay!  Test is a success
+            document.body.appendChild(document.createTextNode("PASS"));
+            layoutTestController.notifyDone();
+        }
+    }, false);
+}
+</script>
+<body _onload_="test()">
+</body>

Modified: trunk/Source/WebCore/ChangeLog (96159 => 96160)


--- trunk/Source/WebCore/ChangeLog	2011-09-27 21:45:54 UTC (rev 96159)
+++ trunk/Source/WebCore/ChangeLog	2011-09-27 21:47:30 UTC (rev 96160)
@@ -1,3 +1,20 @@
+2011-09-27  James Robinson  <[email protected]>
+
+        Add a mechanism to test for the compositing tree mutated during painting
+        https://bugs.webkit.org/show_bug.cgi?id=68738
+
+        Reviewed by Adam Barth.
+
+        Sets a static bool during GraphicsLayer::paintGraphicsLayerContents and ASSERT()s that we never create or
+        destroy a GraphicsLayer inside this function. Painting should never mutate the GraphicsLayer tree.
+
+        Test: compositing/video/video-with-invalid-source.html
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::GraphicsLayer):
+        (WebCore::GraphicsLayer::~GraphicsLayer):
+        (WebCore::GraphicsLayer::paintGraphicsLayerContents):
+
 2011-09-27  Ojan Vafai  <[email protected]>
 
         take padding/border on flexbox into account with direction:rtl

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (96159 => 96160)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2011-09-27 21:45:54 UTC (rev 96159)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2011-09-27 21:47:30 UTC (rev 96160)
@@ -61,6 +61,10 @@
     m_values.append(value);
 }
 
+#ifndef NDEBUG
+static bool s_inPaintContents = false;
+#endif
+
 GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client)
     : m_client(client)
     , m_anchorPoint(0.5f, 0.5f, 0)
@@ -84,10 +88,12 @@
     , m_replicatedLayer(0)
     , m_repaintCount(0)
 {
+    ASSERT(!s_inPaintContents);
 }
 
 GraphicsLayer::~GraphicsLayer()
 {
+    ASSERT(!s_inPaintContents);
     removeAllChildren();
     removeFromParent();
 }
@@ -268,8 +274,14 @@
 
 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const IntRect& clip)
 {
+#ifndef NDEBUG
+    s_inPaintContents = true;
+#endif
     if (m_client)
         m_client->paintContents(this, context, m_paintingPhase, clip);
+#ifndef NDEBUG
+    s_inPaintContents = false;
+#endif
 }
 
 String GraphicsLayer::animationNameForTransition(AnimatedPropertyID property)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to