Backed out 2 changesets (bug 1223736) for reftest failures in mask-layer-transform.html CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Fri, 18 Mar 2016 16:44:09 -0700
changeset 289431 57f5e012ebf3f88daae707a6aa05339c8c54dbf4
parent 289430 58dc7aaefa9cd7427dbb775767938fe2dc32a295
child 289432 c31503dab99df159c2ac2193c68bc1531b334ae7
push id30102
push userryanvm@gmail.com
push dateSat, 19 Mar 2016 15:23:17 +0000
treeherdermozilla-central@720fb3d55e28 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1223736
milestone48.0a1
backs out1982db677df6bbcd00dd4bd06ce906050f2576c6
5813dbb50356f6fe9e7cd59c227d45d37fd87d8e
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1223736) for reftest failures in mask-layer-transform.html CLOSED TREE Backed out changeset 1982db677df6 (bug 1223736) Backed out changeset 5813dbb50356 (bug 1223736) MozReview-Commit-ID: HrnSIGPovea
gfx/layers/Layers.cpp
gfx/layers/basic/BasicCompositor.cpp
layout/reftests/layers/mask-layer-transform-ref.html
layout/reftests/layers/mask-layer-transform.html
layout/reftests/layers/reftest.list
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -1461,17 +1461,21 @@ ContainerLayer::DefaultComputeEffectiveT
   }
   mUseIntermediateSurface = useIntermediateSurface && !GetLocalVisibleRegion().IsEmpty();
   if (useIntermediateSurface) {
     ComputeEffectiveTransformsForChildren(Matrix4x4::From2D(residual));
   } else {
     ComputeEffectiveTransformsForChildren(idealTransform);
   }
 
-  ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
+  if (idealTransform.CanDraw2D()) {
+    ComputeEffectiveTransformForMaskLayers(aTransformToSurface);
+  } else {
+    ComputeEffectiveTransformForMaskLayers(Matrix4x4());
+  }
 }
 
 void
 ContainerLayer::DefaultComputeSupportsComponentAlphaChildren(bool* aNeedsSurfaceCopy)
 {
   if (!(GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA_DESCENDANT) ||
       !Manager()->AreComponentAlphaLayersEnabled()) {
     mSupportsComponentAlphaChildren = false;
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -392,35 +392,16 @@ Transform(DataSourceSurface* aDest,
 
 static inline IntRect
 RoundOut(Rect r)
 {
   r.RoundOut();
   return IntRect(r.x, r.y, r.width, r.height);
 }
 
-static void
-SetupMask(const EffectChain& aEffectChain,
-          DrawTarget* aDest,
-          const IntPoint& aOffset,
-          RefPtr<SourceSurface>& aMaskSurface,
-          Matrix& aMaskTransform)
-{
-  if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
-    EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
-    aMaskSurface = effectMask->mMaskTexture->AsSourceBasic()->GetSurface(aDest);
-    if (!aMaskSurface) {
-      gfxWarning() << "Invalid sourceMask effect";
-    }
-    MOZ_ASSERT(effectMask->mMaskTransform.Is2D(), "How did we end up with a 3D transform here?!");
-    aMaskTransform = effectMask->mMaskTransform.As2D();
-    aMaskTransform.PostTranslate(-aOffset.x, -aOffset.y);
-  }
-}
-
 void
 BasicCompositor::DrawQuad(const gfx::Rect& aRect,
                           const gfx::Rect& aClipRect,
                           const EffectChain &aEffectChain,
                           gfx::Float aOpacity,
                           const gfx::Matrix4x4& aTransform,
                           const gfx::Rect& aVisibleRect)
 {
@@ -456,29 +437,36 @@ BasicCompositor::DrawQuad(const gfx::Rec
       return;
     }
 
     // Propagate the coordinate offset to our 2D draw target.
     newTransform = Matrix::Translation(transformBounds.x, transformBounds.y);
 
     // When we apply the 3D transformation, we do it against a temporary
     // surface, so undo the coordinate offset.
-    new3DTransform = aTransform;
-    new3DTransform.PreTranslate(aRect.x, aRect.y, 0);
+    new3DTransform = Matrix4x4::Translation(aRect.x, aRect.y, 0) * aTransform;
   }
 
   buffer->PushClipRect(aClipRect);
 
   newTransform.PostTranslate(-offset.x, -offset.y);
   buffer->SetTransform(newTransform);
 
   RefPtr<SourceSurface> sourceMask;
   Matrix maskTransform;
-  if (aTransform.Is2D()) {
-    SetupMask(aEffectChain, dest, offset, sourceMask, maskTransform);
+  if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
+    EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
+    sourceMask = effectMask->mMaskTexture->AsSourceBasic()->GetSurface(dest);
+    if (!sourceMask) {
+      gfxWarning() << "Invalid sourceMask effect";
+    }
+    MOZ_ASSERT(effectMask->mMaskTransform.Is2D(), "How did we end up with a 3D transform here?!");
+    MOZ_ASSERT(!effectMask->mIs3D);
+    maskTransform = effectMask->mMaskTransform.As2D();
+    maskTransform.PostTranslate(-offset.x, -offset.y);
   }
 
   CompositionOp blendMode = CompositionOp::OP_OVER;
   if (Effect* effect = aEffectChain.mSecondaryEffects[EffectTypes::BLEND_MODE].get()) {
     blendMode = static_cast<EffectBlendMode*>(effect)->mBlendMode;
   }
 
   switch (aEffectChain.mPrimaryEffect->mType) {
@@ -575,50 +563,18 @@ BasicCompositor::DrawQuad(const gfx::Rec
         );
     if (NS_WARN_IF(!temp)) {
       buffer->PopClip();
       return;
     }
 
     Transform(temp, source, new3DTransform, transformBounds.TopLeft());
 
-    SetupMask(aEffectChain, buffer, offset, sourceMask, maskTransform);
-
-    // Adjust for the fact that our content now start at 0,0 instead
-    // of the top left of transformBounds.
     transformBounds.MoveTo(0, 0);
-    maskTransform.PostTranslate(-transformBounds.x, -transformBounds.y);
-
-    if (sourceMask) {
-      // Transform the source by it's normal transform, and then the inverse
-      // of the mask transform so that it's in the mask's untransformed
-      // coordinate space.
-      Matrix old = buffer->GetTransform();
-      Matrix sourceTransform = old;
-
-      Matrix inverseMask = maskTransform;
-      inverseMask.Invert();
-
-      sourceTransform *= inverseMask;
-
-      SurfacePattern source(temp, ExtendMode::CLAMP, sourceTransform);
-
-      buffer->PushClipRect(transformBounds);
-
-      // Mask in the untransformed coordinate space, and then transform
-      // by the mask transform to put the result back into destination
-      // coords.
-      buffer->SetTransform(maskTransform);
-      buffer->MaskSurface(source, sourceMask, Point(0, 0));
-      buffer->SetTransform(old);
-
-      buffer->PopClip();
-    } else {
-      buffer->DrawSurface(temp, transformBounds, transformBounds);
-    }
+    buffer->DrawSurface(temp, transformBounds, transformBounds);
   }
 
   buffer->PopClip();
 }
 
 void
 BasicCompositor::ClearRect(const gfx::Rect& aRect)
 {
deleted file mode 100644
--- a/layout/reftests/layers/mask-layer-transform-ref.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
-<body>
-    <div style="position:relative; left: 400px; width: 200px; height: 200px; overflow:hidden; border-radius: 20px;">
-        <div style="width:200px; height:200px; background-color:red; transform: perspective(100px) rotateY(10deg)"></div>
-    </div>
-</body>
-</html>
-
deleted file mode 100644
--- a/layout/reftests/layers/mask-layer-transform.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html>
-<body>
-    <div style="width:200px; height: 200px; transform: translate(400px);">
-        <div style="width: 200px; height: 200px; overflow:hidden; border-radius: 20px;">
-            <div style="width:200px; height:200px; background-color:red; transform: perspective(100px) rotateY(10deg)"></div>
-        </div>
-  </div>
-</body>
-</html>
-
--- a/layout/reftests/layers/reftest.list
+++ b/layout/reftests/layers/reftest.list
@@ -14,9 +14,8 @@ skip != pull-background-animated-positio
 skip != pull-background-animated-position-5.html about:blank # Fails because ownLayer bounds don't anticipate changes of animated contents, but doesn't fail with event regions
 skip-if(!asyncPan) != pull-background-displayport-1.html about:blank
 skip-if(!asyncPan) != pull-background-displayport-2.html about:blank
 skip-if(!asyncPan) != pull-background-displayport-3.html about:blank # fails with non-overlay scrollbars and event regions due to bug 1148515
 skip-if(!asyncPan) != pull-background-displayport-4.html about:blank # fails with non-overlay scrollbars and event regions due to bug 1148515
 skip-if(!asyncPan) != pull-background-displayport-5.html about:blank
 skip-if(!asyncPan) != pull-background-displayport-6.html about:blank # fails with non-overlay scrollbars and event regions due to bug 1148515
 fuzzy(2,30150) == opacity-blending.html opacity-blending-ref.html
-fuzzy(1,5) == mask-layer-transform.html mask-layer-transform-ref.html