Bug 777194. Part 8: Nudge transform matrix in ChooseScaleAndSetTransform to avoid math error. r=tnikkel
authorRobert O'Callahan <robert@ocallahan.org>
Sat, 25 Aug 2012 16:41:46 +1200
changeset 107340 22a46f5dca2be1fb16eca99bc251740c86ff781b
parent 107339 d756d091d9c800e1e0f07256dad9e216b634a1fd
child 107341 89003d5bfa07f7c3604c1a62e8b2974d439a7a10
push id14987
push userrocallahan@mozilla.com
push dateTue, 18 Sep 2012 09:34:32 +0000
treeherdermozilla-inbound@be9f5e549658 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs777194
milestone18.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 777194. Part 8: Nudge transform matrix in ChooseScaleAndSetTransform to avoid math error. r=tnikkel
layout/base/FrameLayerBuilder.cpp
layout/reftests/transform-3d/reftest.list
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -2178,16 +2178,20 @@ ChooseScaleAndSetTransform(FrameLayerBui
 {
   nsIntPoint offset;
 
   gfx3DMatrix transform =
     gfx3DMatrix::ScalingMatrix(aIncomingScale.mXScale, aIncomingScale.mYScale, 1.0);
   if (aTransform) {
     // aTransform is applied first, then the scale is applied to the result
     transform = (*aTransform)*transform;
+    // Set any matrix entries close to integers to be those exact integers.
+    // This protects against floating-point inaccuracies causing problems
+    // in the checks below.
+    transform.NudgeToIntegers();
   } 
   if (aContainerFrame && aState == LAYER_INACTIVE) {
     // When we have an inactive ContainerLayer, translate the container by the offset to the
     // reference frame (and offset all child layers by the reverse) so that the coordinate
     // space of the child layers isn't affected by scrolling.
     nsPoint appUnitOffset = aDisplayListBuilder->ToReferenceFrame(aContainerFrame);
     nscoord appUnitsPerDevPixel = aContainerFrame->PresContext()->AppUnitsPerDevPixel();
     offset = nsIntPoint(
--- a/layout/reftests/transform-3d/reftest.list
+++ b/layout/reftests/transform-3d/reftest.list
@@ -5,17 +5,29 @@
 # Check that the perspectve() transform function results in some visual changes
 != rotatex-perspective-1a.html rotatex-1-ref.html
 # Check that -moz-perspective results in visual changes to child transformed elements
 != rotatex-perspective-1b.html rotatex-1-ref.html
 # -moz-perspective should only apply to child elements
 == rotatex-perspective-1c.html rotatex-1-ref.html
 fails-if(Android) == rotatex-perspective-3a.html rotatex-perspective-3-ref.html # bug 755543
 == scalez-1a.html scalez-1-ref.html
-fails-if(cocoaWidget) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fuzzy-if(/^Windows\x20NT\x205\.1/.test(http.oscpu),255,178) == preserve3d-1a.html preserve3d-1-ref.html
+== rotatey-1a.html rotatey-1-ref.html 
+== rotatex-1a.html rotatex-1-ref.html 
+# Check that scaleZ(-1) rotateX(180deg) is the same as rotateY(180deg)
+== scalezrotatex-1.html scalezrotatex-1-ref.html
+# Check that the perspectve() transform function results in some visual changes
+!= rotatex-perspective-1a.html rotatex-1-ref.html
+# Check that -moz-perspective results in visual changes to child transformed elements
+!= rotatex-perspective-1b.html rotatex-1-ref.html
+# -moz-perspective should only apply to child elements
+== rotatex-perspective-1c.html rotatex-1-ref.html
+fails-if(Android) == rotatex-perspective-3a.html rotatex-perspective-3-ref.html # bug 755543
+== scalez-1a.html scalez-1-ref.html
+== preserve3d-1a.html preserve3d-1-ref.html
 == preserve3d-1b.html about:blank
 == preserve3d-clipped.html about:blank 
 == preserve3d-2a.html preserve3d-2-ref.html
 == preserve3d-2b.html preserve3d-2-ref.html
 == preserve3d-2c.html preserve3d-2-ref.html
 == preserve3d-2d.html preserve3d-2-ref.html
 == preserve3d-3a.html preserve3d-3-ref.html
 == preserve3d-4a.html green-rect.html