Bug 1619040 - Add a new WebRenderData specific for APZ. r=kats

AnimationInfo has a bunch of member variables that are not necessary for APZ.

Differential Revision: https://phabricator.services.mozilla.com/D64855

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Hiroyuki Ikezoe 2020-03-02 16:15:26 +00:00
Родитель bf1bb4a845
Коммит f0bdb9d256
3 изменённых файлов: 24 добавлений и 5 удалений

Просмотреть файл

@ -6,6 +6,7 @@
#include "WebRenderUserData.h" #include "WebRenderUserData.h"
#include "mozilla/layers/AnimationHelper.h"
#include "mozilla/layers/CompositorBridgeChild.h" #include "mozilla/layers/CompositorBridgeChild.h"
#include "mozilla/layers/ImageClient.h" #include "mozilla/layers/ImageClient.h"
#include "mozilla/layers/WebRenderBridgeChild.h" #include "mozilla/layers/WebRenderBridgeChild.h"
@ -336,6 +337,11 @@ WebRenderImageData* WebRenderFallbackData::PaintIntoImage() {
return mImageData.get(); return mImageData.get();
} }
WebRenderAPZAnimationData::WebRenderAPZAnimationData(
RenderRootStateManager* aManager, nsDisplayItem* aItem)
: WebRenderUserData(aManager, aItem),
mAnimationId(AnimationHelper::GetNextCompositorAnimationsId()) {}
WebRenderAnimationData::WebRenderAnimationData(RenderRootStateManager* aManager, WebRenderAnimationData::WebRenderAnimationData(RenderRootStateManager* aManager,
nsDisplayItem* aItem) nsDisplayItem* aItem)
: WebRenderUserData(aManager, aItem) {} : WebRenderUserData(aManager, aItem) {}

Просмотреть файл

@ -78,6 +78,7 @@ class WebRenderUserData {
enum class UserDataType { enum class UserDataType {
eImage, eImage,
eFallback, eFallback,
eAPZAnimation,
eAnimation, eAnimation,
eCanvas, eCanvas,
eRemote, eRemote,
@ -220,6 +221,20 @@ class WebRenderFallbackData : public WebRenderUserData {
bool mInvalid; bool mInvalid;
}; };
class WebRenderAPZAnimationData : public WebRenderUserData {
public:
WebRenderAPZAnimationData(RenderRootStateManager* aManager,
nsDisplayItem* aItem);
virtual ~WebRenderAPZAnimationData() = default;
UserDataType GetType() override { return UserDataType::eAPZAnimation; }
static UserDataType Type() { return UserDataType::eAPZAnimation; }
uint64_t GetAnimationId() { return mAnimationId; }
private:
uint64_t mAnimationId;
};
class WebRenderAnimationData : public WebRenderUserData { class WebRenderAnimationData : public WebRenderUserData {
public: public:
WebRenderAnimationData(RenderRootStateManager* aManager, WebRenderAnimationData(RenderRootStateManager* aManager,

Просмотреть файл

@ -6942,13 +6942,11 @@ bool nsDisplayOwnLayer::CreateWebRenderCommands(
// APZ is enabled and this is a scroll thumb or zooming layer, so we need // APZ is enabled and this is a scroll thumb or zooming layer, so we need
// to create and set an animation id. That way APZ can adjust the position/ // to create and set an animation id. That way APZ can adjust the position/
// zoom of this content asynchronously as needed. // zoom of this content asynchronously as needed.
RefPtr<WebRenderAnimationData> animationData = RefPtr<WebRenderAPZAnimationData> animationData =
aManager->CommandBuilder() aManager->CommandBuilder()
.CreateOrRecycleWebRenderUserData<WebRenderAnimationData>( .CreateOrRecycleWebRenderUserData<WebRenderAPZAnimationData>(
this, aBuilder.GetRenderRoot()); this, aBuilder.GetRenderRoot());
AnimationInfo& animationInfo = animationData->GetAnimationInfo(); mWrAnimationId = animationData->GetAnimationId();
animationInfo.EnsureAnimationsId();
mWrAnimationId = animationInfo.GetCompositorAnimationsId();
prop.emplace(); prop.emplace();
prop->id = mWrAnimationId; prop->id = mWrAnimationId;