Bug 1394695 - Don't push scrolling clips in layers-free WR if APZ is disabled. r?mstange
MozReview-Commit-ID: AesXui61mB2
--- a/gfx/layers/wr/ScrollingLayersHelper.cpp
+++ b/gfx/layers/wr/ScrollingLayersHelper.cpp
@@ -84,24 +84,33 @@ ScrollingLayersHelper::ScrollingLayersHe
} else {
PushLayerLocalClip(aStackingContext);
}
}
ScrollingLayersHelper::ScrollingLayersHelper(nsDisplayItem* aItem,
wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aStackingContext,
- WebRenderLayerManager::ClipIdMap& aCache)
+ WebRenderLayerManager::ClipIdMap& aCache,
+ bool aApzEnabled)
: mLayer(nullptr)
, mBuilder(&aBuilder)
, mPushedLayerLocalClip(false)
, mPushedClipAndScroll(false)
{
int32_t auPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
+ if (!aApzEnabled) {
+ // If APZ is not enabled, we can ignore all the stuff with ASRs; we just
+ // need to define the clip chain on the item and that's it.
+ DefineAndPushChain(aItem->GetClipChain(), aBuilder, aStackingContext,
+ auPerDevPixel, aCache);
+ return;
+ }
+
// There are two ASR chains here that we need to be fully defined. One is the
// ASR chain pointed to by aItem->GetActiveScrolledRoot(). The other is the
// ASR chain pointed to by aItem->GetClipChain()->mASR. We pick the leafmost
// of these two chains because that one will include the other. And then we
// call DefineAndPushScrollLayers with it, which will recursively push all
// the necessary clips and scroll layer items for that ASR chain.
const ActiveScrolledRoot* leafmostASR = aItem->GetActiveScrolledRoot();
if (aItem->GetClipChain()) {
--- a/gfx/layers/wr/ScrollingLayersHelper.h
+++ b/gfx/layers/wr/ScrollingLayersHelper.h
@@ -28,17 +28,18 @@ class MOZ_RAII ScrollingLayersHelper
{
public:
ScrollingLayersHelper(WebRenderLayer* aLayer,
wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc);
ScrollingLayersHelper(nsDisplayItem* aItem,
wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aStackingContext,
- WebRenderLayerManager::ClipIdMap& aCache);
+ WebRenderLayerManager::ClipIdMap& aCache,
+ bool aApzEnabled);
~ScrollingLayersHelper();
private:
void DefineAndPushScrollLayers(nsDisplayItem* aItem,
const ActiveScrolledRoot* aAsr,
const DisplayItemClipChain* aChain,
wr::DisplayListBuilder& aBuilder,
int32_t aAppUnitsPerDevPixel,
--- a/gfx/layers/wr/WebRenderLayerManager.cpp
+++ b/gfx/layers/wr/WebRenderLayerManager.cpp
@@ -323,17 +323,17 @@ WebRenderLayerManager::CreateWebRenderCo
if (!mShouldNotifyInvalidation) {
nsRect invalid;
if (item->IsInvalid(invalid)) {
mShouldNotifyInvalidation = true;
}
}
{ // scope the ScrollingLayersHelper
- ScrollingLayersHelper clip(item, aBuilder, aSc, mClipIdCache);
+ ScrollingLayersHelper clip(item, aBuilder, aSc, mClipIdCache, AsyncPanZoomEnabled());
// Note: this call to CreateWebRenderCommands can recurse back into
// this function if the |item| is a wrapper for a sublist.
if (!item->CreateWebRenderCommands(aBuilder, aSc, mParentCommands, this,
aDisplayListBuilder)) {
PushItemAsImage(item, aBuilder, aSc, aDisplayListBuilder);
}
}