Title: [230950] trunk/Source
Revision
230950
Author
[email protected]
Date
2018-04-24 01:15:41 -0700 (Tue, 24 Apr 2018)

Log Message

[CoordGraphics] Avoid painting backing stores for zero-opacity layers
https://bugs.webkit.org/show_bug.cgi?id=184143

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Skip generating backing stores for layers that have zero opacity and do
not animate the opacity value. In the current CoordinatedGraphics system
this can end up saving loads of memory on Web content that deploys a
large number of such elements.

* platform/graphics/texmap/TextureMapperLayer.h:
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const):

Source/WebKit:

* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
(WebKit::layerShouldHaveBackingStore):
Mirror CoordinatedGraphicsLayer's backing store requirements.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (230949 => 230950)


--- trunk/Source/WebCore/ChangeLog	2018-04-24 08:06:56 UTC (rev 230949)
+++ trunk/Source/WebCore/ChangeLog	2018-04-24 08:15:41 UTC (rev 230950)
@@ -1,3 +1,19 @@
+2018-04-24  Zan Dobersek  <[email protected]>
+
+        [CoordGraphics] Avoid painting backing stores for zero-opacity layers
+        https://bugs.webkit.org/show_bug.cgi?id=184143
+
+        Reviewed by Carlos Garcia Campos.
+
+        Skip generating backing stores for layers that have zero opacity and do
+        not animate the opacity value. In the current CoordinatedGraphics system
+        this can end up saving loads of memory on Web content that deploys a
+        large number of such elements.
+
+        * platform/graphics/texmap/TextureMapperLayer.h:
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const):
+
 2018-04-24  Daniel Bates  <[email protected]>
 
         Attempt to fix the Apple Internal build following r230944

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (230949 => 230950)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2018-04-24 08:06:56 UTC (rev 230949)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2018-04-24 08:15:41 UTC (rev 230950)
@@ -87,6 +87,7 @@
     void setRepaintCount(int);
     void setContentsLayer(TextureMapperPlatformLayer*);
     void setAnimations(const TextureMapperAnimations&);
+    const TextureMapperAnimations& animations() const { return m_animations; }
     void setFixedToViewport(bool);
     bool fixedToViewport() const { return m_fixedToViewport; }
     void setBackingStore(TextureMapperBackingStore*);

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (230949 => 230950)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2018-04-24 08:06:56 UTC (rev 230949)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2018-04-24 08:15:41 UTC (rev 230950)
@@ -1098,7 +1098,8 @@
 
 bool CoordinatedGraphicsLayer::shouldHaveBackingStore() const
 {
-    return drawsContent() && contentsAreVisible() && !m_size.isEmpty();
+    return drawsContent() && contentsAreVisible() && !m_size.isEmpty()
+        && (!!opacity() || m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity));
 }
 
 bool CoordinatedGraphicsLayer::selfOrAncestorHasActiveTransformAnimation() const

Modified: trunk/Source/WebKit/ChangeLog (230949 => 230950)


--- trunk/Source/WebKit/ChangeLog	2018-04-24 08:06:56 UTC (rev 230949)
+++ trunk/Source/WebKit/ChangeLog	2018-04-24 08:15:41 UTC (rev 230950)
@@ -1,3 +1,14 @@
+2018-04-24  Zan Dobersek  <[email protected]>
+
+        [CoordGraphics] Avoid painting backing stores for zero-opacity layers
+        https://bugs.webkit.org/show_bug.cgi?id=184143
+
+        Reviewed by Carlos Garcia Campos.
+
+        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
+        (WebKit::layerShouldHaveBackingStore):
+        Mirror CoordinatedGraphicsLayer's backing store requirements.
+
 2018-04-23  Daniel Bates  <[email protected]>
 
         Implement Same-Site cookies

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp (230949 => 230950)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp	2018-04-24 08:06:56 UTC (rev 230949)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp	2018-04-24 08:15:41 UTC (rev 230950)
@@ -37,7 +37,8 @@
 
 static bool layerShouldHaveBackingStore(TextureMapperLayer* layer)
 {
-    return layer->drawsContent() && layer->contentsAreVisible() && !layer->size().isEmpty();
+    return layer->drawsContent() && layer->contentsAreVisible() && !layer->size().isEmpty()
+        && (!!layer->opacity() || layer->animations().hasActiveAnimationsOfType(AnimatedPropertyOpacity));
 }
 
 CoordinatedGraphicsScene::CoordinatedGraphicsScene(CoordinatedGraphicsSceneClient* client)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to