зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1426386 - Split the transform sent to webrender back into the transform and positioning components. r=mstange
MozReview-Commit-ID: XHqgYPwjZ0 --HG-- extra : rebase_source : 4d04ec882147368733854b9322e00a6030a73b2c
This commit is contained in:
Родитель
18a07f55d3
Коммит
474ec938e7
|
@ -610,7 +610,8 @@ AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty,
|
|||
static void
|
||||
AddAnimationsForProperty(nsIFrame* aFrame, nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayItem* aItem, nsCSSPropertyID aProperty,
|
||||
AnimationInfo& aAnimationInfo, bool aPending)
|
||||
AnimationInfo& aAnimationInfo, bool aPending,
|
||||
bool aIsForWebRender)
|
||||
{
|
||||
if (aPending) {
|
||||
aAnimationInfo.ClearAnimationsForNextTransaction();
|
||||
|
@ -667,7 +668,11 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsDisplayListBuilder* aBuilder,
|
|||
float scaleX = 1.0f;
|
||||
float scaleY = 1.0f;
|
||||
bool hasPerspectiveParent = false;
|
||||
if (aItem) {
|
||||
if (aIsForWebRender) {
|
||||
// leave origin empty, because we are sending it separately on the stacking
|
||||
// context that we are pushing to WR, and WR will automatically include
|
||||
// it when picking up the animated transform values
|
||||
} else if (aItem) {
|
||||
// This branch is for display items to leverage the cache of
|
||||
// nsDisplayListBuilder.
|
||||
origin = aItem->ToReferenceFrame();
|
||||
|
@ -845,7 +850,7 @@ nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(Layer* aLayer,
|
|||
bool pending = !aBuilder;
|
||||
AnimationInfo& animationInfo = aLayer->GetAnimationInfo();
|
||||
AddAnimationsForProperty(aFrame, aBuilder, aItem, aProperty,
|
||||
animationInfo, pending);
|
||||
animationInfo, pending, false);
|
||||
animationInfo.TransferMutatedFlagToLayer(aLayer);
|
||||
}
|
||||
|
||||
|
@ -6671,7 +6676,7 @@ nsDisplayOpacity::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuil
|
|||
AnimationInfo& animationInfo = animationData->GetAnimationInfo();
|
||||
AddAnimationsForProperty(Frame(), aDisplayListBuilder,
|
||||
this, eCSSProperty_opacity,
|
||||
animationInfo, false);
|
||||
animationInfo, false, true);
|
||||
animationInfo.StartPendingAnimations(aManager->GetAnimationReadyTime());
|
||||
|
||||
// Note that animationsId can be 0 (uninitialized in AnimationInfo) if there
|
||||
|
@ -8422,9 +8427,18 @@ nsDisplayTransform::GetTransform() const
|
|||
}
|
||||
|
||||
Matrix4x4
|
||||
nsDisplayTransform::GetTransformForRendering()
|
||||
nsDisplayTransform::GetTransformForRendering(LayoutDevicePoint* aOutOrigin)
|
||||
{
|
||||
if (!mFrame->HasPerspective() || mTransformGetter || mIsTransformSeparator) {
|
||||
if (!mTransformGetter && !mIsTransformSeparator && aOutOrigin) {
|
||||
// If aOutOrigin is provided, put the offset to origin into it, because
|
||||
// we need to keep it separate for webrender. The combination of
|
||||
// *aOutOrigin and the returned matrix here should always be equivalent
|
||||
// to what GetTransform() would have returned.
|
||||
float scale = mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
*aOutOrigin = LayoutDevicePoint::FromAppUnits(ToReferenceFrame(), scale);
|
||||
return GetResultingTransformMatrix(mFrame, nsPoint(0, 0), scale, INCLUDE_PERSPECTIVE);
|
||||
}
|
||||
return GetTransform();
|
||||
}
|
||||
MOZ_ASSERT(!mTransformGetter);
|
||||
|
@ -8480,7 +8494,14 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu
|
|||
WebRenderLayerManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder)
|
||||
{
|
||||
Matrix4x4 newTransformMatrix = GetTransformForRendering();
|
||||
// We want to make sure we don't pollute the transform property in the WR
|
||||
// stacking context by including the position of this frame (relative to the
|
||||
// parent reference frame). We need to keep those separate; the position of
|
||||
// this frame goes into the stacking context bounds while the transform goes
|
||||
// into the transform.
|
||||
LayoutDevicePoint position;
|
||||
Matrix4x4 newTransformMatrix = GetTransformForRendering(&position);
|
||||
|
||||
gfx::Matrix4x4* transformForSC = &newTransformMatrix;
|
||||
if (newTransformMatrix.IsIdentity()) {
|
||||
// If the transform is an identity transform, strip it out so that WR
|
||||
|
@ -8494,7 +8515,7 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu
|
|||
AnimationInfo& animationInfo = animationData->GetAnimationInfo();
|
||||
AddAnimationsForProperty(Frame(), aDisplayListBuilder,
|
||||
this, eCSSProperty_transform,
|
||||
animationInfo, false);
|
||||
animationInfo, false, true);
|
||||
animationInfo.StartPendingAnimations(aManager->GetAnimationReadyTime());
|
||||
|
||||
// Note that animationsId can be 0 (uninitialized in AnimationInfo) if there
|
||||
|
@ -8528,7 +8549,7 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu
|
|||
StackingContextHelper sc(aSc,
|
||||
aBuilder,
|
||||
filters,
|
||||
LayoutDeviceRect(),
|
||||
LayoutDeviceRect(position, LayoutDeviceSize()),
|
||||
&newTransformMatrix,
|
||||
animationsId ? &prop : nullptr,
|
||||
nullptr,
|
||||
|
|
|
@ -6155,7 +6155,7 @@ public:
|
|||
* nsDisplayPerspective created for that.
|
||||
*/
|
||||
const Matrix4x4& GetTransform() const;
|
||||
Matrix4x4 GetTransformForRendering();
|
||||
Matrix4x4 GetTransformForRendering(mozilla::LayoutDevicePoint* aOutOrigin = nullptr);
|
||||
|
||||
/**
|
||||
* Return the transform that is aggregation of all transform on the
|
||||
|
|
|
@ -1861,7 +1861,7 @@ pref(layout.css.moz-document.content.enabled,false) == 1035091-2.html 1035091-re
|
|||
== 1062963-floatmanager-reflow.html 1062963-floatmanager-reflow-ref.html
|
||||
test-pref(dom.webcomponents.shadowdom.enabled,true) == 1066554-1.html 1066554-1-ref.html
|
||||
== 1069716-1.html 1069716-1-ref.html
|
||||
fails-if(webrender) == 1078262-1.html about:blank
|
||||
== 1078262-1.html about:blank
|
||||
test-pref(layout.testing.overlay-scrollbars.always-visible,false) == 1081072-1.html 1081072-1-ref.html
|
||||
== 1081185-1.html 1081185-1-ref.html
|
||||
== 1097437-1.html 1097437-1-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче