Bug 1561225 - Revert the WebRender part for bug 1636119. r=longsonr

And check `ShouldSnapToGrid` when we create a stacking context for the
transform display item.

I was totally missing a comment [1] in CreateAimationData.

[1] https://searchfox.org/mozilla-central/rev/3ce874dc2703831af3e5ef3a1d216ffd08057fa5/gfx/layers/AnimationInfo.cpp#683-685

Differential Revision: https://phabricator.services.mozilla.com/D75668
This commit is contained in:
Hiroyuki Ikezoe 2020-05-16 20:41:49 +00:00
parent e55212e5f4
commit 4c6046552f
4 changed files with 5 additions and 6 deletions

View File

@ -639,7 +639,7 @@ bool AnimationHelper::SampleAnimations(CompositorAnimationStorage* aStorage,
if (!transformData.hasPerspectiveParent()) {
nsLayoutUtils::PostTranslate(transform, transformData.origin(),
transformData.appUnitsPerDevPixel(),
transformData.snapToGrid());
true);
}
transform.PostScale(transformData.inheritedXScale(),

View File

@ -692,7 +692,6 @@ static Maybe<TransformData> CreateAnimationData(
nsLayoutUtils::GetCrossDocParentFrame(aFrame));
origin = aFrame->GetOffsetToCrossDoc(referenceFrame);
}
bool snapToGrid = nsLayoutUtils::ShouldSnapToGrid(aFrame);
Maybe<MotionPathData> motionPathData;
if (aDataType == AnimationDataType::WithMotionPath) {
@ -709,7 +708,7 @@ static Maybe<TransformData> CreateAnimationData(
return Some(TransformData(origin, offsetToTransformOrigin, bounds,
devPixelsToAppUnits, scaleX, scaleY,
hasPerspectiveParent, snapToGrid, motionPathData));
hasPerspectiveParent, motionPathData));
}
void AnimationInfo::AddNonAnimatingTransformLikePropertiesStyles(

View File

@ -167,8 +167,6 @@ struct TransformData {
float inheritedYScale;
// True if the parent has perspective transform
bool hasPerspectiveParent;
// True if the animation should be snapped to the pixel grid
bool snapToGrid;
MotionPathData? motionPathData;
};

View File

@ -7986,7 +7986,9 @@ bool nsDisplayTransform::CreateWebRenderCommands(
// In ChooseScaleAndSetTransform, we round the offset from the reference
// frame used to adjust the transform, if there is no transform, or it
// is just a translation. We need to do the same here.
position.Round();
if (nsLayoutUtils::ShouldSnapToGrid(mFrame)) {
position.Round();
}
}
// We don't send animations for transform separator display items.