Bug 1043859 - Fix the code to remove the async transform from scrollbar layers that are descendants of their content. r=botond a=bajaj
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -730,25 +730,35 @@ ApplyAsyncTransformToScrollbarForContent
Matrix4x4 transform = scrollbarTransform * aScrollbar->GetTransform();
if (aScrollbarIsDescendant) {
// If the scrollbar layer is a child of the content it is a scrollbar for, then we
// need to do an extra untransform to cancel out the transient async transform on
// the content. This is needed because otherwise that transient async transform is
// part of the effective transform of this scrollbar, and the scrollbar will jitter
// as the content scrolls.
- transientTransform.Invert();
- transform = transform * transientTransform;
+ // Since the async transform is applied on top of the content's regular
+ // transform, we need to make sure to unapply the async transform in the
+ // same coordinate space. This requires applying the content transform and
+ // then unapplying it after unapplying the async transform.
+ Matrix4x4 asyncUntransform = (asyncTransform * apzc->GetOverscrollTransform());
+ asyncUntransform.Invert();
+ Matrix4x4 contentTransform = aContent.GetTransform();
+ Matrix4x4 contentUntransform = contentTransform;
+ contentUntransform.Invert();
+
+ Matrix4x4 compensation = contentTransform * asyncUntransform * contentUntransform;
+ transform = transform * compensation;
// We also need to make a corresponding change on the clip rect of all the
// layers on the ancestor chain from the scrollbar layer up to but not
// including the layer with the async transform. Otherwise the scrollbar
// shifts but gets clipped and so appears to flicker.
for (Layer* ancestor = aScrollbar; ancestor != aContent.GetLayer(); ancestor = ancestor->GetParent()) {
- TransformClipRect(ancestor, transientTransform);
+ TransformClipRect(ancestor, compensation);
}
}
// GetTransform already takes the pre- and post-scale into account. Since we
// will apply the pre- and post-scale again when computing the effective
// transform, we must apply the inverses here.
if (ContainerLayer* container = aScrollbar->AsContainerLayer()) {
transform.Scale(1.0f/container->GetPreXScale(),