[CoordGraphics] TiledBackingStore unnecessarily tracks alpha support value
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Apr 2018 14:12:24 +0000 (14:12 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Apr 2018 14:12:24 +0000 (14:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184880

Reviewed by Michael Catanzaro.

Drop the m_supportsAlpha member from the TiledBackingStore class. The
member value was unused. TiledBackingStore::setSupportsAlpha() method
is removed.

TiledBackingStore::setSupportsAlpha() invalidated the backing store,
so CoordinatedGraphicsLayer::setContentsOpaque() now enforces the same
behavior by manually updating the m_needsDisplay struct. This means
that during the following layer flush the backing store is repainted
in its entirety.

* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
(WebCore::CoordinatedGraphicsLayer::createBackingStore):
* platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
(WebCore::TiledBackingStore::TiledBackingStore):
(WebCore::TiledBackingStore::setSupportsAlpha): Deleted.
* platform/graphics/texmap/coordinated/TiledBackingStore.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230912 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
Source/WebCore/platform/graphics/texmap/coordinated/TiledBackingStore.cpp
Source/WebCore/platform/graphics/texmap/coordinated/TiledBackingStore.h

index be8d167..8c79eaf 100644 (file)
@@ -1,3 +1,28 @@
+2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
+
+        [CoordGraphics] TiledBackingStore unnecessarily tracks alpha support value
+        https://bugs.webkit.org/show_bug.cgi?id=184880
+
+        Reviewed by Michael Catanzaro.
+
+        Drop the m_supportsAlpha member from the TiledBackingStore class. The
+        member value was unused. TiledBackingStore::setSupportsAlpha() method
+        is removed.
+
+        TiledBackingStore::setSupportsAlpha() invalidated the backing store,
+        so CoordinatedGraphicsLayer::setContentsOpaque() now enforces the same
+        behavior by manually updating the m_needsDisplay struct. This means
+        that during the following layer flush the backing store is repainted
+        in its entirety.
+
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
+        (WebCore::CoordinatedGraphicsLayer::createBackingStore):
+        * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
+        (WebCore::TiledBackingStore::TiledBackingStore):
+        (WebCore::TiledBackingStore::setSupportsAlpha): Deleted.
+        * platform/graphics/texmap/coordinated/TiledBackingStore.h:
+
 2018-04-23  Thibault Saunier  <tsaunier@igalia.com>
 
         [GStreamer] Start implementing Audio/VideoTrackPrivateGSTreamer::kind method
index ac17a36..0c49f45 100644 (file)
@@ -313,12 +313,19 @@ void CoordinatedGraphicsLayer::setContentsOpaque(bool b)
 {
     if (contentsOpaque() == b)
         return;
-    if (m_mainBackingStore)
-        m_mainBackingStore->setSupportsAlpha(!b);
+
     GraphicsLayer::setContentsOpaque(b);
     m_layerState.contentsOpaque = b;
     m_layerState.flagsChanged = true;
 
+    // Demand a repaint of the whole layer.
+    if (!m_needsDisplay.completeLayer) {
+        m_needsDisplay.completeLayer = true;
+        m_needsDisplay.rects.clear();
+
+        addRepaintRect({ { }, m_size });
+    }
+
     didChangeLayerState();
 }
 
@@ -846,7 +853,6 @@ void CoordinatedGraphicsLayer::adjustContentsScale()
 void CoordinatedGraphicsLayer::createBackingStore()
 {
     m_mainBackingStore = std::make_unique<TiledBackingStore>(*this, effectiveContentsScale());
-    m_mainBackingStore->setSupportsAlpha(!contentsOpaque());
 }
 
 void CoordinatedGraphicsLayer::tiledBackingStoreHasPendingTileCreation()
index dee49c8..e0b0102 100644 (file)
@@ -41,7 +41,6 @@ TiledBackingStore::TiledBackingStore(TiledBackingStoreClient& client, float cont
     , m_tileSize(defaultTileDimension, defaultTileDimension)
     , m_coverAreaMultiplier(2.0f)
     , m_contentsScale(contentsScale)
-    , m_supportsAlpha(false)
     , m_pendingTileCreation(false)
 {
 }
@@ -394,14 +393,6 @@ Tile::Coordinate TiledBackingStore::tileCoordinateForPoint(const IntPoint& point
     return Tile::Coordinate(std::max(x, 0), std::max(y, 0));
 }
 
-void TiledBackingStore::setSupportsAlpha(bool a)
-{
-    if (a == m_supportsAlpha)
-        return;
-    m_supportsAlpha = a;
-    invalidate(m_rect);
-}
-
 }
 
 #endif
index 5d83181..75faee6 100644 (file)
@@ -62,8 +62,6 @@ public:
     bool visibleAreaIsCovered() const;
     void removeAllNonVisibleTiles(const IntRect& unscaledVisibleRect, const IntRect& contentsRect);
 
-    void setSupportsAlpha(bool);
-
 private:
     void createTiles(const IntRect& visibleRect, const IntRect& scaledContentsRect, float coverAreaMultiplier);
     void computeCoverAndKeepRect(const IntRect& visibleRect, IntRect& coverRect, IntRect& keepRect) const;
@@ -96,7 +94,6 @@ private:
 
     float m_contentsScale;
 
-    bool m_supportsAlpha;
     bool m_pendingTileCreation;
 
     friend class Tile;