Bug 1060165: Remove gfxPoint3D r=nical
authorDavid Zbarsky <dzbarsky@gmail.com>
Fri, 29 Aug 2014 14:47:30 -0400
changeset 202498 2123851421e66b93cf312045a0d2fc9f762eb569
parent 202377 11e4f1678eaba483e926440ab2ef8fe0e0dde99e
child 202499 8430feba614862cabbbaf26c2ffe4a294317102f
push id27402
push userryanvm@gmail.com
push dateSat, 30 Aug 2014 16:25:31 +0000
treeherdermozilla-central@983cf2175495 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1060165
milestone34.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 1060165: Remove gfxPoint3D r=nical
gfx/ipc/GfxMessageUtils.h
gfx/layers/LayerSorter.cpp
gfx/layers/LayerTreeInvalidation.cpp
gfx/layers/composite/AsyncCompositionManager.cpp
gfx/layers/d3d10/ThebesLayerD3D10.cpp
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/ipc/LayersMessages.ipdlh
gfx/thebes/gfx3DMatrix.cpp
gfx/thebes/gfx3DMatrix.h
gfx/thebes/gfxPoint3D.h
gfx/thebes/moz.build
layout/base/nsDisplayList.cpp
layout/base/nsDisplayList.h
layout/base/nsLayoutUtils.cpp
layout/style/StyleAnimationValue.cpp
layout/style/nsStyleTransformMatrix.cpp
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -12,17 +12,16 @@
 #include "ipc/IPCMessageUtils.h"
 
 #include <stdint.h>
 
 #include "gfxColor.h"
 #include "mozilla/gfx/Matrix.h"
 #include "GraphicsFilter.h"
 #include "gfxPoint.h"
-#include "gfxPoint3D.h"
 #include "gfxRect.h"
 #include "nsRect.h"
 #include "nsRegion.h"
 #include "gfxTypes.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/layers/CompositorTypes.h"
 #include "FrameMetrics.h"
 #include "FilterSupport.h"
@@ -150,36 +149,16 @@ struct ParamTraits<gfxPoint>
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
     return (ReadParam(aMsg, aIter, &aResult->x) &&
             ReadParam(aMsg, aIter, &aResult->y));
  }
 };
 
 template<>
-struct ParamTraits<gfxPoint3D>
-{
-  typedef gfxPoint3D paramType;
-
-  static void Write(Message* aMsg, const paramType& aParam)
-  {
-    WriteParam(aMsg, aParam.x);
-    WriteParam(aMsg, aParam.y);
-    WriteParam(aMsg, aParam.z);
-  }
-
-  static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
-  {
-    return (ReadParam(aMsg, aIter, &aResult->x) &&
-            ReadParam(aMsg, aIter, &aResult->y) &&
-            ReadParam(aMsg, aIter, &aResult->z));
-  }
-};
-
-template<>
 struct ParamTraits<gfxSize>
 {
   typedef gfxSize paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, aParam.width);
     WriteParam(aMsg, aParam.height);
--- a/gfx/layers/LayerSorter.cpp
+++ b/gfx/layers/LayerSorter.cpp
@@ -8,17 +8,16 @@
 #include <stdint.h>                     // for uint32_t
 #include <stdio.h>                      // for fprintf, stderr, FILE
 #include <stdlib.h>                     // for getenv
 #include "DirectedGraph.h"              // for DirectedGraph
 #include "Layers.h"                     // for Layer
 #include "gfx3DMatrix.h"                // for gfx3DMatrix
 #include "gfxLineSegment.h"             // for gfxLineSegment
 #include "gfxPoint.h"                   // for gfxPoint
-#include "gfxPoint3D.h"                 // for gfxPoint3D
 #include "gfxQuad.h"                    // for gfxQuad
 #include "gfxRect.h"                    // for gfxRect
 #include "gfxTypes.h"                   // for gfxFloat
 #include "mozilla/gfx/BasePoint3D.h"    // for BasePoint3D
 #include "nsRegion.h"                   // for nsIntRegion
 #include "nsTArray.h"                   // for nsTArray, etc
 #include "limits.h"
 #include "mozilla/Assertions.h"
@@ -39,20 +38,20 @@ enum LayerSortOrder {
  * of a line through the point in the z direction and the transformed plane.
  *
  * We want to solve:
  *
  * point = normal . (p0 - l0) / normal . l
  */
 static gfxFloat RecoverZDepth(const gfx3DMatrix& aTransform, const gfxPoint& aPoint)
 {
-    const gfxPoint3D l(0, 0, 1);
-    gfxPoint3D l0 = gfxPoint3D(aPoint.x, aPoint.y, 0);
-    gfxPoint3D p0 = aTransform.Transform3D(gfxPoint3D(0, 0, 0));
-    gfxPoint3D normal = aTransform.GetNormalVector();
+    const Point3D l(0, 0, 1);
+    Point3D l0 = Point3D(aPoint.x, aPoint.y, 0);
+    Point3D p0 = aTransform.Transform3D(Point3D(0, 0, 0));
+    Point3D normal = aTransform.GetNormalVector();
 
     gfxFloat n = normal.DotProduct(p0 - l0); 
     gfxFloat d = normal.DotProduct(l);
 
     if (!d) {
         return 0;
     }
 
--- a/gfx/layers/LayerTreeInvalidation.cpp
+++ b/gfx/layers/LayerTreeInvalidation.cpp
@@ -5,17 +5,16 @@
 
 #include "LayerTreeInvalidation.h"
 #include <stdint.h>                     // for uint32_t
 #include "ImageContainer.h"             // for ImageContainer
 #include "ImageLayers.h"                // for ImageLayer, etc
 #include "Layers.h"                     // for Layer, ContainerLayer, etc
 #include "gfxColor.h"                   // for gfxRGBA
 #include "GraphicsFilter.h"             // for GraphicsFilter
-#include "gfxPoint3D.h"                 // for gfxPoint3D
 #include "gfxRect.h"                    // for gfxRect
 #include "gfxUtils.h"                   // for gfxUtils
 #include "mozilla/gfx/BaseSize.h"       // for BaseSize
 #include "mozilla/gfx/Point.h"          // for IntSize
 #include "mozilla/mozalloc.h"           // for operator new, etc
 #include "nsAutoPtr.h"                  // for nsRefPtr, nsAutoPtr, etc
 #include "nsDataHashtable.h"            // for nsDataHashtable
 #include "nsDebug.h"                    // for NS_ASSERTION
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -6,17 +6,16 @@
 
 #include "mozilla/layers/AsyncCompositionManager.h"
 #include <stdint.h>                     // for uint32_t
 #include "CompositorParent.h"           // for CompositorParent, etc
 #include "FrameMetrics.h"               // for FrameMetrics
 #include "LayerManagerComposite.h"      // for LayerManagerComposite, etc
 #include "Layers.h"                     // for Layer, ContainerLayer, etc
 #include "gfxPoint.h"                   // for gfxPoint, gfxSize
-#include "gfxPoint3D.h"                 // for gfxPoint3D
 #include "mozilla/StyleAnimationValue.h" // for StyleAnimationValue, etc
 #include "mozilla/WidgetUtils.h"        // for ComputeTransformForRotation
 #include "mozilla/dom/AnimationPlayer.h" // for AnimationPlayer
 #include "mozilla/gfx/BaseRect.h"       // for BaseRect
 #include "mozilla/gfx/Point.h"          // for RoundedToInt, PointTyped
 #include "mozilla/gfx/Rect.h"           // for RoundedToInt, RectTyped
 #include "mozilla/gfx/ScaleFactor.h"    // for ScaleFactor
 #include "mozilla/layers/AsyncPanZoomController.h"
@@ -374,34 +373,34 @@ SampleValue(float aPortion, Animation& a
     interpolatedValue.GetCSSValueSharedListValue();
 
   TransformData& data = aAnimation.data().get_TransformData();
   nsPoint origin = data.origin();
   // we expect all our transform data to arrive in css pixels, so here we must
   // adjust to dev pixels.
   double cssPerDev = double(nsDeviceContext::AppUnitsPerCSSPixel())
                      / double(data.appUnitsPerDevPixel());
-  gfxPoint3D transformOrigin = data.transformOrigin();
+  Point3D transformOrigin = data.transformOrigin();
   transformOrigin.x = transformOrigin.x * cssPerDev;
   transformOrigin.y = transformOrigin.y * cssPerDev;
-  gfxPoint3D perspectiveOrigin = data.perspectiveOrigin();
+  Point3D perspectiveOrigin = data.perspectiveOrigin();
   perspectiveOrigin.x = perspectiveOrigin.x * cssPerDev;
   perspectiveOrigin.y = perspectiveOrigin.y * cssPerDev;
   nsDisplayTransform::FrameTransformProperties props(interpolatedList,
                                                      transformOrigin,
                                                      perspectiveOrigin,
                                                      data.perspective());
   gfx3DMatrix transform =
     nsDisplayTransform::GetResultingTransformMatrix(props, origin,
                                                     data.appUnitsPerDevPixel(),
                                                     &data.bounds());
-  gfxPoint3D scaledOrigin =
-    gfxPoint3D(NS_round(NSAppUnitsToFloatPixels(origin.x, data.appUnitsPerDevPixel())),
-               NS_round(NSAppUnitsToFloatPixels(origin.y, data.appUnitsPerDevPixel())),
-               0.0f);
+  Point3D scaledOrigin =
+    Point3D(NS_round(NSAppUnitsToFloatPixels(origin.x, data.appUnitsPerDevPixel())),
+            NS_round(NSAppUnitsToFloatPixels(origin.y, data.appUnitsPerDevPixel())),
+            0.0f);
 
   transform.Translate(scaledOrigin);
 
   InfallibleTArray<TransformFunction> functions;
   functions.AppendElement(TransformMatrix(ToMatrix4x4(transform)));
   *aValue = functions;
 }
 
@@ -877,17 +876,17 @@ AsyncCompositionManager::TransformScroll
   oldTransform.Scale(metrics.mResolution.scale, metrics.mResolution.scale, 1);
 
   // Make sure that overscroll and under-zoom are represented in the old
   // transform so that fixed position content moves and scales accordingly.
   // These calculations will effectively scale and offset fixed position layers
   // in screen space when the compensatory transform is performed in
   // AlignFixedAndStickyLayers.
   ScreenRect contentScreenRect = mContentRect * userZoom;
-  gfxPoint3D overscrollTranslation;
+  Point3D overscrollTranslation;
   if (userScroll.x < contentScreenRect.x) {
     overscrollTranslation.x = contentScreenRect.x - userScroll.x;
   } else if (userScroll.x + metrics.mCompositionBounds.width > contentScreenRect.XMost()) {
     overscrollTranslation.x = contentScreenRect.XMost() -
       (userScroll.x + metrics.mCompositionBounds.width);
   }
   if (userScroll.y < contentScreenRect.y) {
     overscrollTranslation.y = contentScreenRect.y - userScroll.y;
--- a/gfx/layers/d3d10/ThebesLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ThebesLayerD3D10.cpp
@@ -344,17 +344,17 @@ ThebesLayerD3D10::FillTexturesBlackWhite
     nsIntSize oldVP = mD3DManager->GetViewport();
 
     mD3DManager->SetViewport(nsIntSize(desc.Width, desc.Height));
 
     ID3D10RenderTargetView *views[2] = { viewBlack, viewWhite };
     device()->OMSetRenderTargets(2, views, nullptr);
 
     gfx3DMatrix transform;
-    transform.Translate(gfxPoint3D(-aOffset.x, -aOffset.y, 0));
+    transform.Translate(Point3D(-aOffset.x, -aOffset.y, 0));
     void* raw = &const_cast<gfx3DMatrix&>(transform)._11;
     effect()->GetVariableByName("mLayerTransform")->SetRawValue(raw, 0, 64);
 
     ID3D10EffectTechnique *technique =
       effect()->GetTechniqueByName("PrepareAlphaExtractionTextures");
 
     nsIntRegionRectIterator iter(aRegion);
 
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -6,17 +6,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "LayerTransactionParent.h"
 #include <vector>                       // for vector
 #include "CompositableHost.h"           // for CompositableParent, Get, etc
 #include "ImageLayers.h"                // for ImageLayer
 #include "Layers.h"                     // for Layer, ContainerLayer, etc
 #include "ShadowLayerParent.h"          // for ShadowLayerParent
-#include "gfxPoint3D.h"                 // for gfxPoint3D
 #include "CompositableTransactionParent.h"  // for EditReplyVector
 #include "ShadowLayersManager.h"        // for ShadowLayersManager
 #include "mozilla/gfx/BasePoint3D.h"    // for BasePoint3D
 #include "mozilla/layers/CanvasLayerComposite.h"
 #include "mozilla/layers/ColorLayerComposite.h"
 #include "mozilla/layers/Compositor.h"  // for Compositor
 #include "mozilla/layers/ContainerLayerComposite.h"
 #include "mozilla/layers/ImageLayerComposite.h"
@@ -646,40 +645,40 @@ LayerTransactionParent::RecvGetAnimation
   Matrix4x4 transform = layer->AsLayerComposite()->GetShadowTransform();
   if (ContainerLayer* c = layer->AsContainerLayer()) {
     // Undo the scale transform applied by AsyncCompositionManager::SampleValue
     transform.ScalePost(1.0f/c->GetInheritedXScale(),
                         1.0f/c->GetInheritedYScale(),
                         1.0f);
   }
   float scale = 1;
-  gfxPoint3D scaledOrigin;
-  gfxPoint3D transformOrigin;
+  Point3D scaledOrigin;
+  Point3D transformOrigin;
   for (uint32_t i=0; i < layer->GetAnimations().Length(); i++) {
     if (layer->GetAnimations()[i].data().type() == AnimationData::TTransformData) {
       const TransformData& data = layer->GetAnimations()[i].data().get_TransformData();
       scale = data.appUnitsPerDevPixel();
       scaledOrigin =
-        gfxPoint3D(NS_round(NSAppUnitsToFloatPixels(data.origin().x, scale)),
-                   NS_round(NSAppUnitsToFloatPixels(data.origin().y, scale)),
-                   0.0f);
+        Point3D(NS_round(NSAppUnitsToFloatPixels(data.origin().x, scale)),
+                NS_round(NSAppUnitsToFloatPixels(data.origin().y, scale)),
+                0.0f);
       double cssPerDev =
         double(nsDeviceContext::AppUnitsPerCSSPixel()) / double(scale);
       transformOrigin = data.transformOrigin() * cssPerDev;
       break;
     }
   }
 
   // Undo the translation to the origin of the reference frame applied by
   // AsyncCompositionManager::SampleValue
   transform.Translate(-scaledOrigin.x, -scaledOrigin.y, -scaledOrigin.z);
 
   // Undo the rebasing applied by
   // nsDisplayTransform::GetResultingTransformMatrixInternal
-  gfxPoint3D basis = -scaledOrigin - transformOrigin;
+  Point3D basis = -scaledOrigin - transformOrigin;
   transform.ChangeBasis(basis.x, basis.y, basis.z);
 
   // Convert to CSS pixels (this undoes the operations performed by
   // nsStyleTransformMatrix::ProcessTranslatePart which is called from
   // nsDisplayTransform::GetResultingTransformMatrix)
   double devPerCss =
     double(scale) / double(nsDeviceContext::AppUnitsPerCSSPixel());
   transform._41 *= devPerCss;
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -13,17 +13,17 @@ include protocol PRenderFrame;
 include protocol PTexture;
 
 include "gfxipc/ShadowLayerUtils.h";
 include "mozilla/GfxMessageUtils.h";
 include "ImageLayers.h";
 
 using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h";
 using struct gfxRGBA from "gfxColor.h";
-using struct gfxPoint3D from "gfxPoint3D.h";
+using struct mozilla::gfx::Point3D from "mozilla/gfx/Point.h";
 using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h";
 using nscoord from "nsCoord.h";
 using struct nsIntPoint from "nsPoint.h";
 using struct nsRect from "nsRect.h";
 using struct nsPoint from "nsPoint.h";
 using class mozilla::TimeDuration from "mozilla/TimeStamp.h";
 using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
 using mozilla::ScreenRotation from "mozilla/WidgetUtils.h";
@@ -151,19 +151,19 @@ struct AnimationSegment {
 };
 
 // Transforms need extra information to correctly convert the list of transform
 // functions to a Matrix4x4 that can be applied directly to the layer.
 struct TransformData {
   // the origin of the frame being transformed in app units
   nsPoint origin;
   // the transform-origin property for the transform in css pixels
-  gfxPoint3D transformOrigin;
+  Point3D transformOrigin;
   // the perspective-origin property for the transform in css pixels
-  gfxPoint3D perspectiveOrigin;
+  Point3D perspectiveOrigin;
   nsRect bounds;
   nscoord perspective;
   int32_t appUnitsPerDevPixel;
 };
 
 union AnimationData {
   null_t;
   TransformData;
--- a/gfx/thebes/gfx3DMatrix.cpp
+++ b/gfx/thebes/gfx3DMatrix.cpp
@@ -176,26 +176,26 @@ gfx3DMatrix::IsIdentity() const
 {
   return _11 == 1.0f && _12 == 0.0f && _13 == 0.0f && _14 == 0.0f &&
          _21 == 0.0f && _22 == 1.0f && _23 == 0.0f && _24 == 0.0f &&
          _31 == 0.0f && _32 == 0.0f && _33 == 1.0f && _34 == 0.0f &&
          _41 == 0.0f && _42 == 0.0f && _43 == 0.0f && _44 == 1.0f;
 }
 
 void
-gfx3DMatrix::Translate(const gfxPoint3D& aPoint)
+gfx3DMatrix::Translate(const Point3D& aPoint)
 {
     _41 += aPoint.x * _11 + aPoint.y * _21 + aPoint.z * _31;
     _42 += aPoint.x * _12 + aPoint.y * _22 + aPoint.z * _32;
     _43 += aPoint.x * _13 + aPoint.y * _23 + aPoint.z * _33;
     _44 += aPoint.x * _14 + aPoint.y * _24 + aPoint.z * _34;
 }
 
 void
-gfx3DMatrix::TranslatePost(const gfxPoint3D& aPoint)
+gfx3DMatrix::TranslatePost(const Point3D& aPoint)
 {
     _11 += _14 * aPoint.x;
     _21 += _24 * aPoint.x;
     _31 += _34 * aPoint.x;
     _41 += _44 * aPoint.x;
     _12 += _14 * aPoint.y;
     _22 += _24 * aPoint.y;
     _32 += _34 * aPoint.y;
@@ -221,17 +221,17 @@ gfx3DMatrix::ScalePost(float aX, float a
 
   _13 *= aZ;
   _23 *= aZ;
   _33 *= aZ;
   _43 *= aZ;
 }
 
 void
-gfx3DMatrix::ChangeBasis(const gfxPoint3D& aOrigin)
+gfx3DMatrix::ChangeBasis(const Point3D& aOrigin)
 {
   // Translate to the origin before applying this matrix.
   Translate(-aOrigin);
 
   // Translate back into position after applying this matrix.
   TranslatePost(aOrigin);
 }
 
@@ -406,17 +406,17 @@ gfx3DMatrix::Translation(float aX, float
 
   matrix._41 = aX;
   matrix._42 = aY;
   matrix._43 = aZ;
   return matrix;
 }
 
 gfx3DMatrix
-gfx3DMatrix::Translation(const gfxPoint3D& aPoint)
+gfx3DMatrix::Translation(const Point3D& aPoint)
 {
   gfx3DMatrix matrix;
 
   matrix._41 = aPoint.x;
   matrix._42 = aPoint.y;
   matrix._43 = aPoint.z;
   return matrix;
 }
@@ -518,17 +518,17 @@ gfx3DMatrix::Inverse() const
      * multiplied by the inverse of the translation components.
      * Doing these steps separately is faster and more numerically
      * stable.
      *
      * Inverse of the translation matrix is just negating
      * the values.
      */
     gfx3DMatrix matrix3 = Inverse3x3();
-    matrix3.Translate(gfxPoint3D(-_41, -_42, -_43));
+    matrix3.Translate(Point3D(-_41, -_42, -_43));
     return matrix3;
  }
 
   gfxFloat det = Determinant();
   if (det == 0.0) {
     return *this;
   }
 
@@ -613,34 +613,34 @@ gfx3DMatrix::Transposed() const
         temp[i] = TransposedVector(i);
     }
     return temp;
 }
 
 gfxPoint
 gfx3DMatrix::Transform(const gfxPoint& point) const
 {
-  gfxPoint3D vec3d(point.x, point.y, 0);
+  Point3D vec3d(point.x, point.y, 0);
   vec3d = Transform3D(vec3d);
   return gfxPoint(vec3d.x, vec3d.y);
 }
 
-gfxPoint3D
-gfx3DMatrix::Transform3D(const gfxPoint3D& point) const
+Point3D
+gfx3DMatrix::Transform3D(const Point3D& point) const
 {
   gfxFloat x = point.x * _11 + point.y * _21 + point.z * _31 + _41;
   gfxFloat y = point.x * _12 + point.y * _22 + point.z * _32 + _42;
   gfxFloat z = point.x * _13 + point.y * _23 + point.z * _33 + _43;
   gfxFloat w = point.x * _14 + point.y * _24 + point.z * _34 + _44;
 
   x /= w;
   y /= w;
   z /= w;
 
-  return gfxPoint3D(x, y, z);
+  return Point3D(x, y, z);
 }
 
 gfxPointH3D
 gfx3DMatrix::Transform4D(const gfxPointH3D& aPoint) const
 {
     gfxFloat x = aPoint.x * _11 + aPoint.y * _21 + aPoint.z * _31 + aPoint.w * _41;
     gfxFloat y = aPoint.x * _12 + aPoint.y * _22 + aPoint.z * _32 + aPoint.w * _42;
     gfxFloat z = aPoint.x * _13 + aPoint.y * _23 + aPoint.z * _33 + aPoint.w * _43;
@@ -772,27 +772,27 @@ gfxPointH3D gfx3DMatrix::ProjectPoint(co
 
   // Solving for z when z' = 0 gives us:
   float z = -(aPoint.x * _13 + aPoint.y * _23 + _43) / _33;
 
   // Compute the transformed point
   return Transform4D(gfxPointH3D(aPoint.x, aPoint.y, z, 1));
 }
 
-gfxPoint3D gfx3DMatrix::GetNormalVector() const
+Point3D gfx3DMatrix::GetNormalVector() const
 {
   // Define a plane in transformed space as the transformations
   // of 3 points on the z=0 screen plane.
-  gfxPoint3D a = Transform3D(gfxPoint3D(0, 0, 0));
-  gfxPoint3D b = Transform3D(gfxPoint3D(0, 1, 0));
-  gfxPoint3D c = Transform3D(gfxPoint3D(1, 0, 0));
+  Point3D a = Transform3D(Point3D(0, 0, 0));
+  Point3D b = Transform3D(Point3D(0, 1, 0));
+  Point3D c = Transform3D(Point3D(1, 0, 0));
 
   // Convert to two vectors on the surface of the plane.
-  gfxPoint3D ab = b - a;
-  gfxPoint3D ac = c - a;
+  Point3D ab = b - a;
+  Point3D ac = c - a;
 
   return ac.CrossProduct(ab);
 }
 
 bool gfx3DMatrix::IsBackfaceVisible() const
 {
   // Inverse()._33 < 0;
   gfxFloat det = Determinant();
--- a/gfx/thebes/gfx3DMatrix.h
+++ b/gfx/thebes/gfx3DMatrix.h
@@ -2,17 +2,16 @@
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_3DMATRIX_H
 #define GFX_3DMATRIX_H
 
 #include <gfxTypes.h>
-#include <gfxPoint3D.h>
 #include <gfxPointH3D.h>
 #include <gfxQuad.h>
 
 class gfxMatrix;
 
 /**
  * This class represents a 3D transformation. The matrix is laid
  * out as follows:
@@ -25,16 +24,17 @@ class gfxMatrix;
  * This matrix is treated as row-major. Assuming we consider our vectors row
  * vectors, this matrix type will be identical in memory to the OpenGL and D3D
  * matrices. OpenGL matrices are column-major, however OpenGL also treats
  * vectors as column vectors, the double transposition makes everything work
  * out nicely.
  */
 class gfx3DMatrix
 {
+  typedef mozilla::gfx::Point3D Point3D;
 public:
   /**
    * Create matrix.
    */
   gfx3DMatrix(void);
 
   friend std::ostream& operator<<(std::ostream& stream, const gfx3DMatrix& m) {
     if (m.IsIdentity()) {
@@ -140,17 +140,17 @@ public:
    * Add a translation by aPoint to the matrix.
    *
    * This creates this temporary matrix:
    * |  1        0        0         0 |
    * |  0        1        0         0 |
    * |  0        0        1         0 |
    * |  aPoint.x aPoint.y aPoint.z  1 |
    */
-  void Translate(const gfxPoint3D& aPoint);
+  void Translate(const Point3D& aPoint);
 
   /** 
    * Skew the matrix.
    *
    * This creates this temporary matrix:
    * | 1           tan(aYSkew) 0 0 |
    * | tan(aXSkew) 1           0 0 |
    * | 0           0           1 0 |
@@ -239,31 +239,31 @@ public:
    * matrix.
    */
 
   /**
    * Add a translation by aPoint after the matrix.
    * This is functionally equivalent to:
    * matrix * gfx3DMatrix::Translation(aPoint)
    */
-  void TranslatePost(const gfxPoint3D& aPoint);
+  void TranslatePost(const Point3D& aPoint);
 
   void ScalePost(float aX, float aY, float aZ);
 
   /**
    * Let T be the transformation matrix translating points in the coordinate
    * space with origin aOrigin to the coordinate space used by this matrix.
    * If this matrix is M, this function changes it to be (T-1)MT, the matrix
    * that's equivalent to M but in the coordinate space that treats aOrigin
    * as the origin.
    *
    * @param aOrigin The origin to translate to
    * @return The modified matrix
    */
-  void ChangeBasis(const gfxPoint3D& aOrigin);
+  void ChangeBasis(const Point3D& aOrigin);
 
   /**
    * Transforms a point according to this matrix.
    */
   gfxPoint Transform(const gfxPoint& point) const;
 
   /**
    * Transforms a rectangle according to this matrix
@@ -271,17 +271,17 @@ public:
   gfxRect TransformBounds(const gfxRect& rect) const;
 
 
   gfxQuad TransformRect(const gfxRect& aRect) const;
 
   /** 
    * Transforms a 3D vector according to this matrix.
    */
-  gfxPoint3D Transform3D(const gfxPoint3D& point) const;
+  Point3D Transform3D(const Point3D& point) const;
   gfxPointH3D Transform4D(const gfxPointH3D& aPoint) const;
   gfxPointH3D TransposeTransform4D(const gfxPointH3D& aPoint) const;
 
   /**
    * Given a point (x,y) find a value for z such that (x,y,z,1) transforms
    * into (x',y',0,w') and returns the latter.
    */
   gfxPointH3D ProjectPoint(const gfxPoint& aPoint) const;
@@ -317,17 +317,17 @@ public:
 
   gfx3DMatrix& Transpose();
   gfx3DMatrix Transposed() const;
 
   /**
    * Returns a unit vector that is perpendicular to the plane formed
    * by transform the screen plane (z=0) by this matrix.
    */
-  gfxPoint3D GetNormalVector() const;
+  Point3D GetNormalVector() const;
 
   /**
    * Returns true if a plane transformed by this matrix will
    * have it's back face visible.
    */
   bool IsBackfaceVisible() const;
 
   /**
@@ -338,17 +338,17 @@ public:
   /**
    * Create a translation matrix.
    *
    * \param aX Translation on X-axis.
    * \param aY Translation on Y-axis.
    * \param aZ Translation on Z-axis.
    */
   static gfx3DMatrix Translation(float aX, float aY, float aZ);
-  static gfx3DMatrix Translation(const gfxPoint3D& aPoint);
+  static gfx3DMatrix Translation(const Point3D& aPoint);
 
   /**
    * Create a scale matrix. Scales uniformly along all axes.
    *
    * \param aScale Scale factor
    */
   static gfx3DMatrix ScalingMatrix(float aFactor);
 
deleted file mode 100644
--- a/gfx/thebes/gfxPoint3D.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef GFX_POINT3D_H
-#define GFX_POINT3D_H
-
-#include "mozilla/gfx/BasePoint3D.h"
-#include "gfxTypes.h"
-
-struct gfxPoint3D : public mozilla::gfx::BasePoint3D<gfxFloat, gfxPoint3D> {
-    typedef mozilla::gfx::BasePoint3D<gfxFloat, gfxPoint3D> Super;
-
-    gfxPoint3D() : Super() {}
-    gfxPoint3D(gfxFloat aX, gfxFloat aY, gfxFloat aZ) : Super(aX, aY, aZ) {}
-};
-
-#endif /* GFX_POINT3D_H */ 
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -26,17 +26,16 @@ EXPORTS += [
     'gfxGradientCache.h',
     'gfxImageSurface.h',
     'gfxLineSegment.h',
     'gfxMathTable.h',
     'gfxMatrix.h',
     'gfxPattern.h',
     'gfxPlatform.h',
     'gfxPoint.h',
-    'gfxPoint3D.h',
     'gfxPointH3D.h',
     'gfxPrefs.h',
     'gfxQuad.h',
     'gfxQuaternion.h',
     'gfxRect.h',
     'gfxReusableImageSurfaceWrapper.h',
     'gfxReusableSharedImageSurfaceWrapper.h',
     'gfxReusableSurfaceWrapper.h',
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -466,19 +466,19 @@ nsDisplayListBuilder::AddAnimationsAndTr
     return;
   }
 
   AnimationData data;
   if (aProperty == eCSSProperty_transform) {
     nsRect bounds = nsDisplayTransform::GetFrameBoundsForTransform(aFrame);
     // all data passed directly to the compositor should be in css pixels
     float scale = nsDeviceContext::AppUnitsPerCSSPixel();
-    gfxPoint3D offsetToTransformOrigin =
+    Point3D offsetToTransformOrigin =
       nsDisplayTransform::GetDeltaToTransformOrigin(aFrame, scale, &bounds);
-    gfxPoint3D offsetToPerspectiveOrigin =
+    Point3D offsetToPerspectiveOrigin =
       nsDisplayTransform::GetDeltaToPerspectiveOrigin(aFrame, scale);
     nscoord perspective = 0.0;
     nsStyleContext* parentStyleContext = aFrame->StyleContext()->GetParent();
     if (parentStyleContext) {
       const nsStyleDisplay* disp = parentStyleContext->StyleDisplay();
       if (disp && disp->mChildPerspective.GetUnit() == eStyleUnit_Coord) {
         perspective = disp->mChildPerspective.GetCoordValue();
       }
@@ -4488,27 +4488,27 @@ nsDisplayTransform::nsDisplayTransform(n
   Init(aBuilder);
 }
 
 /* Returns the delta specified by the -moz-transform-origin property.
  * This is a positive delta, meaning that it indicates the direction to move
  * to get from (0, 0) of the frame to the transform origin.  This function is
  * called off the main thread.
  */
-/* static */ gfxPoint3D
+/* static */ Point3D
 nsDisplayTransform::GetDeltaToTransformOrigin(const nsIFrame* aFrame,
                                               float aAppUnitsPerPixel,
                                               const nsRect* aBoundsOverride)
 {
   NS_PRECONDITION(aFrame, "Can't get delta for a null frame!");
   NS_PRECONDITION(aFrame->IsTransformed() || aFrame->StyleDisplay()->BackfaceIsHidden(),
                   "Shouldn't get a delta for an untransformed frame!");
 
   if (!aFrame->IsTransformed()) {
-    return gfxPoint3D();
+    return Point3D();
   }
 
   /* For both of the coordinates, if the value of -moz-transform is a
    * percentage, it's relative to the size of the frame.  Otherwise, if it's
    * a distance, it's already computed for us!
    */
   const nsStyleDisplay* display = aFrame->StyleDisplay();
   nsRect boundingRect = (aBoundsOverride ? *aBoundsOverride :
@@ -4550,54 +4550,54 @@ nsDisplayTransform::GetDeltaToTransformO
   }
 
   coords[2] = NSAppUnitsToFloatPixels(display->mTransformOrigin[2].GetCoordValue(),
                                       aAppUnitsPerPixel);
   /* Adjust based on the origin of the rectangle. */
   coords[0] += NSAppUnitsToFloatPixels(boundingRect.x, aAppUnitsPerPixel);
   coords[1] += NSAppUnitsToFloatPixels(boundingRect.y, aAppUnitsPerPixel);
 
-  return gfxPoint3D(coords[0], coords[1], coords[2]);
+  return Point3D(coords[0], coords[1], coords[2]);
 }
 
 /* Returns the delta specified by the -moz-perspective-origin property.
  * This is a positive delta, meaning that it indicates the direction to move
  * to get from (0, 0) of the frame to the perspective origin. This function is
  * called off the main thread.
  */
-/* static */ gfxPoint3D
+/* static */ Point3D
 nsDisplayTransform::GetDeltaToPerspectiveOrigin(const nsIFrame* aFrame,
                                                 float aAppUnitsPerPixel)
 {
   NS_PRECONDITION(aFrame, "Can't get delta for a null frame!");
   NS_PRECONDITION(aFrame->IsTransformed() || aFrame->StyleDisplay()->BackfaceIsHidden(),
                   "Shouldn't get a delta for an untransformed frame!");
 
   if (!aFrame->IsTransformed()) {
-    return gfxPoint3D();
+    return Point3D();
   }
 
   /* 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();
   if (!parent) {
-    return gfxPoint3D();
+    return Point3D();
   }
   const nsStyleDisplay* display = parent->StyleDisplay();
   nsRect boundingRect = nsDisplayTransform::GetFrameBoundsForTransform(parent);
 
   /* Allows us to access named variables by index. */
-  gfxPoint3D result;
+  Point3D result;
   result.z = 0.0f;
-  gfxFloat* coords[2] = {&result.x, &result.y};
+  gfx::Float* coords[2] = {&result.x, &result.y};
   const nscoord* dimensions[2] =
     {&boundingRect.width, &boundingRect.height};
 
   for (uint8_t index = 0; index < 2; ++index) {
     /* If the -moz-transform-origin specifies a percentage, take the percentage
      * of the size of the box.
      */
     const nsStyleCoord &coord = display->mPerspectiveOrigin[index];
@@ -4614,20 +4614,20 @@ nsDisplayTransform::GetDeltaToPerspectiv
     } else {
       NS_ABORT_IF_FALSE(coord.GetUnit() == eStyleUnit_Coord, "unexpected unit");
       *coords[index] =
         NSAppUnitsToFloatPixels(coord.GetCoordValue(), aAppUnitsPerPixel);
     }
   }
 
   nsPoint parentOffset = aFrame->GetOffsetTo(parent);
-  gfxPoint3D gfxOffset(
-               NSAppUnitsToFloatPixels(parentOffset.x, aAppUnitsPerPixel),
-               NSAppUnitsToFloatPixels(parentOffset.y, aAppUnitsPerPixel),
-               0.0f);
+  Point3D gfxOffset(
+            NSAppUnitsToFloatPixels(parentOffset.x, aAppUnitsPerPixel),
+            NSAppUnitsToFloatPixels(parentOffset.y, aAppUnitsPerPixel),
+            0.0f);
 
   return result - gfxOffset;
 }
 
 nsDisplayTransform::FrameTransformProperties::FrameTransformProperties(const nsIFrame* aFrame,
                                                                        float aAppUnitsPerPixel,
                                                                        const nsRect* aBoundsOverride)
   : mFrame(aFrame)
@@ -4739,24 +4739,24 @@ nsDisplayTransform::GetResultingTransfor
      */
     perspective.ChangeBasis(aProperties.mToPerspectiveOrigin - aProperties.mToTransformOrigin);
     result = result * perspective;
   }
 
   /* Account for the -moz-transform-origin property by translating the
    * coordinate space to the new origin.
    */
-  gfxPoint3D newOrigin =
-    gfxPoint3D(NSAppUnitsToFloatPixels(aOrigin.x, aAppUnitsPerPixel),
-               NSAppUnitsToFloatPixels(aOrigin.y, aAppUnitsPerPixel),
-               0.0f);
-  gfxPoint3D roundedOrigin(hasSVGTransforms ? newOrigin.x : NS_round(newOrigin.x),
-                           hasSVGTransforms ? newOrigin.y : NS_round(newOrigin.y),
-                           0);
-  gfxPoint3D offsetBetweenOrigins = roundedOrigin + aProperties.mToTransformOrigin;
+  Point3D newOrigin =
+    Point3D(NSAppUnitsToFloatPixels(aOrigin.x, aAppUnitsPerPixel),
+            NSAppUnitsToFloatPixels(aOrigin.y, aAppUnitsPerPixel),
+            0.0f);
+  Point3D roundedOrigin(hasSVGTransforms ? newOrigin.x : NS_round(newOrigin.x),
+                        hasSVGTransforms ? newOrigin.y : NS_round(newOrigin.y),
+                        0);
+  Point3D offsetBetweenOrigins = roundedOrigin + aProperties.mToTransformOrigin;
 
   if (frame && frame->Preserves3D()) {
     // Include the transform set on our parent
     NS_ASSERTION(frame->GetParent() &&
                  frame->GetParent()->IsTransformed() &&
                  frame->GetParent()->Preserves3DChildren(),
                  "Preserve3D mismatch!");
     FrameTransformProperties props(frame->GetParent(),
@@ -4887,20 +4887,20 @@ static bool IsFrameVisible(nsIFrame* aFr
   return true;
 }
 
 const Matrix4x4&
 nsDisplayTransform::GetTransform()
 {
   if (mTransform.IsIdentity()) {
     float scale = mFrame->PresContext()->AppUnitsPerDevPixel();
-    gfxPoint3D newOrigin =
-      gfxPoint3D(NSAppUnitsToFloatPixels(mToReferenceFrame.x, scale),
-                 NSAppUnitsToFloatPixels(mToReferenceFrame.y, scale),
-                  0.0f);
+    Point3D newOrigin =
+      Point3D(NSAppUnitsToFloatPixels(mToReferenceFrame.x, scale),
+              NSAppUnitsToFloatPixels(mToReferenceFrame.y, scale),
+              0.0f);
     if (mTransformGetter) {
       mTransform = mTransformGetter(mFrame, scale);
       mTransform.ChangeBasis(newOrigin.x, newOrigin.y, newOrigin.z);
     } else {
       /**
        * Passing true as the final argument means that we want to shift the
        * coordinates to be relative to our reference frame instead of relative
        * to this frame.
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -3182,16 +3182,17 @@ private:
  *
  * INVARIANT: The wrapped frame is transformed or we supplied a transform getter
  * function.
  * INVARIANT: The wrapped frame is non-null.
  */ 
 class nsDisplayTransform: public nsDisplayItem
 {
   typedef mozilla::gfx::Matrix4x4 Matrix4x4;
+  typedef mozilla::gfx::Point3D Point3D;
 public:
   /**
    * Returns a matrix (in pixels) for the current frame. The matrix should be relative to
    * the current frame's coordinate space.
    *
    * @param aFrame The frame to compute the transform for.
    * @param aAppUnitsPerPixel The number of app units per graphics unit.
    */
@@ -3313,22 +3314,22 @@ public:
                               const nsRect &aChildBounds,
                               const nsIFrame* aFrame,
                               const nsPoint &aOrigin,
                               nsRect *aOutRect);
 
   bool UntransformVisibleRect(nsDisplayListBuilder* aBuilder,
                               nsRect* aOutRect);
 
-  static gfxPoint3D GetDeltaToTransformOrigin(const nsIFrame* aFrame,
-                                              float aAppUnitsPerPixel,
-                                              const nsRect* aBoundsOverride);
-
-  static gfxPoint3D GetDeltaToPerspectiveOrigin(const nsIFrame* aFrame,
-                                                float aAppUnitsPerPixel);
+  static Point3D GetDeltaToTransformOrigin(const nsIFrame* aFrame,
+                                           float aAppUnitsPerPixel,
+                                           const nsRect* aBoundsOverride);
+
+  static Point3D GetDeltaToPerspectiveOrigin(const nsIFrame* aFrame,
+                                             float aAppUnitsPerPixel);
 
   /**
    * Returns the bounds of a frame as defined for resolving percentage
    * <translation-value>s in CSS transforms.  If
    * UNIFIED_CONTINUATIONS is not defined, this is simply the frame's bounding
    * rectangle, translated to the origin.  Otherwise, returns the smallest
    * rectangle containing a frame and all of its continuations.  For example,
    * if there is a <span> element with several continuations split over
@@ -3342,30 +3343,30 @@ public:
   static nsRect GetFrameBoundsForTransform(const nsIFrame* aFrame);
 
   struct FrameTransformProperties
   {
     FrameTransformProperties(const nsIFrame* aFrame,
                              float aAppUnitsPerPixel,
                              const nsRect* aBoundsOverride);
     FrameTransformProperties(nsCSSValueSharedList* aTransformList,
-                             const gfxPoint3D& aToTransformOrigin,
-                             const gfxPoint3D& aToPerspectiveOrigin,
+                             const Point3D& aToTransformOrigin,
+                             const Point3D& aToPerspectiveOrigin,
                              nscoord aChildPerspective)
       : mFrame(nullptr)
       , mTransformList(aTransformList)
       , mToTransformOrigin(aToTransformOrigin)
       , mToPerspectiveOrigin(aToPerspectiveOrigin)
       , mChildPerspective(aChildPerspective)
     {}
 
     const nsIFrame* mFrame;
     nsRefPtr<nsCSSValueSharedList> mTransformList;
-    const gfxPoint3D mToTransformOrigin;
-    const gfxPoint3D mToPerspectiveOrigin;
+    const Point3D mToTransformOrigin;
+    const Point3D mToPerspectiveOrigin;
     nscoord mChildPerspective;
   };
 
   /**
    * Given a frame with the -moz-transform property or an SVG transform,
    * returns the transformation matrix for that frame.
    *
    * @param aFrame The frame to get the matrix from.
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -38,17 +38,16 @@
 #include "nsRenderingContext.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsCSSRendering.h"
 #include "nsThemeConstants.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDocShell.h"
 #include "nsIWidget.h"
 #include "gfxMatrix.h"
-#include "gfxPoint3D.h"
 #include "gfxPrefs.h"
 #include "gfxTypes.h"
 #include "nsTArray.h"
 #include "mozilla/dom/HTMLCanvasElement.h"
 #include "nsICanvasRenderingContextInternal.h"
 #include "gfxPlatform.h"
 #include <algorithm>
 #include "mozilla/dom/HTMLVideoElement.h"
--- a/layout/style/StyleAnimationValue.cpp
+++ b/layout/style/StyleAnimationValue.cpp
@@ -22,16 +22,17 @@
 #include "mozilla/dom/Element.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/Likely.h"
 #include "gfxMatrix.h"
 #include "gfxQuaternion.h"
 #include "nsIDocument.h"
 
 using namespace mozilla;
+using namespace mozilla::gfx;
 
 // HELPER METHODS
 // --------------
 /*
  * Given two units, this method returns a common unit that they can both be
  * converted into, if possible.  This is intended to facilitate
  * interpolation, distance-computation, and addition between "similar" units.
  *
@@ -1333,19 +1334,19 @@ StyleAnimationValue::AppendTransformFunc
  * Decompose2DMatrix implements the above decomposition algorithm.
  */
 
 #define XYSHEAR 0
 #define XZSHEAR 1
 #define YZSHEAR 2
 
 static bool
-Decompose2DMatrix(const gfxMatrix &aMatrix, gfxPoint3D &aScale,
+Decompose2DMatrix(const gfxMatrix &aMatrix, Point3D &aScale,
                   float aShear[3], gfxQuaternion &aRotate,
-                  gfxPoint3D &aTranslate)
+                  Point3D &aTranslate)
 {
   float A = aMatrix._11,
         B = aMatrix._12,
         C = aMatrix._21,
         D = aMatrix._22;
   if (A * D == B * C) {
     // singular matrix
     return false;
@@ -1392,19 +1393,19 @@ Decompose2DMatrix(const gfxMatrix &aMatr
  * http://dev.w3.org/csswg/css3-2d-transforms/#unmatrix
  *
  * This, in turn, refers to the unmatrix program in Graphics Gems,
  * available from http://tog.acm.org/resources/GraphicsGems/ , and in
  * particular as the file GraphicsGems/gemsii/unmatrix.c
  * in http://tog.acm.org/resources/GraphicsGems/AllGems.tar.gz
  */
 static bool
-Decompose3DMatrix(const gfx3DMatrix &aMatrix, gfxPoint3D &aScale,
+Decompose3DMatrix(const gfx3DMatrix &aMatrix, Point3D &aScale,
                   float aShear[3], gfxQuaternion &aRotate,
-                  gfxPoint3D &aTranslate, gfxPointH3D &aPerspective)
+                  Point3D &aTranslate, gfxPointH3D &aPerspective)
 {
   gfx3DMatrix local = aMatrix;
 
   if (local[3][3] == 0) {
     return false;
   }
   /* Normalize the matrix */
   local.Normalize();
@@ -1503,22 +1504,22 @@ T InterpolateNumerically(const T& aOne, 
 StyleAnimationValue::InterpolateTransformMatrix(const gfx3DMatrix &aMatrix1,
                                                 const gfx3DMatrix &aMatrix2,
                                                 double aProgress)
 {
   // Decompose both matrices
 
   // TODO: What do we do if one of these returns false (singular matrix)
 
-  gfxPoint3D scale1(1, 1, 1), translate1;
+  Point3D scale1(1, 1, 1), translate1;
   gfxPointH3D perspective1(0, 0, 0, 1);
   gfxQuaternion rotate1;
   float shear1[3] = { 0.0f, 0.0f, 0.0f};
 
-  gfxPoint3D scale2(1, 1, 1), translate2;
+  Point3D scale2(1, 1, 1), translate2;
   gfxPointH3D perspective2(0, 0, 0, 1);
   gfxQuaternion rotate2;
   float shear2[3] = { 0.0f, 0.0f, 0.0f};
 
   gfxMatrix matrix2d1, matrix2d2;
   if (aMatrix1.Is2D(&matrix2d1) && aMatrix2.Is2D(&matrix2d2)) {
     Decompose2DMatrix(matrix2d1, scale1, shear1, rotate1, translate1);
     Decompose2DMatrix(matrix2d2, scale2, shear2, rotate2, translate2);
@@ -1531,17 +1532,17 @@ StyleAnimationValue::InterpolateTransfor
 
   // Interpolate each of the pieces
   gfx3DMatrix result;
 
   gfxPointH3D perspective =
     InterpolateNumerically(perspective1, perspective2, aProgress);
   result.SetTransposedVector(3, perspective);
 
-  gfxPoint3D translate =
+  Point3D translate =
     InterpolateNumerically(translate1, translate2, aProgress);
   result.Translate(translate);
 
   gfxQuaternion q3 = rotate1.Slerp(rotate2, aProgress);
   gfx3DMatrix rotate = q3.ToMatrix();
   if (!rotate.IsIdentity()) {
       result = rotate * result;
   }
@@ -1560,19 +1561,19 @@ StyleAnimationValue::InterpolateTransfor
   }
 
   float xyshear =
     InterpolateNumerically(shear1[XYSHEAR], shear2[XYSHEAR], aProgress);
   if (xyshear != 0.0) {
     result.SkewXY(xyshear);
   }
 
-  gfxPoint3D scale =
+  Point3D scale =
     InterpolateNumerically(scale1, scale2, aProgress);
-  if (scale != gfxPoint3D(1.0, 1.0, 1.0)) {
+  if (scale != Point3D(1.0, 1.0, 1.0)) {
     result.Scale(scale.x, scale.y, scale.z);
   }
 
   return result;
 }
 
 static nsCSSValueList*
 AddDifferentTransformLists(double aCoeff1, const nsCSSValueList* aList1,
@@ -1809,23 +1810,23 @@ AddTransformLists(double aCoeff1, const 
         NS_ABORT_IF_FALSE(a2->Count() == 2, "unexpected count");
 
         AddCSSValueAngle(aCoeff1, a1->Item(1), aCoeff2, a2->Item(1),
                          arr->Item(1));
 
         break;
       }
       case eCSSKeyword_rotate3d: {
-        gfxPoint3D vector1(a1->Item(1).GetFloatValue(),
-                           a1->Item(2).GetFloatValue(),
-                           a1->Item(3).GetFloatValue());
+        Point3D vector1(a1->Item(1).GetFloatValue(),
+                        a1->Item(2).GetFloatValue(),
+                        a1->Item(3).GetFloatValue());
         vector1.Normalize();
-        gfxPoint3D vector2(a2->Item(1).GetFloatValue(),
-                           a2->Item(2).GetFloatValue(),
-                           a2->Item(3).GetFloatValue());
+        Point3D vector2(a2->Item(1).GetFloatValue(),
+                        a2->Item(2).GetFloatValue(),
+                        a2->Item(3).GetFloatValue());
         vector2.Normalize();
 
         // Handle rotate3d with matched (normalized) vectors,
         // otherwise fallthrough to the next switch statement
         // and do matrix decomposition.
         if (vector1 == vector2) {
           // We skipped appending a transform function above for rotate3d,
           // so do it now.
--- a/layout/style/nsStyleTransformMatrix.cpp
+++ b/layout/style/nsStyleTransformMatrix.cpp
@@ -11,16 +11,17 @@
 #include "nsCSSValue.h"
 #include "nsPresContext.h"
 #include "nsRuleNode.h"
 #include "nsCSSKeywords.h"
 #include "mozilla/StyleAnimationValue.h"
 #include "gfxMatrix.h"
 
 using namespace mozilla;
+using namespace mozilla::gfx;
 
 namespace nsStyleTransformMatrix {
 
 /* Note on floating point precision: The transform matrix is an array
  * of single precision 'float's, and so are most of the input values
  * we get from the style system, but intermediate calculations
  * involving angles need to be done in 'double'.
  */
@@ -191,17 +192,17 @@ ProcessTranslateX(gfx3DMatrix& aMatrix,
                   const nsCSSValue::Array* aData,
                   nsStyleContext* aContext,
                   nsPresContext* aPresContext,
                   bool& aCanStoreInRuleTree,
                   nsRect& aBounds)
 {
   NS_PRECONDITION(aData->Count() == 2, "Invalid array!");
 
-  gfxPoint3D temp;
+  Point3D temp;
 
   temp.x = ProcessTranslatePart(aData->Item(1),
                                 aContext, aPresContext, aCanStoreInRuleTree,
                                 aBounds.Width());
   aMatrix.Translate(temp);
 }
 
 /* Helper function to process a translatey function. */
@@ -210,34 +211,34 @@ ProcessTranslateY(gfx3DMatrix& aMatrix,
                   const nsCSSValue::Array* aData,
                   nsStyleContext* aContext,
                   nsPresContext* aPresContext,
                   bool& aCanStoreInRuleTree,
                   nsRect& aBounds)
 {
   NS_PRECONDITION(aData->Count() == 2, "Invalid array!");
 
-  gfxPoint3D temp;
+  Point3D temp;
 
   temp.y = ProcessTranslatePart(aData->Item(1),
                                 aContext, aPresContext, aCanStoreInRuleTree,
                                 aBounds.Height());
   aMatrix.Translate(temp);
 }
 
 static void 
 ProcessTranslateZ(gfx3DMatrix& aMatrix,
                   const nsCSSValue::Array* aData,
                   nsStyleContext* aContext,
                   nsPresContext* aPresContext,
                   bool& aCanStoreInRuleTree)
 {
   NS_PRECONDITION(aData->Count() == 2, "Invalid array!");
 
-  gfxPoint3D temp;
+  Point3D temp;
 
   temp.z = ProcessTranslatePart(aData->Item(1), aContext,
                                 aPresContext, aCanStoreInRuleTree, 0);
   aMatrix.Translate(temp);
 }
 
 /* Helper function to process a translate function. */
 static void
@@ -245,17 +246,17 @@ ProcessTranslate(gfx3DMatrix& aMatrix,
                  const nsCSSValue::Array* aData,
                  nsStyleContext* aContext,
                  nsPresContext* aPresContext,
                  bool& aCanStoreInRuleTree,
                  nsRect& aBounds)
 {
   NS_PRECONDITION(aData->Count() == 2 || aData->Count() == 3, "Invalid array!");
 
-  gfxPoint3D temp;
+  Point3D temp;
 
   temp.x = ProcessTranslatePart(aData->Item(1),
                                 aContext, aPresContext, aCanStoreInRuleTree,
                                 aBounds.Width());
 
   /* If we read in a Y component, set it appropriately */
   if (aData->Count() == 3) {
     temp.y = ProcessTranslatePart(aData->Item(2),
@@ -270,17 +271,17 @@ ProcessTranslate3D(gfx3DMatrix& aMatrix,
                    const nsCSSValue::Array* aData,
                    nsStyleContext* aContext,
                    nsPresContext* aPresContext,
                    bool& aCanStoreInRuleTree,
                    nsRect& aBounds)
 {
   NS_PRECONDITION(aData->Count() == 4, "Invalid array!");
 
-  gfxPoint3D temp;
+  Point3D temp;
 
   temp.x = ProcessTranslatePart(aData->Item(1),
                                 aContext, aPresContext, aCanStoreInRuleTree,
                                 aBounds.Width());
 
   temp.y = ProcessTranslatePart(aData->Item(2),
                                 aContext, aPresContext, aCanStoreInRuleTree,
                                 aBounds.Height());
@@ -432,19 +433,19 @@ ProcessRotate3D(gfx3DMatrix& aMatrix, co
   /* The current spec specifies a matrix that rotates in the wrong direction. For now we just negate
    * the angle provided to get the correct rotation direction until the spec is updated.
    * See bug 704468.
    */
   double theta = -aData->Item(4).GetAngleValueInRadians();
   float cosTheta = FlushToZero(cos(theta));
   float sinTheta = FlushToZero(sin(theta));
 
-  gfxPoint3D vector(aData->Item(1).GetFloatValue(),
-                    aData->Item(2).GetFloatValue(),
-                    aData->Item(3).GetFloatValue());
+  Point3D vector(aData->Item(1).GetFloatValue(),
+                 aData->Item(2).GetFloatValue(),
+                 aData->Item(3).GetFloatValue());
 
   if (!vector.Length()) {
     return;
   }
   vector.Normalize();
 
   gfx3DMatrix temp;