зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1389138 - Introduce a variant type to allow unifying the clip and scroll ids. r=mstange
This allows us to keep a single stack where we track both clip ids and scroll ids with the correct interleaving order that they were pushed in. MozReview-Commit-ID: DHHfR8JnnBw --HG-- extra : rebase_source : f2f80e89a400d5b9982d138b29e534701b247072
This commit is contained in:
Родитель
9f20fdccff
Коммит
1155831470
|
@ -21,7 +21,6 @@ ScrollingLayersHelper::ScrollingLayersHelper(WebRenderLayer* aLayer,
|
|||
: mLayer(aLayer)
|
||||
, mBuilder(&aBuilder)
|
||||
, mPushedLayerLocalClip(false)
|
||||
, mClipsPushed(0)
|
||||
{
|
||||
if (!mLayer->WrManager()->AsyncPanZoomEnabled()) {
|
||||
// If APZ is disabled then we don't need to push the scrolling clips. We
|
||||
|
@ -93,7 +92,6 @@ ScrollingLayersHelper::ScrollingLayersHelper(nsDisplayItem* aItem,
|
|||
: mLayer(nullptr)
|
||||
, mBuilder(&aBuilder)
|
||||
, mPushedLayerLocalClip(false)
|
||||
, mClipsPushed(0)
|
||||
{
|
||||
DefineAndPushChain(aItem->GetClipChain(), aBuilder, aStackingContext,
|
||||
aItem->Frame()->PresContext()->AppUnitsPerDevPixel(), aCache);
|
||||
|
@ -138,7 +136,7 @@ ScrollingLayersHelper::DefineAndPushChain(const DisplayItemClipChain* aChain,
|
|||
// Finally, push the clip onto the WR stack
|
||||
MOZ_ASSERT(clipId);
|
||||
aBuilder.PushClip(clipId.value());
|
||||
mClipsPushed++;
|
||||
mPushedClips.push_back(wr::ScrollOrClipId(clipId.value()));
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -213,10 +211,12 @@ ScrollingLayersHelper::PushLayerClip(const LayerClip& aClip,
|
|||
ScrollingLayersHelper::~ScrollingLayersHelper()
|
||||
{
|
||||
if (!mLayer) {
|
||||
// For layers-free mode
|
||||
while (mClipsPushed > 0) {
|
||||
// For layers-free mode.
|
||||
while (!mPushedClips.empty()) {
|
||||
wr::ScrollOrClipId id = mPushedClips.back();
|
||||
MOZ_ASSERT(id.is<wr::WrClipId>());
|
||||
mBuilder->PopClip();
|
||||
mClipsPushed--;
|
||||
mPushedClips.pop_back();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ private:
|
|||
WebRenderLayer* mLayer;
|
||||
wr::DisplayListBuilder* mBuilder;
|
||||
bool mPushedLayerLocalClip;
|
||||
int mClipsPushed;
|
||||
std::vector<wr::ScrollOrClipId> mPushedClips;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#ifndef GFX_WEBRENDERTYPES_H
|
||||
#define GFX_WEBRENDERTYPES_H
|
||||
|
||||
#include "FrameMetrics.h"
|
||||
#include "mozilla/webrender/webrender_ffi.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/gfx/Matrix.h"
|
||||
|
@ -14,6 +15,7 @@
|
|||
#include "mozilla/layers/LayersTypes.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
#include "mozilla/Range.h"
|
||||
#include "mozilla/Variant.h"
|
||||
#include "Units.h"
|
||||
#include "RoundedRect.h"
|
||||
#include "nsStyleConsts.h"
|
||||
|
@ -662,6 +664,8 @@ struct WrClipId {
|
|||
}
|
||||
};
|
||||
|
||||
typedef Variant<layers::FrameMetrics::ViewID, WrClipId> ScrollOrClipId;
|
||||
|
||||
} // namespace wr
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче