зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1364525 - Ensure all scroll thumbs have an animations id. r=pchang
In order to have the scrollbar thumbs reflect the async scroll position, we're going to re-use the API for OMTA. That is, we set an animation id on the stacking context for the scroll thumb, and we'll update the transform on the stacking context at composite time based on the async scroll position. For this to work we need to ensure that the scroll thumb does in fact have an animation id set on it. MozReview-Commit-ID: 6TvRemxRUrR
This commit is contained in:
Родитель
cf3f50ea30
Коммит
cd79f50c8d
|
@ -205,14 +205,20 @@ Layer::~Layer()
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
Layer::EnsureAnimationsId()
|
||||
{
|
||||
if (!mCompositorAnimationsId) {
|
||||
mCompositorAnimationsId = AnimationHelper::GetNextCompositorAnimationsId();
|
||||
}
|
||||
}
|
||||
|
||||
Animation*
|
||||
Layer::AddAnimation()
|
||||
{
|
||||
// Here generates a new id when the first animation is added and
|
||||
// this id is used to represent the animations in this layer.
|
||||
if (!mCompositorAnimationsId) {
|
||||
mCompositorAnimationsId = AnimationHelper::GetNextCompositorAnimationsId();
|
||||
}
|
||||
EnsureAnimationsId();
|
||||
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(
|
||||
this, ("Layer::Mutated(%p) AddAnimation with id=%" PRIu64, this, mCompositorAnimationsId));
|
||||
|
|
|
@ -1223,6 +1223,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
// Ensure that this layer has a valid (non-zero) animations id. This value is
|
||||
// unique across layers.
|
||||
void EnsureAnimationsId();
|
||||
// Call AddAnimation to add a new animation to this layer from layout code.
|
||||
// Caller must fill in all the properties of the returned animation.
|
||||
// A later animation overrides an earlier one.
|
||||
|
|
|
@ -90,6 +90,23 @@ WebRenderContainerLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
|
|||
WrBridge()->AddWebRenderParentCommand(anim);
|
||||
}
|
||||
|
||||
// If APZ is enabled and this layer is a scroll thumb, then it might need
|
||||
// to move in the compositor to represent the async scroll position. So we
|
||||
// ensure that there is an animations id set on it, we will use this to give
|
||||
// WebRender updated transforms for composition.
|
||||
if (WrManager()->AsyncPanZoomEnabled() &&
|
||||
GetScrollThumbData().mDirection != ScrollDirection::NONE) {
|
||||
// A scroll thumb better not have a transform animation already or we're
|
||||
// going to end up clobbering it with APZ animating it too.
|
||||
MOZ_ASSERT(transformForSC);
|
||||
|
||||
EnsureAnimationsId();
|
||||
animationsId = GetCompositorAnimationsId();
|
||||
// We need to set the transform in the stacking context to null for it to
|
||||
// pick up and install the animation id.
|
||||
transformForSC = nullptr;
|
||||
}
|
||||
|
||||
ScrollingLayersHelper scroller(this, aBuilder, aSc);
|
||||
StackingContextHelper sc(aSc, aBuilder, this, animationsId, opacityForSC, transformForSC);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче