Bug 1243589 - Use SingleTiledContentClient even for scrollable layers if the layer is smaller than a single tile. r=mattwoodrow

MozReview-Commit-ID: 6eYFmoOVL6b
This commit is contained in:
Kartikaya Gupta 2016-02-12 08:29:25 -05:00
parent d6d11394c4
commit c56aaf55e1
10 changed files with 47 additions and 24 deletions

View File

@ -28,6 +28,7 @@ ClientTiledPaintedLayer::ClientTiledPaintedLayer(ClientLayerManager* const aMana
ClientLayerManager::PaintedLayerCreationHint aCreationHint)
: PaintedLayer(aManager, static_cast<ClientLayer*>(this), aCreationHint)
, mContentClient()
, mHaveSingleTiledContentClient(false)
{
MOZ_COUNT_CTOR(ClientTiledPaintedLayer);
mPaintData.mLastScrollOffset = ParentLayerPoint(0, 0);
@ -411,18 +412,26 @@ ClientTiledPaintedLayer::RenderLayer()
void *data = ClientManager()->GetPaintedLayerCallbackData();
IntSize layerSize = mVisibleRegion.ToUnknownRegion().GetBounds().Size();
if (mContentClient && !mContentClient->SupportsLayerSize(layerSize, ClientManager())) {
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) {
mContentClient = nullptr;
mValidRegion.SetEmpty();
}
if (!mContentClient) {
if (mCreationHint == LayerManager::NONE &&
SingleTiledContentClient::ClientSupportsLayerSize(layerSize, ClientManager()) &&
gfxPrefs::LayersSingleTileEnabled()) {
if (wantSingleTiledContentClient) {
mContentClient = new SingleTiledContentClient(this, ClientManager());
mHaveSingleTiledContentClient = true;
} else {
mContentClient = new MultiTiledContentClient(this, ClientManager());
mHaveSingleTiledContentClient = false;
}
mContentClient->Connect();

View File

@ -133,6 +133,9 @@ private:
void EndPaint();
RefPtr<TiledContentClient> mContentClient;
// Flag to indicate if mContentClient is a SingleTiledContentClient. This is
// only valid when mContentClient is non-null.
bool mHaveSingleTiledContentClient;
nsIntRegion mLowPrecisionValidRegion;
BasicTiledLayerPaintData mPaintData;
};

View File

@ -46,12 +46,6 @@ 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)

View File

@ -127,8 +127,6 @@ 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<ClientSingleTiledLayerBuffer> mTiledBuffer;
};

View File

@ -628,9 +628,6 @@ public:
};
virtual void UpdatedBuffer(TiledBufferType aType) = 0;
virtual bool SupportsLayerSize(const gfx::IntSize& aSize, ClientLayerManager* aManager) const
{ return true; }
private:
const char* mName;
};

View File

@ -6,8 +6,7 @@
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<!-- Need a timeout here to allow paint unsuppression before we start the test -->
<body onload="setTimeout(startTest,0)">
<body onload="setPrefAndStartTest()">
<div id="t" style="-moz-transform: scale(1.2, 1.2); -moz-transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden">
<div style="height:40px;">Hello</div>
<div id="e" style="height:30px; background:lime">Kitty</div>
@ -54,6 +53,15 @@ function startTest() {
});
});
}
function setPrefAndStartTest() {
SpecialPowers.pushPrefEnv(
{"set": [["layers.single-tile.enabled", false]]},
// Need a timeout here to allow paint unsuppression before we start the test
function() {
setTimeout(startTest, 0);
}
);
}
</script>
</pre>
</body>

View File

@ -6,8 +6,7 @@
<script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<!-- Need a timeout here to allow paint unsuppression before we start the test -->
<body onload="setTimeout(startTest,0)">
<body onload="setPrefAndStartTest()">
<div id="t" style="-moz-transform: scale(1.1, 1.1); -moz-transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden">
<div style="height:40px;"></div>
<div id="e" style="height:30px; background:lime"></div>
@ -41,6 +40,15 @@ function startTest() {
});
});
}
function setPrefAndStartTest() {
SpecialPowers.pushPrefEnv(
{"set": [["layers.single-tile.enabled", false]]},
// Need a timeout here to allow paint unsuppression before we start the test
function() {
setTimeout(startTest, 0);
}
);
}
</script>
</pre>
</body>

View File

@ -12,9 +12,14 @@
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
var root = getRootDirectory(window.location.href);
window.open(root + "transformed_scrolling_repaints_3_window.html", "transformed_scrolling_repaints_3",
"chrome,width=300,height=400");
SpecialPowers.pushPrefEnv(
{"set": [["layers.single-tile.enabled", false]]},
function() {
var root = getRootDirectory(window.location.href);
window.open(root + "transformed_scrolling_repaints_3_window.html", "transformed_scrolling_repaints_3",
"chrome,width=300,height=400");
}
);
</script>
</pre>
</body>

View File

@ -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
!= paintedlayer-recycling-3.html about:blank
pref(layers.single-tile.enabled,false) != 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(layout.animated-image-layers.enabled,true) skip-if(Android||gtkWidget) == t
!= 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
!= fast-scrolling.html about:blank
pref(layers.single-tile.enabled,false) != fast-scrolling.html about:blank
!= fractional-transform-1.html about:blank
!= fractional-transform-2.html about:blank
!= fractional-transform-3.html about:blank

View File

@ -4379,6 +4379,7 @@ 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);