Title: [125101] trunk
Revision
125101
Author
[email protected]
Date
2012-08-08 15:17:34 -0700 (Wed, 08 Aug 2012)

Log Message

Avoid backing store on layers created for CoreAnimation plugins
https://bugs.webkit.org/show_bug.cgi?id=93526
<rdar://problem/12052828>

Reviewed by Dean Jackson.

Source/WebCore:

We create a compositing layer for <embed> objects whose plug-in supports
the CoreAnimation rendering model. When the embed's renderer is not styled,
we can avoid allocating backing store for it.

Test: compositing/plugins/no-backing-store.html

* rendering/RenderLayerBacking.cpp:
(WebCore::isCompositedPlugin):
(WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):

LayoutTests:

Test for backing store on CoreAnimation-based plugins in various
configurations.

* compositing/plugins/no-backing-store-expected.txt: Added.
* compositing/plugins/no-backing-store.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125100 => 125101)


--- trunk/LayoutTests/ChangeLog	2012-08-08 22:16:35 UTC (rev 125100)
+++ trunk/LayoutTests/ChangeLog	2012-08-08 22:17:34 UTC (rev 125101)
@@ -1,3 +1,17 @@
+2012-08-08  Simon Fraser  <[email protected]>
+
+        Avoid backing store on layers created for CoreAnimation plugins
+        https://bugs.webkit.org/show_bug.cgi?id=93526
+        <rdar://problem/12052828>
+
+        Reviewed by Dean Jackson.
+
+        Test for backing store on CoreAnimation-based plugins in various
+        configurations.
+
+        * compositing/plugins/no-backing-store-expected.txt: Added.
+        * compositing/plugins/no-backing-store.html: Added.
+
 2012-08-08  Jeff Timanus  <[email protected]>
 
         [Chromium] Updating fast/canvas/webgl/gl-teximage.html to prevent valid variations in results from causing test failures.

Added: trunk/LayoutTests/compositing/plugins/no-backing-store-expected.txt (0 => 125101)


--- trunk/LayoutTests/compositing/plugins/no-backing-store-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/plugins/no-backing-store-expected.txt	2012-08-08 22:17:34 UTC (rev 125101)
@@ -0,0 +1,26 @@
+      
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 3
+        (GraphicsLayer
+          (position 142.00 20.00)
+          (bounds 100.00 100.00)
+        )
+        (GraphicsLayer
+          (position 266.00 20.00)
+          (bounds 100.00 100.00)
+          (drawsContent 1)
+        )
+        (GraphicsLayer
+          (position 390.00 18.00)
+          (bounds 102.00 102.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/compositing/plugins/no-backing-store-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/plugins/no-backing-store.html (0 => 125101)


--- trunk/LayoutTests/compositing/plugins/no-backing-store.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/plugins/no-backing-store.html	2012-08-08 22:17:34 UTC (rev 125101)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <style type="text/css" media="screen">
+    embed {
+      margin: 10px;
+    }
+  </style>
+  <script type="text/_javascript_" charset="utf-8">
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    function doTest()
+    {
+        // Need to wait for compositing layers to be updated. FIXME remove.
+        window.setTimeout(function() {
+            if (window.testRunner) {
+                document.getElementById('layers').innerHTML = testRunner.layerTreeAsText();
+                testRunner.notifyDone();
+            }
+        }, 0)
+    }
+    window.addEventListener('load', doTest, false);
+  </script>
+</head>
+<body>
+  
+    <!-- Not layer-backed -->
+    <embed type="application/x-webkit-test-netscape" width="100" height="100">
+
+    <!-- Layer-backed, no need for backing store -->
+    <embed type="application/x-webkit-test-netscape" width="100" height="100" drawingmodel="coreanimation">
+
+    <!-- Both these need backing store -->
+    <embed style="background-color: blue;" type="application/x-webkit-test-netscape" width="100" height="100" drawingmodel="coreanimation">
+    <embed style="border: 1px solid black;" type="application/x-webkit-test-netscape" width="100" height="100" drawingmodel="coreanimation">
+
+    <pre id="layers">Layer tree appears here in DRT.</pre>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/plugins/no-backing-store.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (125100 => 125101)


--- trunk/Source/WebCore/ChangeLog	2012-08-08 22:16:35 UTC (rev 125100)
+++ trunk/Source/WebCore/ChangeLog	2012-08-08 22:17:34 UTC (rev 125101)
@@ -1,3 +1,21 @@
+2012-08-08  Simon Fraser  <[email protected]>
+
+        Avoid backing store on layers created for CoreAnimation plugins
+        https://bugs.webkit.org/show_bug.cgi?id=93526
+        <rdar://problem/12052828>
+
+        Reviewed by Dean Jackson.
+
+        We create a compositing layer for <embed> objects whose plug-in supports
+        the CoreAnimation rendering model. When the embed's renderer is not styled,
+        we can avoid allocating backing store for it.
+
+        Test: compositing/plugins/no-backing-store.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::isCompositedPlugin):
+        (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
+
 2012-08-08  Erik Arvidsson  <[email protected]>
 
         DOM4: classList should be defined on Element and not on HTMLElement

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (125100 => 125101)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-08-08 22:16:35 UTC (rev 125100)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-08-08 22:17:34 UTC (rev 125101)
@@ -895,16 +895,23 @@
     return false;
 }
 
+static bool isCompositedPlugin(RenderObject* renderer)
+{
+    return renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allowsAcceleratedCompositing();
+}
+
 // A "simple container layer" is a RenderLayer which has no visible content to render.
 // It may have no children, or all its children may be themselves composited.
 // This is a useful optimization, because it allows us to avoid allocating backing store.
 bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
 {
     RenderObject* renderObject = renderer();
-    if (renderObject->isReplaced() ||       // replaced objects are not containers
-        renderObject->hasMask())            // masks require special treatment
+    if (renderObject->hasMask()) // masks require special treatment
         return false;
 
+    if (renderObject->isReplaced() && !isCompositedPlugin(renderObject))
+            return false;
+    
     if (paintsBoxDecorations() || paintsChildren())
         return false;
     
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to