Title: [272141] trunk/Source/WebCore
Revision
272141
Author
[email protected]
Date
2021-02-01 05:33:22 -0800 (Mon, 01 Feb 2021)

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.

Don't create BackingStores for layers that are invisible: they have their CSS opacity property
to 0 or they have an opacity filter with value 0.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (272140 => 272141)


--- trunk/Source/WebCore/ChangeLog	2021-02-01 12:43:39 UTC (rev 272140)
+++ trunk/Source/WebCore/ChangeLog	2021-02-01 13:33:22 UTC (rev 272141)
@@ -1,3 +1,16 @@
+2021-02-01  Miguel Gomez  <[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.
+
+        Don't create BackingStores for layers that are invisible: they have their CSS opacity property
+        to 0 or they have an opacity filter with value 0.
+
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const):
+
 2021-02-01  Xabier Rodriguez Calvar  <[email protected]>
 
         [GStreamer][EME][Thunder] Add video/x-vp9 as supported for cenc and cbcs

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


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2021-02-01 12:43:39 UTC (rev 272140)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2021-02-01 13:33:22 UTC (rev 272141)
@@ -1346,8 +1346,18 @@
 
 bool CoordinatedGraphicsLayer::shouldHaveBackingStore() const
 {
-    return drawsContent() && contentsAreVisible() && !m_size.isEmpty()
-        && (!!opacity() || m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity));
+    // If the CSS opacity value is 0 and there's no animation over the opacity property, the layer is invisible.
+    bool isInvisibleBecauseOpacityZero = !opacity() && !m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity);
+
+    // Check if there's a filter that sets the opacity to zero.
+    bool hasOpacityZeroFilter = notFound != filters().operations().findMatching([&](const auto& operation) {
+        return operation->type() == FilterOperation::OperationType::OPACITY && !downcast<BasicComponentTransferFilterOperation>(*operation).amount();
+    });
+
+    // If there's a filter that sets opacity to 0 and the filters are not being animated, the layer is invisible.
+    isInvisibleBecauseOpacityZero |= hasOpacityZeroFilter && !m_animations.hasActiveAnimationsOfType(AnimatedPropertyFilter);
+
+    return drawsContent() && contentsAreVisible() && !m_size.isEmpty() && !isInvisibleBecauseOpacityZero;
 }
 
 bool CoordinatedGraphicsLayer::selfOrAncestorHasActiveTransformAnimation() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to