Bug 1069417 - Remove the explicit template argument of TransformTo() and related functions. r=kats
authorBotond Ballo <botond@mozilla.com>
Mon, 30 Nov 2015 20:06:45 -0500
changeset 275427 1995fa8bbf43e1458f0fff9310cb0e8d919097c5
parent 275426 bad076546d10d21693dccd01b748950016f302f2
child 275428 c0f3de2d37b4ef542f61aa5cabf16ac176b0aef1
push id29752
push usercbook@mozilla.com
push dateThu, 03 Dec 2015 11:03:31 +0000
treeherdermozilla-central@85cf2e720a84 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1069417
milestone45.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 1069417 - Remove the explicit template argument of TransformTo() and related functions. r=kats In this process, TransformTo() and UntransformTo() are renamed TransformedBy() and UntransformBy() so calls to them continue to read sensibly.
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/src/HitTestingTreeNode.cpp
gfx/layers/client/ClientTiledPaintedLayer.cpp
gfx/layers/client/TiledContentClient.cpp
gfx/layers/composite/AsyncCompositionManager.cpp
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/composite/LayerManagerComposite.h
gfx/src/nsRegion.h
layout/base/UnitTransforms.h
layout/base/nsDisplayList.cpp
widget/InputData.cpp
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -748,17 +748,17 @@ APZCTreeManager::ReceiveInputEvent(Input
         // scrolling, which changes the async transform. However, the event we
         // want to pass to gecko should be the pre-scroll event coordinates,
         // transformed into the gecko space. (pre-scroll because the mouse
         // cursor is stationary during wheel scrolling, unlike touchmove
         // events). Since we just flushed the pending repaints the transform to
         // gecko space should only consist of overscroll-cancelling transforms.
         ScreenToScreenMatrix4x4 transformToGecko = GetScreenToApzcTransform(apzc)
                                                  * GetApzcToGeckoTransform(apzc);
-        Maybe<ScreenPoint> untransformedOrigin = UntransformTo<ScreenPixel>(
+        Maybe<ScreenPoint> untransformedOrigin = UntransformBy(
           transformToGecko, wheelInput.mOrigin);
 
         if (!untransformedOrigin) {
           return result;
         }
 
         result = mInputQueue->ReceiveInputEvent(
           apzc,
@@ -788,19 +788,19 @@ APZCTreeManager::ReceiveInputEvent(Input
         // scrolling, which changes the async transform. However, the event we
         // want to pass to gecko should be the pre-scroll event coordinates,
         // transformed into the gecko space. (pre-scroll because the mouse
         // cursor is stationary during pan gesture scrolling, unlike touchmove
         // events). Since we just flushed the pending repaints the transform to
         // gecko space should only consist of overscroll-cancelling transforms.
         ScreenToScreenMatrix4x4 transformToGecko = GetScreenToApzcTransform(apzc)
                                                  * GetApzcToGeckoTransform(apzc);
-        Maybe<ScreenPoint> untransformedStartPoint = UntransformTo<ScreenPixel>(
+        Maybe<ScreenPoint> untransformedStartPoint = UntransformBy(
           transformToGecko, panInput.mPanStartPoint);
-        Maybe<ScreenPoint> untransformedDisplacement = UntransformVector<ScreenPixel>(
+        Maybe<ScreenPoint> untransformedDisplacement = UntransformVector(
             transformToGecko, panInput.mPanDisplacement, panInput.mPanStartPoint);
 
         if (!untransformedStartPoint || !untransformedDisplacement) {
           return result;
         }
 
         result = mInputQueue->ReceiveInputEvent(
             apzc,
@@ -817,17 +817,17 @@ APZCTreeManager::ReceiveInputEvent(Input
       PinchGestureInput& pinchInput = aEvent.AsPinchGestureInput();
       RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(pinchInput.mFocusPoint,
                                                             &hitResult);
       if (apzc) {
         MOZ_ASSERT(hitResult == HitLayer || hitResult == HitDispatchToContentRegion);
 
         ScreenToScreenMatrix4x4 outTransform = GetScreenToApzcTransform(apzc)
                                              * GetApzcToGeckoTransform(apzc);
-        Maybe<ScreenPoint> untransformedFocusPoint = UntransformTo<ScreenPixel>(
+        Maybe<ScreenPoint> untransformedFocusPoint = UntransformBy(
           outTransform, pinchInput.mFocusPoint);
 
         if (!untransformedFocusPoint) {
           return result;
         }
 
         result = mInputQueue->ReceiveInputEvent(
             apzc,
@@ -844,17 +844,17 @@ APZCTreeManager::ReceiveInputEvent(Input
       RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(tapInput.mPoint,
                                                             &hitResult);
       if (apzc) {
         MOZ_ASSERT(hitResult == HitLayer || hitResult == HitDispatchToContentRegion);
 
         ScreenToScreenMatrix4x4 outTransform = GetScreenToApzcTransform(apzc)
                                              * GetApzcToGeckoTransform(apzc);
         Maybe<ScreenIntPoint> untransformedPoint =
-          UntransformTo<ScreenPixel>(outTransform, tapInput.mPoint);
+          UntransformBy(outTransform, tapInput.mPoint);
 
         if (!untransformedPoint) {
           return result;
         }
 
         result = mInputQueue->ReceiveInputEvent(
             apzc,
             /* aTargetConfirmed = */ hitResult == HitLayer,
@@ -952,17 +952,17 @@ APZCTreeManager::ProcessTouchInput(Multi
     // (i.e. not anything cached in an input block).
     // This ensures that transformToApzc and transformToGecko are in sync.
     ScreenToParentLayerMatrix4x4 transformToApzc = GetScreenToApzcTransform(mApzcForInputBlock);
     ParentLayerToScreenMatrix4x4 transformToGecko = GetApzcToGeckoTransform(mApzcForInputBlock);
     ScreenToScreenMatrix4x4 outTransform = transformToApzc * transformToGecko;
     
     for (size_t i = 0; i < aInput.mTouches.Length(); i++) {
       SingleTouchData& touchData = aInput.mTouches[i];
-      Maybe<ScreenIntPoint> untransformedScreenPoint = UntransformTo<ScreenPixel>(
+      Maybe<ScreenIntPoint> untransformedScreenPoint = UntransformBy(
           outTransform, touchData.mScreenPoint);
       if (!untransformedScreenPoint) {
         return nsEventStatus_eIgnore;
       }
       touchData.mScreenPoint = *untransformedScreenPoint;
     }
   }
 
@@ -1041,17 +1041,17 @@ APZCTreeManager::ProcessEvent(WidgetInpu
   RefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(refPointAsScreen, &hitResult);
   if (apzc) {
     MOZ_ASSERT(hitResult == HitLayer || hitResult == HitDispatchToContentRegion);
     apzc->GetGuid(aOutTargetGuid);
     ScreenToParentLayerMatrix4x4 transformToApzc = GetScreenToApzcTransform(apzc);
     ParentLayerToScreenMatrix4x4 transformToGecko = GetApzcToGeckoTransform(apzc);
     ScreenToScreenMatrix4x4 outTransform = transformToApzc * transformToGecko;
     Maybe<ScreenIntPoint> untransformedRefPoint =
-      UntransformTo<ScreenPixel>(outTransform, refPointAsScreen);
+      UntransformBy(outTransform, refPointAsScreen);
     if (untransformedRefPoint) {
       aEvent.refPoint = ViewAs<LayoutDevicePixel>(*untransformedRefPoint, LDIsScreen);
     }
   }
   return result;
 }
 
 nsEventStatus
@@ -1349,24 +1349,24 @@ TransformDisplacement(APZCTreeManager* a
                       ParentLayerPoint& aStartPoint,
                       ParentLayerPoint& aEndPoint) {
   if (aSource == aTarget) {
     return true;
   }
 
   // Convert start and end points to Screen coordinates.
   ParentLayerToScreenMatrix4x4 untransformToApzc = aTreeManager->GetScreenToApzcTransform(aSource).Inverse();
-  ScreenPoint screenStart = TransformTo<ScreenPixel>(untransformToApzc, aStartPoint);
-  ScreenPoint screenEnd = TransformTo<ScreenPixel>(untransformToApzc, aEndPoint);
+  ScreenPoint screenStart = TransformBy(untransformToApzc, aStartPoint);
+  ScreenPoint screenEnd = TransformBy(untransformToApzc, aEndPoint);
 
 
   // Convert start and end points to aTarget's ParentLayer coordinates.
   ScreenToParentLayerMatrix4x4 transformToApzc = aTreeManager->GetScreenToApzcTransform(aTarget);
-  Maybe<ParentLayerPoint> startPoint = UntransformTo<ParentLayerPixel>(transformToApzc, screenStart);
-  Maybe<ParentLayerPoint> endPoint = UntransformTo<ParentLayerPixel>(transformToApzc, screenEnd);
+  Maybe<ParentLayerPoint> startPoint = UntransformBy(transformToApzc, screenStart);
+  Maybe<ParentLayerPoint> endPoint = UntransformBy(transformToApzc, screenEnd);
   if (!startPoint || !endPoint) {
     return false;
   }
   aEndPoint = *endPoint;
   aStartPoint = *startPoint;
 
   return true;
 }
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1549,17 +1549,17 @@ nsEventStatus AsyncPanZoomController::On
 bool
 AsyncPanZoomController::ConvertToGecko(const ScreenIntPoint& aPoint, CSSPoint* aOut)
 {
   if (APZCTreeManager* treeManagerLocal = GetApzcTreeManager()) {
     ScreenToScreenMatrix4x4 transformScreenToGecko =
         treeManagerLocal->GetScreenToApzcTransform(this)
       * treeManagerLocal->GetApzcToGeckoTransform(this);
     
-    Maybe<ScreenIntPoint> layoutPoint = UntransformTo<ScreenPixel>(
+    Maybe<ScreenIntPoint> layoutPoint = UntransformBy(
         transformScreenToGecko, aPoint);
     if (!layoutPoint) {
       return false;
     }
 
     { // scoped lock to access mFrameMetrics
       ReentrantMonitorAutoEnter lock(mMonitor);
       // NOTE: This isn't *quite* LayoutDevicePoint, we just don't have a name
@@ -2054,29 +2054,29 @@ ScreenToParentLayerMatrix4x4 AsyncPanZoo
   if (APZCTreeManager* treeManagerLocal = GetApzcTreeManager()) {
     return treeManagerLocal->GetScreenToApzcTransform(this);
   }
   return ScreenToParentLayerMatrix4x4();
 }
 
 ScreenPoint AsyncPanZoomController::ToScreenCoordinates(const ParentLayerPoint& aVector,
                                                         const ParentLayerPoint& aAnchor) const {
-  return TransformVector<ScreenPixel>(GetTransformToThis().Inverse(), aVector, aAnchor);
+  return TransformVector(GetTransformToThis().Inverse(), aVector, aAnchor);
 }
 
 // TODO: figure out a good way to check the w-coordinate is positive and return the result
 ParentLayerPoint AsyncPanZoomController::ToParentLayerCoordinates(const ScreenPoint& aVector,
                                                                   const ScreenPoint& aAnchor) const {
-  return TransformVector<ParentLayerPixel>(GetTransformToThis(), aVector, aAnchor);
+  return TransformVector(GetTransformToThis(), aVector, aAnchor);
 }
 
 bool AsyncPanZoomController::Contains(const ScreenIntPoint& aPoint) const
 {
   ScreenToParentLayerMatrix4x4 transformToThis = GetTransformToThis();
-  Maybe<ParentLayerIntPoint> point = UntransformTo<ParentLayerPixel>(transformToThis, aPoint);
+  Maybe<ParentLayerIntPoint> point = UntransformBy(transformToThis, aPoint);
   if (!point) {
     return false;
   }
 
   ParentLayerIntRect cb;
   {
     ReentrantMonitorAutoEnter lock(mMonitor);
     GetFrameMetrics().GetCompositionBounds().ToIntRect(&cb);
--- a/gfx/layers/apz/src/HitTestingTreeNode.cpp
+++ b/gfx/layers/apz/src/HitTestingTreeNode.cpp
@@ -226,17 +226,17 @@ HitTestingTreeNode::IsOutsideClip(const 
 Maybe<LayerPoint>
 HitTestingTreeNode::Untransform(const ParentLayerPoint& aPoint) const
 {
   // convert into Layer coordinate space
   gfx::Matrix4x4 localTransform = mTransform;
   if (mApzc) {
     localTransform = localTransform * mApzc->GetCurrentAsyncTransformWithOverscroll();
   }
-  return UntransformTo<LayerPixel>(
+  return UntransformBy(
       ViewAs<LayerToParentLayerMatrix4x4>(localTransform).Inverse(), aPoint);
 }
 
 HitTestResult
 HitTestingTreeNode::HitTest(const ParentLayerPoint& aPoint) const
 {
   // This should only ever get called if the point is inside the clip region
   // for this node.
--- a/gfx/layers/client/ClientTiledPaintedLayer.cpp
+++ b/gfx/layers/client/ClientTiledPaintedLayer.cpp
@@ -55,17 +55,17 @@ ClientTiledPaintedLayer::FillSpecificAtt
   aAttrs = PaintedLayerAttributes(GetValidRegion());
 }
 
 static Maybe<LayerRect>
 ApplyParentLayerToLayerTransform(const ParentLayerToLayerMatrix4x4& aTransform,
                                  const ParentLayerRect& aParentLayerRect,
                                  const LayerRect& aClip)
 {
-  return UntransformTo<LayerPixel>(aTransform, aParentLayerRect, aClip);
+  return UntransformBy(aTransform, aParentLayerRect, aClip);
 }
 
 static LayerToParentLayerMatrix4x4
 GetTransformToAncestorsParentLayer(Layer* aStart, const LayerMetricsWrapper& aAncestor)
 {
   gfx::Matrix4x4 transform;
   const LayerMetricsWrapper& ancestorParent = aAncestor.GetParent();
   for (LayerMetricsWrapper iter(aStart, LayerMetricsWrapper::StartAt::BOTTOM);
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -1402,17 +1402,17 @@ static Maybe<LayerRect>
 GetCompositorSideCompositionBounds(const LayerMetricsWrapper& aScrollAncestor,
                                    const LayerToParentLayerMatrix4x4& aTransformToCompBounds,
                                    const ViewTransform& aAPZTransform,
                                    const LayerRect& aClip)
 {
   LayerToParentLayerMatrix4x4 transform = aTransformToCompBounds *
       ViewAs<ParentLayerToParentLayerMatrix4x4>(aAPZTransform);
 
-  return UntransformTo<LayerPixel>(transform.Inverse(),
+  return UntransformBy(transform.Inverse(),
     aScrollAncestor.Metrics().GetCompositionBounds(), aClip);
 }
 
 bool
 ClientMultiTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInvalidRegion,
                                                             const nsIntRegion& aOldValidRegion,
                                                             nsIntRegion& aRegionToPaint,
                                                             BasicTiledLayerPaintData* aPaintData,
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -202,17 +202,17 @@ GetBaseTransform(Layer* aLayer, Matrix4x
 
 static void
 TransformClipRect(Layer* aLayer,
                   const ParentLayerToParentLayerMatrix4x4& aTransform)
 {
   MOZ_ASSERT(aTransform.Is2D());
   const Maybe<ParentLayerIntRect>& clipRect = aLayer->AsLayerComposite()->GetShadowClipRect();
   if (clipRect) {
-    ParentLayerIntRect transformed = TransformTo<ParentLayerPixel>(aTransform, *clipRect);
+    ParentLayerIntRect transformed = TransformBy(aTransform, *clipRect);
     aLayer->AsLayerComposite()->SetShadowClipRect(Some(transformed));
   }
 }
 
 /**
  * Set the given transform as the shadow transform on the layer, assuming
  * that the given transform already has the pre- and post-scales applied.
  * That is, this function cancels out the pre- and post-scales from aTransform
@@ -464,18 +464,18 @@ AsyncCompositionManager::AlignFixedAndSt
 
   // We want to translate the layer by the difference between |transformedAnchor|
   // and |anchor|. To achieve this, we will add a translation to the layer's
   // transform. This translation will apply on top of the layer's local
   // transform, but |anchor| and |transformedAnchor| are in a coordinate space
   // where the local transform isn't applied yet, so apply it and then subtract
   // to get the desired translation.
   auto localTransformTyped = ViewAs<LayerToParentLayerMatrix4x4>(localTransform);
-  ParentLayerPoint translation = TransformTo<ParentLayerPixel>(localTransformTyped, transformedAnchor)
-                               - TransformTo<ParentLayerPixel>(localTransformTyped, anchor);
+  ParentLayerPoint translation = TransformBy(localTransformTyped, transformedAnchor)
+                               - TransformBy(localTransformTyped, anchor);
 
   if (aLayer->GetIsStickyPosition()) {
     // For sticky positioned layers, the difference between the two rectangles
     // defines a pair of translation intervals in each dimension through which
     // the layer should not move relative to the scroll container. To
     // accomplish this, we limit each dimension of the |translation| to that
     // part of it which overlaps those intervals.
     const LayerRect& stickyOuter = aLayer->GetStickyScrollRangeOuter();
@@ -892,17 +892,17 @@ AsyncCompositionManager::ApplyAsyncConte
     mIsFirstPaint = false;
 #endif
 
     // Transform the current local clip by this APZC's async transform. If we're
     // using containerful scrolling, then the clip is not part of the scrolled
     // frame and should not be transformed.
     if (asyncClip && !metrics.UsesContainerScrolling()) {
       MOZ_ASSERT(asyncTransform.Is2D());
-      asyncClip = Some(TransformTo<ParentLayerPixel>(
+      asyncClip = Some(TransformBy(
           ViewAs<ParentLayerToParentLayerMatrix4x4>(asyncTransform), *asyncClip));
     }
 
     // Combine the local clip with the ancestor scrollframe clip. This is not
     // included in the async transform above, since the ancestor clip should not
     // move with this APZC.
     if (metrics.HasClipRect()) {
       ParentLayerIntRect clip = metrics.ClipRect();
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -303,17 +303,17 @@ LayerManagerComposite::PostProcessLayers
   if (insideClip) {
     visible.AndWith(*insideClip);
   }
   composite->SetShadowVisibleRegion(visible);
 
   // Transform the newly calculated visible region into our parent's space,
   // apply our clip to it (if any), and accumulate it into |aVisibleRegion|
   // for the caller to use.
-  ParentLayerIntRegion visibleParentSpace = TransformTo<ParentLayerPixel>(
+  ParentLayerIntRegion visibleParentSpace = TransformBy(
       ViewAs<LayerToParentLayerMatrix4x4>(transform), visible);
   if (const Maybe<ParentLayerIntRect>& clipRect = composite->GetShadowClipRect()) {
     visibleParentSpace.AndWith(*clipRect);
   }
   aVisibleRegion.OrWith(ViewAs<LayerPixel>(visibleParentSpace,
       PixelCastJustification::MovingDownToChildren));
 
   // If we have a simple transform, then we can add our opaque area into
--- a/gfx/layers/composite/LayerManagerComposite.h
+++ b/gfx/layers/composite/LayerManagerComposite.h
@@ -574,17 +574,17 @@ RenderWithAllMasks(Layer* aLayer, Compos
   //  (3) The final mask.
   // Part (2) can be empty.
   // For parts (1) and (2) we need to allocate intermediate surfaces to render
   // into. The final mask gets rendered into the original render target.
 
   // Calculate the size of the intermediate surfaces.
   gfx::Rect visibleRect(aLayer->GetEffectiveVisibleRegion().ToUnknownRegion().GetBounds());
   gfx::Matrix4x4 transform = aLayer->GetEffectiveTransform();
-  // TODO: Use RenderTargetIntRect and TransformTo<...> here
+  // TODO: Use RenderTargetIntRect and TransformBy here
   gfx::IntRect surfaceRect =
     RoundedOut(transform.TransformAndClipBounds(visibleRect, gfx::Rect(aClipRect)));
   if (surfaceRect.IsEmpty()) {
     return;
   }
 
   RefPtr<CompositingRenderTarget> originalTarget =
     aCompositor->GetCurrentRenderTarget();
--- a/gfx/src/nsRegion.h
+++ b/gfx/src/nsRegion.h
@@ -721,17 +721,17 @@ public:
   }
 
   Derived& ScaleInverseRoundOut (float aXScale, float aYScale)
   {
     mImpl.ScaleInverseRoundOut(aXScale, aYScale);
     return This();
   }
 
-  // Prefer using TransformTo<TargetUnits>(region) from UnitTransforms.h,
+  // Prefer using TransformBy(matrix, region) from UnitTransforms.h,
   // as applying the transform should typically change the unit system.
   // TODO(botond): Move this to IntRegionTyped and disable it for
   //               unit != UnknownUnits.
   Derived& Transform (const mozilla::gfx::Matrix4x4 &aTransform)
   {
     mImpl.Transform(aTransform);
     return This();
   }
--- a/layout/base/UnitTransforms.h
+++ b/layout/base/UnitTransforms.h
@@ -135,116 +135,116 @@ template <class TypedMatrix>
 TypedMatrix ViewAs(const gfx::Matrix4x4& aMatrix) {
   return TypedMatrix::FromUnknownMatrix(aMatrix);
 }
 
 // Convenience functions for transforming an entity from one strongly-typed
 // coordinate system to another using the provided transformation matrix.
 template <typename TargetUnits, typename SourceUnits>
 static gfx::PointTyped<TargetUnits>
-TransformTo(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
+TransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
             const gfx::PointTyped<SourceUnits>& aPoint)
 {
   return aTransform * aPoint;
 }
 template <typename TargetUnits, typename SourceUnits>
 static gfx::IntPointTyped<TargetUnits>
-TransformTo(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
+TransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
             const gfx::IntPointTyped<SourceUnits>& aPoint)
 {
-  return RoundedToInt(TransformTo<TargetUnits>(aTransform, gfx::PointTyped<SourceUnits>(aPoint)));
+  return RoundedToInt(TransformBy(aTransform, gfx::PointTyped<SourceUnits>(aPoint)));
 }
 template <typename TargetUnits, typename SourceUnits>
 static gfx::RectTyped<TargetUnits>
-TransformTo(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
+TransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
             const gfx::RectTyped<SourceUnits>& aRect)
 {
   return aTransform.TransformBounds(aRect);
 }
 template <typename TargetUnits, typename SourceUnits>
 static gfx::IntRectTyped<TargetUnits>
-TransformTo(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
+TransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
             const gfx::IntRectTyped<SourceUnits>& aRect)
 {
-  return RoundedToInt(TransformTo<TargetUnits>(aTransform, gfx::RectTyped<SourceUnits>(aRect)));
+  return RoundedToInt(TransformBy(aTransform, gfx::RectTyped<SourceUnits>(aRect)));
 }
 template <typename TargetUnits, typename SourceUnits>
 static gfx::IntRegionTyped<TargetUnits>
-TransformTo(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
+TransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
             const gfx::IntRegionTyped<SourceUnits>& aRegion)
 {
   return ViewAs<TargetUnits>(aRegion.ToUnknownRegion().Transform(
       aTransform.ToUnknownMatrix()));
 }
 
 // Transform |aVector|, which is anchored at |aAnchor|, by the given transform
 // matrix, yielding a point in |TargetUnits|.
 // The anchor is necessary because with 3D tranforms, the location of the
 // vector can affect the result of the transform.
 template <typename TargetUnits, typename SourceUnits>
 static gfx::PointTyped<TargetUnits>
 TransformVector(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
                 const gfx::PointTyped<SourceUnits>& aVector,
                 const gfx::PointTyped<SourceUnits>& aAnchor)
 {
-  gfx::PointTyped<TargetUnits> transformedStart = TransformTo<TargetUnits>(aTransform, aAnchor);
-  gfx::PointTyped<TargetUnits> transformedEnd = TransformTo<TargetUnits>(aTransform, aAnchor + aVector);
+  gfx::PointTyped<TargetUnits> transformedStart = TransformBy(aTransform, aAnchor);
+  gfx::PointTyped<TargetUnits> transformedEnd = TransformBy(aTransform, aAnchor + aVector);
   return transformedEnd - transformedStart;
 }
 
-// UntransformTo() and UntransformVector() are like TransformTo() and 
+// UntransformBy() and UntransformVector() are like TransformBy() and
 // TransformVector(), respectively, but are intended for cases where
 // the transformation matrix is the inverse of a 3D projection. When
 // using such transforms, the resulting Point4D is only meaningful
 // if it has a positive w-coordinate. To handle this, these functions
 // return a Maybe object which contains a value if and only if the
 // result is meaningful
 template <typename TargetUnits, typename SourceUnits>
 static Maybe<gfx::PointTyped<TargetUnits>>
-UntransformTo(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
+UntransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
               const gfx::PointTyped<SourceUnits>& aPoint)
 {
   gfx::Point4DTyped<TargetUnits> point = aTransform.ProjectPoint(aPoint);
   if (!point.HasPositiveWCoord()) {
     return Nothing();
   }
   return Some(point.As2DPoint());
 }
 template <typename TargetUnits, typename SourceUnits>
 static Maybe<gfx::IntPointTyped<TargetUnits>>
-UntransformTo(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
+UntransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
               const gfx::IntPointTyped<SourceUnits>& aPoint)
 {
   gfx::PointTyped<SourceUnits> p = aPoint;
   gfx::Point4DTyped<TargetUnits> point = aTransform.ProjectPoint(p);
   if (!point.HasPositiveWCoord()) {
     return Nothing();
   }
   return Some(RoundedToInt(point.As2DPoint()));
 }
 
-// The versions of UntransformTo() that take a rectangle also take a clip,
+// The versions of UntransformBy() that take a rectangle also take a clip,
 // which represents the bounds within which the target must fall. The
 // result of the transform is intersected with this clip, and is considered
 // meaningful if the intersection is not empty.
 template <typename TargetUnits, typename SourceUnits>
 static Maybe<gfx::RectTyped<TargetUnits>>
-UntransformTo(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
+UntransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
               const gfx::RectTyped<SourceUnits>& aRect,
               const gfx::RectTyped<TargetUnits>& aClip)
 {
   gfx::RectTyped<TargetUnits> rect = aTransform.ProjectRectBounds(aRect, aClip);
   if (rect.IsEmpty()) {
     return Nothing();
   }
   return Some(rect);
 }
 template <typename TargetUnits, typename SourceUnits>
 static Maybe<gfx::IntRectTyped<TargetUnits>>
-UntransformTo(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
+UntransformBy(const gfx::Matrix4x4Typed<SourceUnits, TargetUnits>& aTransform,
               const gfx::IntRectTyped<SourceUnits>& aRect,
               const gfx::IntRectTyped<TargetUnits>& aClip)
 {
   gfx::RectTyped<TargetUnits> rect = aTransform.ProjectRectBounds(aRect, aClip);
   if (rect.IsEmpty()) {
     return Nothing();
   }
   return Some(RoundedToInt(rect));
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -1237,17 +1237,17 @@ nsDisplayListBuilder::AdjustWindowDraggi
   const DisplayItemClip* clip = ClipState().GetCurrentCombinedClip(this);
   if (clip) {
     borderBox = clip->ApplyNonRoundedIntersection(borderBox);
   }
   if (!borderBox.IsEmpty()) {
     LayoutDeviceRect devPixelBorderBox =
       LayoutDevicePixel::FromAppUnits(borderBox, aFrame->PresContext()->AppUnitsPerDevPixel());
     LayoutDeviceRect transformedDevPixelBorderBox =
-      TransformTo<LayoutDevicePixel>(referenceFrameToRootReferenceFrame, devPixelBorderBox);
+      TransformBy(referenceFrameToRootReferenceFrame, devPixelBorderBox);
     transformedDevPixelBorderBox.Round();
     LayoutDeviceIntRect transformedDevPixelBorderBoxInt;
     if (transformedDevPixelBorderBox.ToIntRect(&transformedDevPixelBorderBoxInt)) {
       const nsStyleUserInterface* styleUI = aFrame->StyleUserInterface();
       if (styleUI->mWindowDragging == NS_STYLE_WINDOW_DRAGGING_DRAG) {
         mWindowDraggingRegion.OrWith(transformedDevPixelBorderBoxInt);
       } else {
         mWindowDraggingRegion.SubOut(transformedDevPixelBorderBoxInt);
--- a/widget/InputData.cpp
+++ b/widget/InputData.cpp
@@ -69,17 +69,17 @@ MouseInput::MouseInput(const WidgetMouse
       MOZ_ASSERT_UNREACHABLE("Mouse event type not supported");
       break;
   }
 }
 
 bool
 MouseInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
 {
-  Maybe<ParentLayerPoint> point = UntransformTo<ParentLayerPixel>(aTransform, mOrigin);
+  Maybe<ParentLayerPoint> point = UntransformBy(aTransform, mOrigin);
   if (!point) {
     return false;
   }
   mLocalOrigin = *point;
 
   return true;
 }
 
@@ -268,17 +268,17 @@ MultiTouchInput::MultiTouchInput(const W
                                          180.0f,
                                          1.0f));
 }
 
 bool
 MultiTouchInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
 {
   for (size_t i = 0; i < mTouches.Length(); i++) {
-    Maybe<ParentLayerIntPoint> point = UntransformTo<ParentLayerPixel>(aTransform, mTouches[i].mScreenPoint);
+    Maybe<ParentLayerIntPoint> point = UntransformBy(aTransform, mTouches[i].mScreenPoint);
     if (!point) { 
       return false;
     }
     mTouches[i].mLocalScreenPoint = *point;
   }
   return true;
 }
 
@@ -314,45 +314,45 @@ PanGestureInput::ToWidgetWheelEvent(nsIW
   wheelEvent.deltaY = mPanDisplacement.y;
   wheelEvent.mFlags.mHandledByAPZ = mHandledByAPZ;
   return wheelEvent;
 }
 
 bool
 PanGestureInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
 { 
-  Maybe<ParentLayerPoint> panStartPoint = UntransformTo<ParentLayerPixel>(aTransform, mPanStartPoint);
+  Maybe<ParentLayerPoint> panStartPoint = UntransformBy(aTransform, mPanStartPoint);
   if (!panStartPoint) {
     return false;
   }
   mLocalPanStartPoint = *panStartPoint;
   
-  Maybe<ParentLayerPoint> panDisplacement = UntransformVector<ParentLayerPixel>(aTransform, mPanDisplacement, mPanStartPoint);
+  Maybe<ParentLayerPoint> panDisplacement = UntransformVector(aTransform, mPanDisplacement, mPanStartPoint);
   if (!panDisplacement) {
     return false;
   }
   mLocalPanDisplacement = *panDisplacement;
   return true;
 }
 
 bool
 PinchGestureInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
 { 
-  Maybe<ParentLayerPoint> point = UntransformTo<ParentLayerPixel>(aTransform, mFocusPoint);
+  Maybe<ParentLayerPoint> point = UntransformBy(aTransform, mFocusPoint);
   if (!point) {
     return false;
   }
   mLocalFocusPoint = *point;
   return true;
 }
 
 bool
 TapGestureInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
 {
-  Maybe<ParentLayerIntPoint> point = UntransformTo<ParentLayerPixel>(aTransform, mPoint);
+  Maybe<ParentLayerIntPoint> point = UntransformBy(aTransform, mPoint);
   if (!point) {
     return false;
   }
   mLocalPoint = *point;
   return true;
 }
 
 static uint32_t
@@ -406,17 +406,17 @@ ScrollWheelInput::ToWidgetWheelEvent(nsI
   wheelEvent.lineOrPageDeltaY = mLineOrPageDeltaY;
   wheelEvent.mFlags.mHandledByAPZ = mHandledByAPZ;
   return wheelEvent;
 }
 
 bool
 ScrollWheelInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
 {
-  Maybe<ParentLayerPoint> point = UntransformTo<ParentLayerPixel>(aTransform, mOrigin);
+  Maybe<ParentLayerPoint> point = UntransformBy(aTransform, mOrigin);
   if (!point) {
     return false;
   }
   mLocalOrigin = *point;
   return true;
 }
 
 bool