Bug 1122526 - Part: Factor in the scale from ancestors when computing scale for layer with OMT animation of transform. r=roc, a=kglazko
authorL. David Baron <dbaron@dbaron.org>
Mon, 29 Jun 2015 16:46:16 -0700
changeset 268730 3fd68ce65b18f741a39800cfbabb644ba1f4d84b
parent 268729 f328f92cab6b1ac510b351a426d64d3fd9035265
child 268731 d86a0d1ec280203005eecdf6cf8fc8af596eab5a
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-esr52@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, kglazko
bugs1122526
milestone41.0a2
Bug 1122526 - Part: Factor in the scale from ancestors when computing scale for layer with OMT animation of transform. r=roc, a=kglazko
layout/base/FrameLayerBuilder.cpp
layout/reftests/transform/animate-layer-scale-inherit-1-ref.html
layout/reftests/transform/animate-layer-scale-inherit-1.html
layout/reftests/transform/reftest.list
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -4695,19 +4695,24 @@ ChooseScaleAndSetTransform(FrameLayerBui
   gfxSize scale;
   // XXX Should we do something for 3D transforms?
   if (canDraw2D) {
     // If the container's transform is animated off main thread, fix a suitable scale size
     // for animation
     if (aContainerFrame->GetContent() &&
         nsLayoutUtils::HasAnimationsForCompositor(
           aContainerFrame->GetContent(), eCSSProperty_transform)) {
+      // compute scale using the animation on the container (ignoring
+      // its ancestors)
       scale = nsLayoutUtils::ComputeSuitableScaleForAnimation(
                 aContainerFrame->GetContent(), aVisibleRect.Size(),
                 aContainerFrame->PresContext()->GetVisibleArea().Size());
+      // multiply by the scale inherited from ancestors
+      scale.width *= aIncomingScale.mXScale;
+      scale.height *= aIncomingScale.mYScale;
     } else {
       // Scale factors are normalized to a power of 2 to reduce the number of resolution changes
       scale = RoundToFloatPrecision(ThebesMatrix(transform2d).ScaleFactors(true));
       // For frames with a changing transform that's not just a translation,
       // round scale factors up to nearest power-of-2 boundary so that we don't
       // keep having to redraw the content as it scales up and down. Rounding up to nearest
       // power-of-2 boundary ensures we never scale up, only down --- avoiding
       // jaggies. It also ensures we never scale down by more than a factor of 2,
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/animate-layer-scale-inherit-1-ref.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<title>Testcase, bug 1122526</title>
+<style>
+
+#outer, #inner {
+  display: inline-block;
+  background: white;
+  color: black;
+}
+
+#inner {
+  vertical-align: top;
+  height: 100px;
+  width: 100px;
+  background: repeating-linear-gradient(to top left, yellow, blue 10px);
+  will-change: transform;
+}
+
+</style>
+
+<div id="outer">
+  <div id="inner">
+  </div>
+</div>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform/animate-layer-scale-inherit-1.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<title>Testcase, bug 1122526</title>
+<style>
+
+#outer, #inner {
+  display: inline-block;
+  background: white;
+  color: black;
+}
+#outer { transform: scale(5) }
+#inner { animation: HoldTransform linear infinite 1s }
+#inner {
+  vertical-align: top;
+  height: 100px;
+  width: 100px;
+  background: repeating-linear-gradient(to top left, yellow, blue 10px);
+}
+@keyframes HoldTransform {
+  from, to { transform: scale(0.2) }
+}
+
+</style>
+
+<div id="outer">
+  <div id="inner">
+  </div>
+</div>
--- a/layout/reftests/transform/reftest.list
+++ b/layout/reftests/transform/reftest.list
@@ -127,8 +127,10 @@ skip-if(B2G||Mulet) == stresstest-1.html
 pref(svg.transform-origin.enabled,true) == transform-box-svg-1a.svg transform-box-svg-1-ref.svg
 pref(svg.transform-origin.enabled,true) == transform-box-svg-1b.svg transform-box-svg-1-ref.svg
 pref(svg.transform-origin.enabled,true) == transform-box-svg-2a.svg transform-box-svg-2-ref.svg
 pref(svg.transform-origin.enabled,true) == transform-box-svg-2b.svg transform-box-svg-2-ref.svg
 pref(svg.transform-origin.enabled,true) == transform-origin-svg-1a.svg transform-origin-svg-1-ref.svg
 pref(svg.transform-origin.enabled,true) == transform-origin-svg-1b.svg transform-origin-svg-1-ref.svg
 pref(svg.transform-origin.enabled,true) == transform-origin-svg-2a.svg transform-origin-svg-2-ref.svg
 pref(svg.transform-origin.enabled,true) == transform-origin-svg-2b.svg transform-origin-svg-2-ref.svg
+# Bug 1122526
+== animate-layer-scale-inherit-1.html animate-layer-scale-inherit-1-ref.html