Index: LayoutTests/fast/dom/CompositorProxy/proxy-forces-layer.html |
diff --git a/LayoutTests/fast/dom/CompositorProxy/proxy-forces-layer.html b/LayoutTests/fast/dom/CompositorProxy/proxy-forces-layer.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4ecbf97fc7f542c0eeca61f1f566935de83c4aeb |
--- /dev/null |
+++ b/LayoutTests/fast/dom/CompositorProxy/proxy-forces-layer.html |
@@ -0,0 +1,43 @@ |
+<!DOCTYPE html> |
+<div id="container"></div> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<script> |
+async_test(function(test) { |
+ if (!window.internals) |
+ return; |
+ window.addEventListener('load', function() { |
+ // The container should not have a layer. |
+ var container = document.getElementById('container'); |
+ var docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
+ assert_equals(1, docLayer.children.length); |
+ assert_equals('undefined', typeof docLayer.children[0].children); |
+ |
+ // Creating a proxy should force the container to have a layer. |
+ var proxy = new CompositorProxy(container, ['opacity']); |
+ docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
+ assert_equals(1, docLayer.children.length); |
+ assert_equals(1, docLayer.children[0].children.length); |
+ |
+ // Detach the element from the document. The corresponding layer should be removed. |
+ container.parentNode.removeChild(container); |
+ docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
+ assert_equals(1, docLayer.children.length); |
+ assert_equals('undefined', typeof docLayer.children[0].children); |
+ |
+ // Add the element back to the document. The corresponding layer should reappear. |
+ document.body.appendChild(container); |
+ docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
+ assert_equals(1, docLayer.children.length); |
+ assert_equals(1, docLayer.children[0].children.length); |
+ |
+ // Disconnecting the proxy should also remove the layer. |
+ proxy.disconnect(); |
+ docLayer = JSON.parse(window.internals.layerTreeAsText(document)); |
+ assert_equals(1, docLayer.children.length); |
+ assert_equals('undefined', typeof docLayer.children[0].children); |
+ |
+ test.done(); |
+ }); |
+}, "This test checks that creating a CompositorProxy forces the element to have a layer"); |
+</script> |