Title: [185284] trunk/Source/WebCore
Revision
185284
Author
akl...@apple.com
Date
2015-06-05 20:11:28 -0700 (Fri, 05 Jun 2015)

Log Message

[iOS] Don't force compositing layers for no-op 3D transforms on low-memory devices.
<https://webkit.org/b/145719>
<rdar://problem/19973042>

Reviewed by Geoffrey Garen.

We put elements with 3D identity transforms onto compositing layers because
we anticipate that they will somehow animate in the future.

This can get extremely expensive, especially on low-memory devices.
This patch makes WebKit stop handing out compositing layers for this kinda thing:

    -webkit-transform: translate3d(0,0,0)

..on devices with 512MB or less. This dramatically improves stability on some
web pages.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (185283 => 185284)


--- trunk/Source/WebCore/ChangeLog	2015-06-06 01:23:21 UTC (rev 185283)
+++ trunk/Source/WebCore/ChangeLog	2015-06-06 03:11:28 UTC (rev 185284)
@@ -1,3 +1,25 @@
+2015-06-05  Andreas Kling  <akl...@apple.com>
+
+        [iOS] Don't force compositing layers for no-op 3D transforms on low-memory devices.
+        <https://webkit.org/b/145719>
+        <rdar://problem/19973042>
+
+        Reviewed by Geoffrey Garen.
+
+        We put elements with 3D identity transforms onto compositing layers because
+        we anticipate that they will somehow animate in the future.
+
+        This can get extremely expensive, especially on low-memory devices.
+        This patch makes WebKit stop handing out compositing layers for this kinda thing:
+
+            -webkit-transform: translate3d(0,0,0)
+
+        ..on devices with 512MB or less. This dramatically improves stability on some
+        web pages.
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForTransform):
+
 2015-06-05  Matt Baker  <mattba...@apple.com>
 
         Web Inspector: "Other" time in the framerate table is often negative

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (185283 => 185284)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2015-06-06 01:23:21 UTC (rev 185283)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2015-06-06 03:11:28 UTC (rev 185284)
@@ -62,6 +62,7 @@
 #include "TiledBacking.h"
 #include "TransformState.h"
 #include <wtf/CurrentTime.h>
+#include <wtf/RAMSize.h>
 #include <wtf/TemporaryChange.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
@@ -2465,7 +2466,25 @@
 
     // Note that we ask the renderer if it has a transform, because the style may have transforms,
     // but the renderer may be an inline that doesn't suppport them.
-    return renderer.hasTransform() && renderer.style().transform().has3DOperation();
+    if (!renderer.hasTransform())
+        return false;
+
+    if (!renderer.style().transform().has3DOperation())
+        return false;
+
+#if PLATFORM(IOS)
+    static uint64_t ramSizeInMB = ramSize() / 1024 / 1024;
+    if (ramSizeInMB <= 512) {
+        // Special policy for low-memory devices: Don't require compositing just because there's a no-op 3D transform.
+        for (auto& transform : renderer.style().transform().operations()) {
+            if (!transform->isIdentity())
+                return true;
+        }
+        return false;
+    }
+#endif
+
+    return true;
 }
 
 bool RenderLayerCompositor::requiresCompositingForBackfaceVisibility(RenderLayerModelObject& renderer) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to