зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1394308 - Apply inherited scale for OMTA to support layers-free, r=kats
Expose the API to get/set inherited scale from stacking context and we can use these APIs to calculate correct scale for OMTA MozReview-Commit-ID: DZEkodHTy8v --HG-- extra : rebase_source : be3c978c8f48c9b1bfcd01cff6bb8200092b5e60
This commit is contained in:
Родитель
0987151cd8
Коммит
7780b1e846
|
@ -102,6 +102,7 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
|
|||
mTransform.PostScale(aParentSC.mXScale, aParentSC.mYScale, 1.0);
|
||||
mTransform.NudgeToIntegersFixedEpsilon();
|
||||
|
||||
// Calculate the correct scale for current stacking context
|
||||
gfx::Size scale = mTransform.As2D().ScaleFactors(true);
|
||||
|
||||
// Restore the scale to default if the scale is too small
|
||||
|
@ -112,7 +113,7 @@ StackingContextHelper::StackingContextHelper(const StackingContextHelper& aParen
|
|||
|
||||
mTransform.PreScale(1.0f/scale.width, 1.0f/scale.height, 1.0);
|
||||
|
||||
// Store the inherited scale if has
|
||||
// Store the inherited scale for child
|
||||
this->mXScale = scale.width;
|
||||
this->mYScale = scale.height;
|
||||
} else {
|
||||
|
|
|
@ -83,6 +83,18 @@ public:
|
|||
// Same but rounds the rectangle to ints after transforming.
|
||||
wr::LayoutRect ToRelativeLayoutRectRounded(const LayoutDeviceRect& aRect) const;
|
||||
|
||||
// Export the inherited scale
|
||||
gfx::Size GetInheritedScale() const {
|
||||
return gfx::Size(mXScale, mYScale);
|
||||
}
|
||||
|
||||
// Provide interface to setup the inherited scale to support
|
||||
// special cases, like OMTA
|
||||
void SetInheritedScale(const gfx::Size& aScale) {
|
||||
mXScale = aScale.width;
|
||||
mYScale = aScale.height;
|
||||
}
|
||||
|
||||
bool IsBackfaceVisible() const { return mTransform.IsBackfaceVisible(); }
|
||||
|
||||
private:
|
||||
|
|
|
@ -7812,15 +7812,6 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu
|
|||
// 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);
|
||||
}
|
||||
|
||||
gfx::Matrix4x4Typed<LayerPixel, LayerPixel> boundTransform = ViewAs< gfx::Matrix4x4Typed<LayerPixel, LayerPixel> >(newTransformMatrix);
|
||||
|
@ -7841,6 +7832,32 @@ nsDisplayTransform::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBu
|
|||
nullptr,
|
||||
filters);
|
||||
|
||||
if (animationsId) {
|
||||
// Get the inheritedScale from parent and pass the scale to compositor
|
||||
// to get correct sampling result
|
||||
gfx::Size scale = aSc.GetInheritedScale();
|
||||
for (layers::Animation& animation : animationInfo.GetAnimations()) {
|
||||
if (animation.property() == eCSSProperty_transform) {
|
||||
TransformData& transformData = animation.data().get_TransformData();
|
||||
transformData.inheritedXScale() = scale.width;
|
||||
transformData.inheritedYScale() = scale.height;
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
// Since we passed a nullptr transformForSC to the StackingContextHelper,
|
||||
// we now set up the correct inherited scale for the stacking context.
|
||||
newTransformMatrix.PostScale(scale.width, scale.height, 1.0f);
|
||||
sc.SetInheritedScale(newTransformMatrix.As2D().ScaleFactors(true));
|
||||
|
||||
}
|
||||
return mStoredList.CreateWebRenderCommands(aBuilder, sc, aParentCommands,
|
||||
aManager, aDisplayListBuilder);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче