2010-04-23  Simon Fraser  <simon.fraser@apple.com>

        Reviewed by Dan Bernstein.

        ASSERT(willBeComposited == needsToBeComposited(layer)); on gmail.com
        https://bugs.webkit.org/show_bug.cgi?id=38066

        When a layer goes into compositing mode because it has a negative z-index child that is going
        into compositing mode, then set willBeComposited to true. Also add another assertion to catch
        any other cases where the state of willBeComposited is mismanaged.

        Test: compositing/composited-negative-zindex-child.html

        * rendering/RenderLayerCompositor.cpp:
        (WebCore::RenderLayerCompositor::computeCompositingRequirements):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/compositing/composited-negative-zindex-child.html b/LayoutTests/compositing/composited-negative-zindex-child.html
new file mode 100644
index 0000000..5805793
--- /dev/null
+++ b/LayoutTests/compositing/composited-negative-zindex-child.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+  <style type="text/css" media="screen">
+    .box {
+      height: 100px;
+      width: 100px;
+      position: absolute;
+      z-index: 0;
+    }
+    
+    .parent {
+      border: 1px solid black;
+    }
+    
+    .child {
+      top: 10px;
+      left: 10px;
+      background-color: silver;
+      z-index: -1;
+    }
+  </style>
+  <script type="text/javascript" charset="utf-8">
+    if (window.layoutTestController)
+      layoutTestController.dumpAsText();
+
+    function doTest() {
+      document.getElementById('child').style.webkitTransform = 'translateZ(0)';
+    }
+    window.addEventListener('load', doTest, false);
+  </script>
+</head>
+<body>
+  <p>This test should not assert in debug builds.</p>
+  <div class="parent box">
+    <div id="child" class="child box"></div>
+  </div>
+</body>
+</html>