Backing out changeset 4624fef36355 (bug 445081) due to test failures on Windows and Mac
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 15 Jul 2008 16:36:19 +1200
changeset 15940 8ae5f2fa49a2b58915fbb27027c28ce3f18074f7
parent 15939 a49e10c4b87a7a969fdf73f3f5d05d3611d82d2b
child 15941 e9ee20aece3640d72f7e3e16cc398ca4360f4fd9
push idunknown
push userunknown
push dateunknown
bugs445081
milestone1.9.1a1pre
Backing out changeset 4624fef36355 (bug 445081) due to test failures on Windows and Mac
content/svg/content/src/nsSVGSVGElement.cpp
layout/svg/base/src/nsSVGGlyphFrame.cpp
layout/svg/base/src/nsSVGUtils.cpp
layout/svg/base/src/nsSVGUtils.h
--- a/content/svg/content/src/nsSVGSVGElement.cpp
+++ b/content/svg/content/src/nsSVGSVGElement.cpp
@@ -1396,17 +1396,17 @@ nsSVGSVGElement::GetLength(PRUint8 aCtxT
   }
 
   switch (aCtxType) {
   case nsSVGUtils::X:
     return w;
   case nsSVGUtils::Y:
     return h;
   case nsSVGUtils::XY:
-    return nsSVGUtils::ComputeNormalizedHypotenuse(w, h);
+    return (float)sqrt((w*w+h*h)/2.0);
   }
   return 0;
 }
 
 float
 nsSVGSVGElement::GetMMPerPx(PRUint8 aCtxType)
 {
   if (mCoordCtxMmPerPx == 0.0f) {
--- a/layout/svg/base/src/nsSVGGlyphFrame.cpp
+++ b/layout/svg/base/src/nsSVGGlyphFrame.cpp
@@ -1225,17 +1225,17 @@ nsSVGGlyphFrame::EnsureTextRun(float *aD
       if (!GetGlobalTransform(&m))
         return PR_FALSE;
     }
 
     // The context scale is the ratio of the length of the transformed
     // diagonal vector (1,1) to the length of the untransformed diagonal
     // (which is sqrt(2)).
     gfxPoint p = m.Transform(gfxPoint(1, 1)) - m.Transform(gfxPoint(0, 0));
-    double contextScale = nsSVGUtils::ComputeNormalizedHypotenuse(p.x, p.y);
+    double contextScale = sqrt((p.x*p.x + p.y*p.y)/2);
 
     nsCAutoString langGroup;
     nsIAtom *langGroupAtom = presContext->GetLangGroup();
     if (langGroupAtom) {
       const char* lg;
       langGroupAtom->GetUTF8String(&lg);
       langGroup.Assign(lg);
     }
--- a/layout/svg/base/src/nsSVGUtils.cpp
+++ b/layout/svg/base/src/nsSVGUtils.cpp
@@ -940,39 +940,33 @@ nsSVGUtils::NotifyAncestorsOfFilterRegio
                             (aFrame->GetProperty(nsGkAtoms::filter));
       property->Invalidate();
     }
     aFrame = aFrame->GetParent();
   }
 }
 
 float
-nsSVGUtils::ComputeNormalizedHypotenuse(float aWidth, float aHeight)
-{
-  return sqrt((aWidth*aWidth + aHeight*aHeight)/2);
-}
-
-float
 nsSVGUtils::ObjectSpace(nsIDOMSVGRect *aRect, nsSVGLength2 *aLength)
 {
   float fraction, axis;
 
   switch (aLength->GetCtxType()) {
   case X:
     aRect->GetWidth(&axis);
     break;
   case Y:
     aRect->GetHeight(&axis);
     break;
   case XY:
   {
     float width, height;
     aRect->GetWidth(&width);
     aRect->GetHeight(&height);
-    axis = ComputeNormalizedHypotenuse(width, height);
+    axis = sqrt(width * width + height * height)/sqrt(2.0f);
   }
   }
 
   if (aLength->IsPercentage()) {
     fraction = aLength->GetAnimValInSpecifiedUnits() / 100;
   } else
     fraction = aLength->GetAnimValue(static_cast<nsSVGSVGElement*>
                                                 (nsnull));
--- a/layout/svg/base/src/nsSVGUtils.h
+++ b/layout/svg/base/src/nsSVGUtils.h
@@ -278,21 +278,16 @@ public:
   /*
    * Update the filter invalidation region for ancestor frames, if relevant.
    */
   static void NotifyAncestorsOfFilterRegionChange(nsIFrame *aFrame);
 
   /* enum for specifying coordinate direction for ObjectSpace/UserSpace */
   enum ctxDirection { X, Y, XY };
 
-  /**
-   * Computes sqrt((aWidth^2 + aHeight^2)/2);
-   */
-  static float ComputeNormalizedHypotenuse(float aWidth, float aHeight);
-
   /* Computes the input length in terms of object space coordinates.
      Input: rect - bounding box
             length - length to be converted
   */
   static float ObjectSpace(nsIDOMSVGRect *aRect, nsSVGLength2 *aLength);
 
   /* Computes the input length in terms of user space coordinates.
      Input: content - object to be used for determining user space