diff --git a/gfx/layers/client/ClientTiledPaintedLayer.cpp b/gfx/layers/client/ClientTiledPaintedLayer.cpp index 806fb5678b72..01ac573fb3d7 100644 --- a/gfx/layers/client/ClientTiledPaintedLayer.cpp +++ b/gfx/layers/client/ClientTiledPaintedLayer.cpp @@ -28,7 +28,6 @@ ClientTiledPaintedLayer::ClientTiledPaintedLayer(ClientLayerManager* const aMana ClientLayerManager::PaintedLayerCreationHint aCreationHint) : PaintedLayer(aManager, static_cast(this), aCreationHint) , mContentClient() - , mHaveSingleTiledContentClient(false) { MOZ_COUNT_CTOR(ClientTiledPaintedLayer); mPaintData.mLastScrollOffset = ParentLayerPoint(0, 0); @@ -412,26 +411,18 @@ ClientTiledPaintedLayer::RenderLayer() void *data = ClientManager()->GetPaintedLayerCallbackData(); IntSize layerSize = mVisibleRegion.ToUnknownRegion().GetBounds().Size(); - IntSize tileSize(gfxPlatform::GetPlatform()->GetTileWidth(), - gfxPlatform::GetPlatform()->GetTileHeight()); - - bool wantSingleTiledContentClient = - (mCreationHint == LayerManager::NONE || layerSize <= tileSize) && - SingleTiledContentClient::ClientSupportsLayerSize(layerSize, ClientManager()) && - gfxPrefs::LayersSingleTileEnabled(); - - if (mContentClient && mHaveSingleTiledContentClient && !wantSingleTiledContentClient) { + if (mContentClient && !mContentClient->SupportsLayerSize(layerSize, ClientManager())) { mContentClient = nullptr; mValidRegion.SetEmpty(); } if (!mContentClient) { - if (wantSingleTiledContentClient) { + if (mCreationHint == LayerManager::NONE && + SingleTiledContentClient::ClientSupportsLayerSize(layerSize, ClientManager()) && + gfxPrefs::LayersSingleTileEnabled()) { mContentClient = new SingleTiledContentClient(this, ClientManager()); - mHaveSingleTiledContentClient = true; } else { mContentClient = new MultiTiledContentClient(this, ClientManager()); - mHaveSingleTiledContentClient = false; } mContentClient->Connect(); diff --git a/gfx/layers/client/ClientTiledPaintedLayer.h b/gfx/layers/client/ClientTiledPaintedLayer.h index f4c3f2a8a9b5..cda3867a3e04 100644 --- a/gfx/layers/client/ClientTiledPaintedLayer.h +++ b/gfx/layers/client/ClientTiledPaintedLayer.h @@ -133,9 +133,6 @@ private: void EndPaint(); RefPtr mContentClient; - // Flag to indicate if mContentClient is a SingleTiledContentClient. This is - // only valid when mContentClient is non-null. - bool mHaveSingleTiledContentClient; nsIntRegion mLowPrecisionValidRegion; BasicTiledLayerPaintData mPaintData; }; diff --git a/gfx/layers/client/SingleTiledContentClient.cpp b/gfx/layers/client/SingleTiledContentClient.cpp index bc6d636b0ced..2b9bd7d31329 100644 --- a/gfx/layers/client/SingleTiledContentClient.cpp +++ b/gfx/layers/client/SingleTiledContentClient.cpp @@ -46,6 +46,12 @@ SingleTiledContentClient::ClientSupportsLayerSize(const gfx::IntSize& aSize, Cli return aSize.width <= maxTextureSize && aSize.height <= maxTextureSize; } +bool +SingleTiledContentClient::SupportsLayerSize(const gfx::IntSize& aSize, ClientLayerManager* aManager) const +{ + return ClientSupportsLayerSize(aSize, aManager); +} + ClientSingleTiledLayerBuffer::ClientSingleTiledLayerBuffer(ClientTiledPaintedLayer* aPaintedLayer, CompositableClient* aCompositableClient, ClientLayerManager* aManager) diff --git a/gfx/layers/client/SingleTiledContentClient.h b/gfx/layers/client/SingleTiledContentClient.h index 2486f83cea58..e2869976af5b 100644 --- a/gfx/layers/client/SingleTiledContentClient.h +++ b/gfx/layers/client/SingleTiledContentClient.h @@ -127,6 +127,8 @@ public: virtual ClientTiledLayerBuffer* GetTiledBuffer() override { return mTiledBuffer; } virtual ClientTiledLayerBuffer* GetLowPrecisionTiledBuffer() override { return nullptr; } + virtual bool SupportsLayerSize(const gfx::IntSize& aSize, ClientLayerManager* aManager) const override; + private: RefPtr mTiledBuffer; }; diff --git a/gfx/layers/client/TiledContentClient.h b/gfx/layers/client/TiledContentClient.h index e6f31e269e91..c53b396fa3c0 100644 --- a/gfx/layers/client/TiledContentClient.h +++ b/gfx/layers/client/TiledContentClient.h @@ -628,6 +628,9 @@ public: }; virtual void UpdatedBuffer(TiledBufferType aType) = 0; + virtual bool SupportsLayerSize(const gfx::IntSize& aSize, ClientLayerManager* aManager) const + { return true; } + private: const char* mName; }; diff --git a/layout/reftests/invalidation/reftest.list b/layout/reftests/invalidation/reftest.list index 3daba5e5b55a..5a7a573bc326 100644 --- a/layout/reftests/invalidation/reftest.list +++ b/layout/reftests/invalidation/reftest.list @@ -51,7 +51,7 @@ pref(layout.animated-image-layers.enabled,true) skip-if(Android||gtkWidget) == t != clipped-animated-transform-1.html about:blank != paintedlayer-recycling-1.html about:blank != paintedlayer-recycling-2.html about:blank -pref(layers.single-tile.enabled,false) != paintedlayer-recycling-3.html about:blank +!= paintedlayer-recycling-3.html about:blank != paintedlayer-recycling-4.html about:blank != paintedlayer-recycling-5.html about:blank != paintedlayer-recycling-6.html about:blank @@ -67,7 +67,7 @@ pref(layers.single-tile.enabled,false) != paintedlayer-recycling-3.html about:bl != layer-splitting-7.html about:blank fuzzy-if(gtkWidget,2,4) fuzzy-if(asyncPan,2,3955) fuzzy-if(OSX,179,30) == image-scrolling-zoom-1.html image-scrolling-zoom-1-ref.html != image-scrolling-zoom-1-ref.html image-scrolling-zoom-1-notref.html -pref(layers.single-tile.enabled,false) != fast-scrolling.html about:blank +!= fast-scrolling.html about:blank != fractional-transform-1.html about:blank != fractional-transform-2.html about:blank != fractional-transform-3.html about:blank diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 758d9f580106..1082106d72d5 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4379,7 +4379,6 @@ pref("layers.draw-tile-borders", false); pref("layers.draw-bigimage-borders", false); pref("layers.frame-counter", false); pref("layers.enable-tiles", false); -pref("layers.single-tile.enabled", true); pref("layers.tiled-drawtarget.enabled", false); pref("layers.low-precision-buffer", false); pref("layers.progressive-paint", false);