mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 1378602
- Part3. Add OMTA support for nsDisplayTransform and nsDisplayOpacity. r=kats
MozReview-Commit-ID: CP4WEZgy83a
This commit is contained in:
parent
a48f3ac6fe
commit
7aa3422a0a
@ -169,5 +169,11 @@ WebRenderFallbackData::SetGeometry(nsAutoPtr<nsDisplayItemGeometry> aGeometry)
|
||||
mGeometry = aGeometry;
|
||||
}
|
||||
|
||||
WebRenderAnimationData::WebRenderAnimationData(WebRenderLayerManager* aWRManager)
|
||||
: WebRenderUserData(aWRManager),
|
||||
mAnimationInfo(aWRManager)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "mozilla/layers/StackingContextHelper.h"
|
||||
#include "mozilla/webrender/WebRenderAPI.h"
|
||||
#include "mozilla/layers/AnimationInfo.h"
|
||||
|
||||
class nsDisplayItemGeometry;
|
||||
|
||||
@ -33,6 +34,7 @@ public:
|
||||
enum class UserDataType {
|
||||
eImage,
|
||||
eFallback,
|
||||
eAnimation,
|
||||
};
|
||||
|
||||
virtual UserDataType GetType() = 0;
|
||||
@ -100,6 +102,20 @@ protected:
|
||||
nsRect mBounds;
|
||||
};
|
||||
|
||||
class WebRenderAnimationData : public WebRenderUserData
|
||||
{
|
||||
public:
|
||||
explicit WebRenderAnimationData(WebRenderLayerManager* aWRManager);
|
||||
virtual ~WebRenderAnimationData() {}
|
||||
|
||||
virtual UserDataType GetType() override { return UserDataType::eAnimation; }
|
||||
static UserDataType Type() { return UserDataType::eAnimation; }
|
||||
AnimationInfo& GetAnimationInfo() { return mAnimationInfo; }
|
||||
|
||||
protected:
|
||||
AnimationInfo mAnimationInfo;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -6064,16 +6064,35 @@ nsDisplayOpacity::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuil
|
||||
LayerRect bounds = ViewAs<LayerPixel>(LayoutDeviceRect::FromAppUnits(visibleRect, appUnitsPerDevPixel),
|
||||
PixelCastJustification::WebRenderHasUnitResolution);
|
||||
LayerPoint origin = bounds.TopLeft();
|
||||
float* opacityForSC = &mOpacity;
|
||||
|
||||
// TODO: generate animationsId for OMTA.
|
||||
RefPtr<WebRenderAnimationData> animationData = aManager->CreateOrRecycleWebRenderUserData<WebRenderAnimationData>(this);
|
||||
AnimationInfo& animationInfo = animationData->GetAnimationInfo();
|
||||
AddAnimationsForProperty(Frame(), aDisplayListBuilder,
|
||||
this, eCSSProperty_opacity,
|
||||
animationInfo, false);
|
||||
animationInfo.StartPendingAnimations(aManager->GetAnimationReadyTime());
|
||||
uint64_t animationsId = 0;
|
||||
nsTArray<WrFilterOp> filters;
|
||||
|
||||
if (gfxPrefs::WebRenderOMTAEnabled() &&
|
||||
!animationInfo.GetAnimations().IsEmpty()) {
|
||||
animationsId = animationInfo.GetCompositorAnimationsId();
|
||||
opacityForSC = nullptr;
|
||||
OptionalOpacity opacityForCompositor = mOpacity;
|
||||
|
||||
OpAddCompositorAnimations
|
||||
anim(CompositorAnimations(animationInfo.GetAnimations(), animationsId),
|
||||
void_t(), opacityForCompositor);
|
||||
aManager->WrBridge()->AddWebRenderParentCommand(anim);
|
||||
}
|
||||
|
||||
nsTArray<mozilla::wr::WrFilterOp> filters;
|
||||
StackingContextHelper sc(aSc,
|
||||
aBuilder,
|
||||
bounds,
|
||||
origin,
|
||||
animationsId,
|
||||
&mOpacity,
|
||||
opacityForSC,
|
||||
nullptr,
|
||||
filters);
|
||||
|
||||
@ -7614,9 +7633,35 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu
|
||||
bounds.MoveTo(boundTransform.TransformPoint(bounds.TopLeft()));
|
||||
}
|
||||
|
||||
// TODO: generate animationsId for OMTA.
|
||||
RefPtr<WebRenderAnimationData> animationData = aManager->CreateOrRecycleWebRenderUserData<WebRenderAnimationData>(this);
|
||||
|
||||
AnimationInfo& animationInfo = animationData->GetAnimationInfo();
|
||||
AddAnimationsForProperty(Frame(), aDisplayListBuilder,
|
||||
this, eCSSProperty_transform,
|
||||
animationInfo, false);
|
||||
animationInfo.StartPendingAnimations(aManager->GetAnimationReadyTime());
|
||||
uint64_t animationsId = 0;
|
||||
nsTArray<wr::WrFilterOp> filters;
|
||||
|
||||
if (gfxPrefs::WebRenderOMTAEnabled() &&
|
||||
!animationInfo.GetAnimations().IsEmpty()) {
|
||||
animationsId = animationInfo.GetCompositorAnimationsId();
|
||||
|
||||
// Update transfrom as nullptr in stacking context if there exists
|
||||
// transform animation, the transform value will be resolved
|
||||
// after animation sampling on the compositor
|
||||
transformForSC = nullptr;
|
||||
|
||||
// Pass default transform to compositor in case gecko fails to
|
||||
// get animated value after animation sampling.
|
||||
OptionalTransform transformForCompositor = newTransformMatrix;
|
||||
|
||||
OpAddCompositorAnimations
|
||||
anim(CompositorAnimations(animationInfo.GetAnimations(), animationsId),
|
||||
transformForCompositor, void_t());
|
||||
aManager->WrBridge()->AddWebRenderParentCommand(anim);
|
||||
}
|
||||
|
||||
nsTArray<mozilla::wr::WrFilterOp> filters;
|
||||
StackingContextHelper sc(aSc,
|
||||
aBuilder,
|
||||
bounds,
|
||||
|
Loading…
Reference in New Issue
Block a user