Bug 704469 - Use style context parent instead of frame parent when looking up perspective for 3d transforms. r=roc
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 04 Jan 2012 13:38:57 +1300
changeset 83710 7d6b4a1557f476a79acaf272e56ea5ad64b69fe4
parent 83709 6840cbb0b4cfd332db08b53dfaff646248dbae4b
child 83711 56ee31100cf6a90221cb072a3f4bc74737efd58f
push id21784
push usermak77@bonardo.net
push dateWed, 04 Jan 2012 12:28:24 +0000
treeherdermozilla-central@0eec6ba6a87a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs704469
milestone12.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 704469 - Use style context parent instead of frame parent when looking up perspective for 3d transforms. r=roc
layout/base/nsDisplayList.cpp
layout/reftests/transform-3d/overflow-hidden-1-ref.html
layout/reftests/transform-3d/overflow-hidden-1a.html
layout/reftests/transform-3d/reftest.list
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -2533,18 +2533,19 @@ nsDisplayTransform::GetResultingTransfor
                                                     aFrame->PresContext(),
                                                     dummy, bounds, aFactor);
   } else {
      NS_ASSERTION(aFrame->GetStyleDisplay()->mTransformStyle == NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D,
                   "If we don't have a transform, then we must be at least attempting to preserve the transforms of our children");
   }
 
   const nsStyleDisplay* parentDisp = nsnull;
-  if (aFrame->GetParent()) {
-    parentDisp = aFrame->GetParent()->GetStyleDisplay();
+  nsStyleContext* parentStyleContext = aFrame->GetStyleContext()->GetParent();
+  if (parentStyleContext) {
+    parentDisp = parentStyleContext->GetStyleDisplay();
   }
   if (nsLayoutUtils::Are3DTransformsEnabled() &&
       parentDisp && parentDisp->mChildPerspective.GetUnit() == eStyleUnit_Coord &&
       parentDisp->mChildPerspective.GetCoordValue() > 0.0) {
     gfx3DMatrix perspective;
     perspective._34 =
       -1.0 / NSAppUnitsToFloatPixels(parentDisp->mChildPerspective.GetCoordValue(),
                                      aFactor);
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform-3d/overflow-hidden-1-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html><head>
+<style type="text/css">
+	.stage{
+		-moz-perspective:  700px;
+		overflow: hidden;
+		width: 260px;
+		height: 260px;
+		display: block;
+	}
+	
+	.box {
+		width: 170px;
+		height: 170px;
+		background-color: red;
+		display:  block;
+		-moz-transform: rotate3d(0,1,0, 50deg) translatey(20px);
+	}
+	
+	</style>
+</head>
+
+<body id="body">
+	<div class="stage">
+		<div class="box"></div>
+	</div>
+</body></html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/transform-3d/overflow-hidden-1a.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html><head>
+<style type="text/css">
+	.stage{
+		-moz-perspective:  700px;
+		overflow: hidden;
+		width: 260px;
+		height: 260px;
+		display: block;
+	}
+	
+	.box {
+		width: 170px;
+		height: 170px;
+		background-color: red;
+		display:  block;
+		-moz-transform: rotate3d(0,1,0, 50deg) translatey(20px);
+	}
+	
+	</style>
+</head>
+
+<body id="body">
+	<div class="stage">
+		<div class="box"></div>
+	</div>
+</body></html>
--- a/layout/reftests/transform-3d/reftest.list
+++ b/layout/reftests/transform-3d/reftest.list
@@ -36,8 +36,9 @@ fails == preserve3d-1a.html preserve3d-1
 != 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
+== overflow-hidden-1a.html overflow-hidden-1-ref.html