Bug 740072 - Make perspective-origin check the style parent instead of frame parent. r=roc
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 27 Apr 2012 12:24:53 +1200
changeset 92578 1751cbffa7084e4ea4c0a149dfd44e3ea93c7ee9
parent 92577 20f5d6d265cb16b1ff206966cceab4eee6cb8255
child 92579 3ca6df58d05d3ceab3fcca20643695aac5a97d7e
push id22544
push useremorley@mozilla.com
push dateFri, 27 Apr 2012 11:53:27 +0000
treeherdermozilla-central@d871849ac3a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs740072
milestone15.0a1
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
Bug 740072 - Make perspective-origin check the style parent instead of frame parent. r=roc
layout/base/nsDisplayList.cpp
layout/reftests/transform-3d/perspective-origin-3-ref.html
layout/reftests/transform-3d/perspective-origin-3a.html
layout/reftests/transform-3d/reftest.list
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -2484,17 +2484,17 @@ gfxPoint3D GetDeltaToMozPerspectiveOrigi
   /* For both of the coordinates, if the value of -moz-perspective-origin is a
    * percentage, it's relative to the size of the frame.  Otherwise, if it's
    * a distance, it's already computed for us!
    */
 
   //TODO: Should this be using our bounds or the parent's bounds?
   // How do we handle aBoundsOverride in the latter case?
   nsIFrame* parent = aFrame->GetParentStyleContextFrame();
-  const nsStyleDisplay* display = aFrame->GetParent()->GetStyleDisplay();
+  const nsStyleDisplay* display = parent->GetStyleDisplay();
   nsRect boundingRect = nsDisplayTransform::GetFrameBoundsForTransform(parent);
 
   /* Allows us to access named variables by index. */
   gfxPoint3D result;
   result.z = 0.0f;
   gfxFloat* coords[2] = {&result.x, &result.y};
   const nscoord* dimensions[2] =
     {&boundingRect.width, &boundingRect.height};
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform-3d/perspective-origin-3-ref.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <style type="text/css">
+
+.parentWithPerspective {
+  -moz-perspective: 100px;
+  -moz-perspective-origin: 150px 150px;
+  -webkit-perspective: 100px;
+  -webkit-perspective-origin: 150px 150px;
+  /* Changing width/height to 500px should not change the rendering. */
+  height:100%;
+}
+
+.parentWithPerspective > div {
+  position:absolute;
+  top:100px;
+  left:100px;
+  width:100px;
+  height:100px;
+}
+
+.notTransformed {
+  outline: 1px solid black;
+}
+
+.transformed {
+  background:blue;
+  -moz-transform-origin: 0% 0%;
+  -moz-transform: rotateY(45deg);
+  -webkit-transform-origin: 0% 0%;
+  -webkit-transform: rotateY(45deg);
+}
+
+  </style>
+  <body>
+    <div class="parentWithPerspective">
+      <div class="notTransformed"></div>
+      <div class="transformed"></div>
+    </div>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform-3d/perspective-origin-3a.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <style type="text/css">
+
+.parentWithPerspective {
+  -moz-perspective: 100px;
+  -moz-perspective-origin: 150px 150px;
+  -webkit-perspective: 100px;
+  -webkit-perspective-origin: 150px 150px;
+  /* Changing width/height to 500px should not change the rendering. */
+  height:500px;
+}
+
+.parentWithPerspective > div {
+  position:absolute;
+  top:100px;
+  left:100px;
+  width:100px;
+  height:100px;
+}
+
+.notTransformed {
+  outline: 1px solid black;
+}
+
+.transformed {
+  background:blue;
+  -moz-transform-origin: 0% 0%;
+  -moz-transform: rotateY(45deg);
+  -webkit-transform-origin: 0% 0%;
+  -webkit-transform: rotateY(45deg);
+}
+
+  </style>
+  <body>
+    <div class="parentWithPerspective">
+      <div class="notTransformed"></div>
+      <div class="transformed"></div>
+    </div>
+  </body>
+</html>
--- a/layout/reftests/transform-3d/reftest.list
+++ b/layout/reftests/transform-3d/reftest.list
@@ -33,16 +33,17 @@ fuzzy-if(d2d&&layersGPUAccelerated,52,68
 == rotate3d-2a.html rotatey-1-ref.html
 != backface-visibility-1a.html about:blank
 == backface-visibility-1b.html about:blank
 == backface-visibility-1c.html about:blank
 == backface-visibility-2.html backface-visibility-2-ref.html
 != perspective-origin-1a.html rotatex-perspective-1a.html
 == perspective-origin-1b.html perspective-origin-1a.html
 == perspective-origin-2a.html perspective-origin-2-ref.html
+== perspective-origin-3a.html perspective-origin-3-ref.html
 != sorting-1a.html sorting-1-ref.html
 # Parallel planes, different z depth
 == sorting-2a.html sorting-2-ref.html
 # Parallel planes, same z depth (shouldn't be sorted!)
 == sorting-2b.html sorting-2-ref.html
 == sorting-3a.html green-rect.html
 # Different, but equivalent (for the given transform) transform origins
 == rotatex-transformorigin-1a.html rotatex-transformorigin-1-ref.html