Bug 1144951. Rename ConvertAppUnits to ScaleToOtherAppUnits. r=mats
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 26 Mar 2015 16:44:40 -0500
changeset 264889 b617b76326f7b7000703e8625d49543662846ca9
parent 264888 a1f0b23f51049f8abe0faef128c60e52962d9426
child 264890 1b374964865c550409812bc72d3aa3804ce599ca
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1144951
milestone39.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 1144951. Rename ConvertAppUnits to ScaleToOtherAppUnits. r=mats
dom/events/ContentEventHandler.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
gfx/src/nsPoint.h
gfx/src/nsRect.h
gfx/src/nsRegion.cpp
gfx/src/nsRegion.h
gfx/src/nsSize.h
layout/base/nsDisplayList.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsPresShell.cpp
layout/generic/nsFrame.cpp
layout/generic/nsSubDocumentFrame.cpp
layout/xul/nsMenuPopupFrame.cpp
view/nsView.cpp
view/nsViewManager.cpp
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -1171,17 +1171,17 @@ ContentEventHandler::OnQueryCharacterAtP
     // there is no character at the point.
     aEvent->mReply.mOffset = WidgetQueryContentEvent::NOT_FOUND;
     aEvent->mSucceeded = true;
     return NS_OK;
   }
   nsPoint ptInTarget = ptInRoot + rootFrame->GetOffsetToCrossDoc(targetFrame);
   int32_t rootAPD = rootFrame->PresContext()->AppUnitsPerDevPixel();
   int32_t targetAPD = targetFrame->PresContext()->AppUnitsPerDevPixel();
-  ptInTarget = ptInTarget.ConvertAppUnits(rootAPD, targetAPD);
+  ptInTarget = ptInTarget.ScaleToOtherAppUnits(rootAPD, targetAPD);
 
   nsTextFrame* textframe = static_cast<nsTextFrame*>(targetFrame);
   nsIFrame::ContentOffsets contentOffsets =
     textframe->GetCharacterOffsetAtFramePoint(ptInTarget);
   NS_ENSURE_TRUE(contentOffsets.content, NS_ERROR_FAILURE);
   uint32_t offset;
   rv = GetFlatTextOffsetOfRange(mRootContent, contentOffsets.content,
                                 contentOffsets.offset, &offset,
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -1302,25 +1302,25 @@ GetOffsetRootContent(nsIFrame* aFrame)
     if (parent) {
       f = parent;
     } else {
       nsPoint newOffset(0, 0);
       f = nsLayoutUtils::GetCrossDocParentFrame(f, &newOffset);
       int32_t newAPD = f ? f->PresContext()->AppUnitsPerDevPixel() : 0;
       if (!f || newAPD != currAPD) {
         // Convert docOffset to the right APD and add it to offset.
-        offset += docOffset.ConvertAppUnits(currAPD, apd);
+        offset += docOffset.ScaleToOtherAppUnits(currAPD, apd);
         docOffset.x = docOffset.y = 0;
       }
       currAPD = newAPD;
       docOffset += newOffset;
     }
   }
 
-  offset += docOffset.ConvertAppUnits(currAPD, apd);
+  offset += docOffset.ScaleToOtherAppUnits(currAPD, apd);
 
   return offset;
 }
 
 LayoutDeviceRect nsPluginInstanceOwner::GetPluginRect()
 {
   // Get the offset of the content relative to the page
   nsRect bounds = mPluginFrame->GetContentRectRelativeToSelf() + GetOffsetRootContent(mPluginFrame);
--- a/gfx/src/nsPoint.h
+++ b/gfx/src/nsPoint.h
@@ -27,17 +27,17 @@ struct nsPoint : public mozilla::gfx::Ba
   inline nsIntPoint ToNearestPixels(nscoord aAppUnitsPerPixel) const;
 
   /**
    * Return this point scaled to a different appunits per pixel (APP) ratio.
    * @param aFromAPP the APP to scale from
    * @param aToAPP the APP to scale to
    */
   MOZ_WARN_UNUSED_RESULT inline nsPoint
-    ConvertAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
+    ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
 };
 
 // nsIntPoint represents a point in one of the types of pixels.
 // Uses of nsIntPoint should eventually be converted to CSSIntPoint,
 // LayoutDeviceIntPoint, etc. (see layout/base/Units.h).
 
 struct nsIntPoint : public mozilla::gfx::BasePoint<int32_t, nsIntPoint> {
   typedef mozilla::gfx::BasePoint<int32_t, nsIntPoint> Super;
@@ -60,17 +60,17 @@ nsPoint::ScaleToNearestPixels(float aXSc
 
 inline nsIntPoint
 nsPoint::ToNearestPixels(nscoord aAppUnitsPerPixel) const
 {
   return ScaleToNearestPixels(1.0f, 1.0f, aAppUnitsPerPixel);
 }
 
 inline nsPoint
-nsPoint::ConvertAppUnits(int32_t aFromAPP, int32_t aToAPP) const
+nsPoint::ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const
 {
   if (aFromAPP != aToAPP) {
     nsPoint point;
     point.x = NSToCoordRound(NSCoordScale(x, aFromAPP, aToAPP));
     point.y = NSToCoordRound(NSCoordScale(y, aFromAPP, aToAPP));
     return point;
   }
   return *this;
--- a/gfx/src/nsRect.h
+++ b/gfx/src/nsRect.h
@@ -139,19 +139,19 @@ struct NS_GFX nsRect :
    * In the RoundOut version we make the rect the smallest rect containing the
    * unrounded result. In the RoundIn version we make the rect the largest rect
    * contained in the unrounded result.
    * @param aFromAPP the APP to scale from
    * @param aToAPP the APP to scale to
    * @note this can turn an empty rectangle into a non-empty rectangle
    */
   MOZ_WARN_UNUSED_RESULT inline nsRect
-    ConvertAppUnitsRoundOut(int32_t aFromAPP, int32_t aToAPP) const;
+    ScaleToOtherAppUnitsRoundOut(int32_t aFromAPP, int32_t aToAPP) const;
   MOZ_WARN_UNUSED_RESULT inline nsRect
-    ConvertAppUnitsRoundIn(int32_t aFromAPP, int32_t aToAPP) const;
+    ScaleToOtherAppUnitsRoundIn(int32_t aFromAPP, int32_t aToAPP) const;
 
   inline nsIntRect ScaleToNearestPixels(float aXScale, float aYScale,
                                         nscoord aAppUnitsPerPixel) const;
   inline nsIntRect ToNearestPixels(nscoord aAppUnitsPerPixel) const;
   // Note: this can turn an empty rectangle into a non-empty rectangle
   inline nsIntRect ScaleToOutsidePixels(float aXScale, float aYScale,
                                         nscoord aAppUnitsPerPixel) const;
   // Note: this can turn an empty rectangle into a non-empty rectangle
@@ -202,17 +202,17 @@ struct NS_GFX nsIntRect :
   }
 };
 
 /*
  * App Unit/Pixel conversions
  */
 
 inline nsRect
-nsRect::ConvertAppUnitsRoundOut(int32_t aFromAPP, int32_t aToAPP) const
+nsRect::ScaleToOtherAppUnitsRoundOut(int32_t aFromAPP, int32_t aToAPP) const
 {
   if (aFromAPP == aToAPP) {
     return *this;
   }
 
   nsRect rect;
   nscoord right = NSToCoordCeil(NSCoordScale(XMost(), aFromAPP, aToAPP));
   nscoord bottom = NSToCoordCeil(NSCoordScale(YMost(), aFromAPP, aToAPP));
@@ -220,17 +220,17 @@ nsRect::ConvertAppUnitsRoundOut(int32_t 
   rect.y = NSToCoordFloor(NSCoordScale(y, aFromAPP, aToAPP));
   rect.width = (right - rect.x);
   rect.height = (bottom - rect.y);
 
   return rect;
 }
 
 inline nsRect
-nsRect::ConvertAppUnitsRoundIn(int32_t aFromAPP, int32_t aToAPP) const
+nsRect::ScaleToOtherAppUnitsRoundIn(int32_t aFromAPP, int32_t aToAPP) const
 {
   if (aFromAPP == aToAPP) {
     return *this;
   }
 
   nsRect rect;
   nscoord right = NSToCoordFloor(NSCoordScale(XMost(), aFromAPP, aToAPP));
   nscoord bottom = NSToCoordFloor(NSCoordScale(YMost(), aFromAPP, aToAPP));
--- a/gfx/src/nsRegion.cpp
+++ b/gfx/src/nsRegion.cpp
@@ -634,52 +634,52 @@ nsRegion& nsRegion::Transform (const gfx
   pixman_region32_init_rects(&region, boxes, n);
 
   pixman_region32_fini(&mImpl);
   mImpl = region;
   return *this;
 }
 
 
-nsRegion nsRegion::ConvertAppUnitsRoundOut (int32_t aFromAPP, int32_t aToAPP) const
+nsRegion nsRegion::ScaleToOtherAppUnitsRoundOut (int32_t aFromAPP, int32_t aToAPP) const
 {
   if (aFromAPP == aToAPP) {
     return *this;
   }
 
   nsRegion region = *this;
   int n;
   pixman_box32_t *boxes = pixman_region32_rectangles(&region.mImpl, &n);
   for (int i=0; i<n; i++) {
     nsRect rect = BoxToRect(boxes[i]);
-    rect = rect.ConvertAppUnitsRoundOut(aFromAPP, aToAPP);
+    rect = rect.ScaleToOtherAppUnitsRoundOut(aFromAPP, aToAPP);
     boxes[i] = RectToBox(rect);
   }
 
   pixman_region32_t pixmanRegion;
   // This will union all of the rectangles and runs in about O(n lg(n))
   pixman_region32_init_rects(&pixmanRegion, boxes, n);
 
   pixman_region32_fini(&region.mImpl);
   region.mImpl = pixmanRegion;
   return region;
 }
 
-nsRegion nsRegion::ConvertAppUnitsRoundIn (int32_t aFromAPP, int32_t aToAPP) const
+nsRegion nsRegion::ScaleToOtherAppUnitsRoundIn (int32_t aFromAPP, int32_t aToAPP) const
 {
   if (aFromAPP == aToAPP) {
     return *this;
   }
 
   nsRegion region = *this;
   int n;
   pixman_box32_t *boxes = pixman_region32_rectangles(&region.mImpl, &n);
   for (int i=0; i<n; i++) {
     nsRect rect = BoxToRect(boxes[i]);
-    rect = rect.ConvertAppUnitsRoundIn(aFromAPP, aToAPP);
+    rect = rect.ScaleToOtherAppUnitsRoundIn(aFromAPP, aToAPP);
     boxes[i] = RectToBox(rect);
   }
 
   pixman_region32_t pixmanRegion;
   // This will union all of the rectangles and runs in about O(n lg(n))
   pixman_region32_init_rects(&pixmanRegion, boxes, n);
 
   pixman_region32_fini(&region.mImpl);
--- a/gfx/src/nsRegion.h
+++ b/gfx/src/nsRegion.h
@@ -283,25 +283,25 @@ public:
     uint32_t result = pixman_region32_n_rects(Impl());
     return (result == 1 && GetBounds().IsEmpty()) ? 0 : result;
   }
   const nsRect GetBounds () const { return BoxToRect(mImpl.extents); }
   uint64_t Area () const;
 
   /**
    * Return this region scaled to a different appunits per pixel (APP) ratio.
-   * This applies nsRect::ConvertAppUnitsRoundOut/In to each rect of the region.
+   * This applies nsRect::ScaleToOtherAppUnitsRoundOut/In to each rect of the region.
    * @param aFromAPP the APP to scale from
    * @param aToAPP the APP to scale to
    * @note this can turn an empty region into a non-empty region
    */
   MOZ_WARN_UNUSED_RESULT nsRegion
-    ConvertAppUnitsRoundOut (int32_t aFromAPP, int32_t aToAPP) const;
+    ScaleToOtherAppUnitsRoundOut (int32_t aFromAPP, int32_t aToAPP) const;
   MOZ_WARN_UNUSED_RESULT nsRegion
-    ConvertAppUnitsRoundIn (int32_t aFromAPP, int32_t aToAPP) const;
+    ScaleToOtherAppUnitsRoundIn (int32_t aFromAPP, int32_t aToAPP) const;
   nsRegion& ScaleRoundOut(float aXScale, float aYScale);
   nsRegion& ScaleInverseRoundOut(float aXScale, float aYScale);
   nsRegion& Transform (const gfx3DMatrix &aTransform);
   nsIntRegion ScaleToOutsidePixels (float aXScale, float aYScale, nscoord aAppUnitsPerPixel) const;
   nsIntRegion ScaleToInsidePixels (float aXScale, float aYScale, nscoord aAppUnitsPerPixel) const;
   nsIntRegion ScaleToNearestPixels (float aXScale, float aYScale, nscoord aAppUnitsPerPixel) const;
   nsIntRegion ToOutsidePixels (nscoord aAppUnitsPerPixel) const;
   nsIntRegion ToNearestPixels (nscoord aAppUnitsPerPixel) const;
--- a/gfx/src/nsSize.h
+++ b/gfx/src/nsSize.h
@@ -27,17 +27,17 @@ struct nsSize : public mozilla::gfx::Bas
   inline nsIntSize ToNearestPixels(nscoord aAppUnitsPerPixel) const;
 
   /**
    * Return this size scaled to a different appunits per pixel (APP) ratio.
    * @param aFromAPP the APP to scale from
    * @param aToAPP the APP to scale to
    */
   MOZ_WARN_UNUSED_RESULT inline nsSize
-    ConvertAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
+    ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
 };
 
 struct nsIntSize : public mozilla::gfx::BaseSize<int32_t, nsIntSize> {
   typedef mozilla::gfx::BaseSize<int32_t, nsIntSize> Super;
 
   nsIntSize() : Super() {}
   nsIntSize(int32_t aWidth, int32_t aHeight) : Super(aWidth, aHeight) {}
 
@@ -59,17 +59,17 @@ nsSize::ScaleToNearestPixels(float aXSca
 
 inline nsIntSize
 nsSize::ToNearestPixels(nscoord aAppUnitsPerPixel) const
 {
   return ScaleToNearestPixels(1.0f, 1.0f, aAppUnitsPerPixel);
 }
 
 inline nsSize
-nsSize::ConvertAppUnits(int32_t aFromAPP, int32_t aToAPP) const {
+nsSize::ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const {
   if (aFromAPP != aToAPP) {
     nsSize size;
     size.width = NSToCoordRound(NSCoordScale(width, aFromAPP, aToAPP));
     size.height = NSToCoordRound(NSCoordScale(height, aFromAPP, aToAPP));
     return size;
   }
   return *this;
 }
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -4882,48 +4882,48 @@ nsDisplayZoom::~nsDisplayZoom() {
   MOZ_COUNT_DTOR(nsDisplayZoom);
 }
 #endif
 
 nsRect nsDisplayZoom::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap)
 {
   nsRect bounds = nsDisplaySubDocument::GetBounds(aBuilder, aSnap);
   *aSnap = false;
-  return bounds.ConvertAppUnitsRoundOut(mAPD, mParentAPD);
+  return bounds.ScaleToOtherAppUnitsRoundOut(mAPD, mParentAPD);
 }
 
 void nsDisplayZoom::HitTest(nsDisplayListBuilder *aBuilder,
                             const nsRect& aRect,
                             HitTestState *aState,
                             nsTArray<nsIFrame*> *aOutFrames)
 {
   nsRect rect;
   // A 1x1 rect indicates we are just hit testing a point, so pass down a 1x1
   // rect as well instead of possibly rounding the width or height to zero.
   if (aRect.width == 1 && aRect.height == 1) {
-    rect.MoveTo(aRect.TopLeft().ConvertAppUnits(mParentAPD, mAPD));
+    rect.MoveTo(aRect.TopLeft().ScaleToOtherAppUnits(mParentAPD, mAPD));
     rect.width = rect.height = 1;
   } else {
-    rect = aRect.ConvertAppUnitsRoundOut(mParentAPD, mAPD);
+    rect = aRect.ScaleToOtherAppUnitsRoundOut(mParentAPD, mAPD);
   }
   mList.HitTest(aBuilder, rect, aState, aOutFrames);
 }
 
 bool nsDisplayZoom::ComputeVisibility(nsDisplayListBuilder *aBuilder,
                                       nsRegion *aVisibleRegion)
 {
   // Convert the passed in visible region to our appunits.
   nsRegion visibleRegion;
   // mVisibleRect has been clipped to GetClippedBounds
   visibleRegion.And(*aVisibleRegion, mVisibleRect);
-  visibleRegion = visibleRegion.ConvertAppUnitsRoundOut(mParentAPD, mAPD);
+  visibleRegion = visibleRegion.ScaleToOtherAppUnitsRoundOut(mParentAPD, mAPD);
   nsRegion originalVisibleRegion = visibleRegion;
 
   nsRect transformedVisibleRect =
-    mVisibleRect.ConvertAppUnitsRoundOut(mParentAPD, mAPD);
+    mVisibleRect.ScaleToOtherAppUnitsRoundOut(mParentAPD, mAPD);
   bool retval;
   // If we are to generate a scrollable layer we call
   // nsDisplaySubDocument::ComputeVisibility to make the necessary adjustments
   // for ComputeVisibility, it does all it's calculations in the child APD.
   bool usingDisplayPort = UseDisplayPortForViewport(aBuilder, mFrame);
   if (!(mFlags & GENERATE_SCROLLABLE_LAYER) || !usingDisplayPort) {
     retval =
       mList.ComputeVisibilityForSublist(aBuilder, &visibleRegion,
@@ -4932,17 +4932,17 @@ bool nsDisplayZoom::ComputeVisibility(ns
     retval =
       nsDisplaySubDocument::ComputeVisibility(aBuilder, &visibleRegion);
   }
 
   nsRegion removed;
   // removed = originalVisibleRegion - visibleRegion
   removed.Sub(originalVisibleRegion, visibleRegion);
   // Convert removed region to parent appunits.
-  removed = removed.ConvertAppUnitsRoundIn(mAPD, mParentAPD);
+  removed = removed.ScaleToOtherAppUnitsRoundIn(mAPD, mParentAPD);
   // aVisibleRegion = aVisibleRegion - removed (modulo any simplifications
   // SubtractFromVisibleRegion does)
   aBuilder->SubtractFromVisibleRegion(aVisibleRegion, removed);
 
   return retval;
 }
 
 ///////////////////////////////////////////////////
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -2061,17 +2061,17 @@ nsLayoutUtils::GetEventCoordinatesRelati
   if (widgetToView == nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE)) {
     return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
   }
 
   // Convert from root document app units to app units of the document aFrame
   // is in.
   int32_t rootAPD = rootFrame->PresContext()->AppUnitsPerDevPixel();
   int32_t localAPD = aFrame->PresContext()->AppUnitsPerDevPixel();
-  widgetToView = widgetToView.ConvertAppUnits(rootAPD, localAPD);
+  widgetToView = widgetToView.ScaleToOtherAppUnits(rootAPD, localAPD);
 
   /* If we encountered a transform, we can't do simple arithmetic to figure
    * out how to convert back to aFrame's coordinates and must use the CTM.
    */
   if (transformFound || aFrame->IsSVGText()) {
     return TransformRootPointToFrame(aFrame, widgetToView);
   }
 
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -3744,17 +3744,17 @@ PresShell::ScrollFrameRectIntoView(nsIFr
       parent = container->GetParent();
     }
     if (!parent && !(aFlags & nsIPresShell::SCROLL_NO_PARENT_FRAMES)) {
       nsPoint extraOffset(0,0);
       parent = nsLayoutUtils::GetCrossDocParentFrame(container, &extraOffset);
       if (parent) {
         int32_t APD = container->PresContext()->AppUnitsPerDevPixel();
         int32_t parentAPD = parent->PresContext()->AppUnitsPerDevPixel();
-        rect = rect.ConvertAppUnitsRoundOut(APD, parentAPD);
+        rect = rect.ScaleToOtherAppUnitsRoundOut(APD, parentAPD);
         rect += extraOffset;
       }
     }
     container = parent;
   } while (container);
 
   return didScroll;
 }
@@ -5730,17 +5730,17 @@ PresShell::ProcessSynthMouseMoveEvent(bo
     pointVM = (pointView ? pointView : view)->GetViewManager();
     refpoint = mMouseLocation + rootView->ViewToWidgetOffset();
     viewAPD = APD;
   } else {
     pointVM = view->GetViewManager();
     nsIFrame* frame = view->GetFrame();
     NS_ASSERTION(frame, "floating views can't be anonymous");
     viewAPD = frame->PresContext()->AppUnitsPerDevPixel();
-    refpoint = mMouseLocation.ConvertAppUnits(APD, viewAPD);
+    refpoint = mMouseLocation.ScaleToOtherAppUnits(APD, viewAPD);
     refpoint -= view->GetOffsetTo(rootView);
     refpoint += view->ViewToWidgetOffset();
   }
   NS_ASSERTION(view->GetWidget(), "view should have a widget here");
   WidgetMouseEvent event(true, NS_MOUSE_MOVE, view->GetWidget(),
                          WidgetMouseEvent::eSynthesized);
   event.refPoint = LayoutDeviceIntPoint::FromAppUnitsToNearest(refpoint, viewAPD);
   event.time = PR_IntervalNow();
@@ -5864,17 +5864,17 @@ PresShell::MarkImagesInSubtreeVisible(ns
     if (presShell) {
       nsRect rect = aRect;
       nsIFrame* root = presShell->GetRootFrame();
       if (root) {
         rect.MoveBy(aFrame->GetOffsetToCrossDoc(root));
       } else {
         rect.MoveBy(-aFrame->GetContentRectRelativeToSelf().TopLeft());
       }
-      rect = rect.ConvertAppUnitsRoundOut(
+      rect = rect.ScaleToOtherAppUnitsRoundOut(
         aFrame->PresContext()->AppUnitsPerDevPixel(),
         presShell->GetPresContext()->AppUnitsPerDevPixel());
 
       presShell->RebuildImageVisibility(&rect);
     }
     return;
   }
 
@@ -8634,17 +8634,17 @@ PresShell::GetCurrentItemAndPositionForE
       if (checkLineHeight) {
         nsIScrollableFrame *scrollFrame =
           nsLayoutUtils::GetNearestScrollableFrame(frame);
         if (scrollFrame) {
           nsSize scrollAmount = scrollFrame->GetLineScrollAmount();
           nsIFrame* f = do_QueryFrame(scrollFrame);
           int32_t APD = presContext->AppUnitsPerDevPixel();
           int32_t scrollAPD = f->PresContext()->AppUnitsPerDevPixel();
-          scrollAmount = scrollAmount.ConvertAppUnits(scrollAPD, APD);
+          scrollAmount = scrollAmount.ScaleToOtherAppUnits(scrollAPD, APD);
           if (extra > scrollAmount.height) {
             extra = scrollAmount.height;
           }
         }
       }
     }
 
     aTargetPt.x = presContext->AppUnitsToDevPixels(frameOrigin.x);
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4745,25 +4745,25 @@ nsIFrame::GetOffsetToCrossDoc(const nsIF
       f = parent;
     } else {
       nsPoint newOffset(0, 0);
       root = f;
       f = nsLayoutUtils::GetCrossDocParentFrame(f, &newOffset);
       int32_t newAPD = f ? f->PresContext()->AppUnitsPerDevPixel() : 0;
       if (!f || newAPD != currAPD) {
         // Convert docOffset to the right APD and add it to offset.
-        offset += docOffset.ConvertAppUnits(currAPD, aAPD);
+        offset += docOffset.ScaleToOtherAppUnits(currAPD, aAPD);
         docOffset.x = docOffset.y = 0;
       }
       currAPD = newAPD;
       docOffset += newOffset;
     }
   }
   if (f == aOther) {
-    offset += docOffset.ConvertAppUnits(currAPD, aAPD);
+    offset += docOffset.ScaleToOtherAppUnits(currAPD, aAPD);
   } else {
     // Looks like aOther wasn't an ancestor of |this|.  So now we have
     // the root-document-relative position of |this| in |offset|. Subtract the
     // root-document-relative position of |aOther| from |offset|.
     // This call won't try to recurse again because root is an ancestor of
     // aOther.
     nsPoint negOffset = aOther->GetOffsetToCrossDoc(root, aAPD);
     offset -= negOffset;
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -406,17 +406,17 @@ nsSubDocumentFrame::BuildDisplayList(nsD
   nsRect dirty;
   bool haveDisplayPort = false;
   bool ignoreViewportScrolling = false;
   nsIFrame* savedIgnoreScrollFrame = nullptr;
   if (subdocRootFrame) {
     // get the dirty rect relative to the root frame of the subdoc
     dirty = aDirtyRect + GetOffsetToCrossDoc(subdocRootFrame);
     // and convert into the appunits of the subdoc
-    dirty = dirty.ConvertAppUnitsRoundOut(parentAPD, subdocAPD);
+    dirty = dirty.ScaleToOtherAppUnitsRoundOut(parentAPD, subdocAPD);
 
     if (nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame()) {
       if (gfxPrefs::LayoutUseContainersForRootFrames()) {
         // for root content documents we want the base to be the composition bounds
         nsRect displayportBase = presContext->IsRootContentDocument() ?
             nsRect(nsPoint(0,0), nsLayoutUtils::CalculateCompositionSizeForFrame(rootScrollFrame)) :
             dirty.Intersect(nsRect(nsPoint(0,0), subdocRootFrame->GetSize()));
         nsRect displayPort;
@@ -495,17 +495,17 @@ nsSubDocumentFrame::BuildDisplayList(nsD
     if (!aBuilder->IsForEventDelivery()) {
       // If we are going to use a displayzoom below then any items we put under
       // it need to have underlying frames from the subdocument. So we need to
       // calculate the bounds based on which frame will be the underlying frame
       // for the canvas background color item.
       nsRect bounds = GetContentRectRelativeToSelf() +
         aBuilder->ToReferenceFrame(this);
       if (subdocRootFrame) {
-        bounds = bounds.ConvertAppUnitsRoundOut(parentAPD, subdocAPD);
+        bounds = bounds.ScaleToOtherAppUnitsRoundOut(parentAPD, subdocAPD);
       }
 
       // If we are in print preview/page layout we want to paint the grey
       // background behind the page, not the canvas color. The canvas color gets
       // painted on the page itself.
       if (nsLayoutUtils::NeedsPrintPreviewBackground(presContext)) {
         presShell->AddPrintPreviewBackgroundItem(
           *aBuilder, childItems, subdocRootFrame ? subdocRootFrame : this,
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -1242,18 +1242,18 @@ nsMenuPopupFrame::SetPopupPosition(nsIFr
   // Relative to the root
   parentRect = nsLayoutUtils::TransformFrameRectToAncestor(aAnchorFrame,
                                                            parentRect,
                                                            referenceFrame);
   // Relative to the screen
   parentRect.MoveBy(referenceFrame->GetScreenRectInAppUnits().TopLeft());
   // In its own app units
   parentRect =
-    parentRect.ConvertAppUnitsRoundOut(rootPresContext->AppUnitsPerDevPixel(),
-                                       presContext->AppUnitsPerDevPixel());
+    parentRect.ScaleToOtherAppUnitsRoundOut(rootPresContext->AppUnitsPerDevPixel(),
+                                            presContext->AppUnitsPerDevPixel());
 
   // Set the popup's size to the preferred size. Below, this size will be
   // adjusted to fit on the screen or within the content area. If the anchor
   // is sized to the popup, use the anchor's width instead of the preferred
   // width. The preferred size should already be set by the parent frame.
   NS_ASSERTION(mPrefSize.width >= 0 || mPrefSize.height >= 0,
                "preferred size of popup not set");
   mRect.width = aSizedToPopup ? parentRect.width : mPrefSize.width;
--- a/view/nsView.cpp
+++ b/view/nsView.cpp
@@ -814,25 +814,25 @@ nsPoint nsView::GetOffsetTo(const nsView
   nsViewManager* currVM = v->GetViewManager();
   int32_t currAPD = currVM->AppUnitsPerDevPixel();
   const nsView* root = nullptr;
   for ( ; v != aOther && v; root = v, v = v->GetParent()) {
     nsViewManager* newVM = v->GetViewManager();
     if (newVM != currVM) {
       int32_t newAPD = newVM->AppUnitsPerDevPixel();
       if (newAPD != currAPD) {
-        offset += docOffset.ConvertAppUnits(currAPD, aAPD);
+        offset += docOffset.ScaleToOtherAppUnits(currAPD, aAPD);
         docOffset.x = docOffset.y = 0;
         currAPD = newAPD;
       }
       currVM = newVM;
     }
     docOffset += v->GetPosition();
   }
-  offset += docOffset.ConvertAppUnits(currAPD, aAPD);
+  offset += docOffset.ScaleToOtherAppUnits(currAPD, aAPD);
 
   if (v != aOther) {
     // Looks like aOther wasn't an ancestor of |this|.  So now we have
     // the root-VM-relative position of |this| in |offset|.  Get the
     // root-VM-relative position of aOther and subtract it.
     nsPoint negOffset = aOther->GetOffsetTo(root, aAPD);
     offset -= negOffset;
   }
@@ -858,17 +858,17 @@ nsPoint nsView::GetOffsetToWidget(nsIWid
   // error.
   pt = -widgetView->GetOffsetTo(this);
   // Add in the offset to the widget.
   pt += widgetView->ViewToWidgetOffset();
 
   // Convert to our appunits.
   int32_t widgetAPD = widgetView->GetViewManager()->AppUnitsPerDevPixel();
   int32_t ourAPD = GetViewManager()->AppUnitsPerDevPixel();
-  pt = pt.ConvertAppUnits(widgetAPD, ourAPD);
+  pt = pt.ScaleToOtherAppUnits(widgetAPD, ourAPD);
   return pt;
 }
 
 nsIWidget* nsView::GetNearestWidget(nsPoint* aOffset) const
 {
   return GetNearestWidget(aOffset, GetViewManager()->AppUnitsPerDevPixel());
 }
 
@@ -884,37 +884,37 @@ nsIWidget* nsView::GetNearestWidget(nsPo
   const nsView* v = this;
   nsViewManager* currVM = v->GetViewManager();
   int32_t currAPD = currVM->AppUnitsPerDevPixel();
   for ( ; v && !v->HasWidget(); v = v->GetParent()) {
     nsViewManager* newVM = v->GetViewManager();
     if (newVM != currVM) {
       int32_t newAPD = newVM->AppUnitsPerDevPixel();
       if (newAPD != currAPD) {
-        pt += docPt.ConvertAppUnits(currAPD, aAPD);
+        pt += docPt.ScaleToOtherAppUnits(currAPD, aAPD);
         docPt.x = docPt.y = 0;
         currAPD = newAPD;
       }
       currVM = newVM;
     }
     docPt += v->GetPosition();
   }
   if (!v) {
     if (aOffset) {
-      pt += docPt.ConvertAppUnits(currAPD, aAPD);
+      pt += docPt.ScaleToOtherAppUnits(currAPD, aAPD);
       *aOffset = pt;
     }
     return nullptr;
   }
 
   // pt is now the offset from v's origin to this view's origin.
   // We add the ViewToWidgetOffset to get the offset to the widget.
   if (aOffset) {
     docPt += v->ViewToWidgetOffset();
-    pt += docPt.ConvertAppUnits(currAPD, aAPD);
+    pt += docPt.ScaleToOtherAppUnits(currAPD, aAPD);
     *aOffset = pt;
   }
   return v->GetWidget();
 }
 
 bool nsView::IsRoot() const
 {
   NS_ASSERTION(mViewManager != nullptr," View manager is null in nsView::IsRoot()");
@@ -926,26 +926,27 @@ nsView::GetBoundsInParentUnits() const
 {
   nsView* parent = GetParent();
   nsViewManager* VM = GetViewManager();
   if (this != VM->GetRootView() || !parent) {
     return mDimBounds;
   }
   int32_t ourAPD = VM->AppUnitsPerDevPixel();
   int32_t parentAPD = parent->GetViewManager()->AppUnitsPerDevPixel();
-  return mDimBounds.ConvertAppUnitsRoundOut(ourAPD, parentAPD);
+  return mDimBounds.ScaleToOtherAppUnitsRoundOut(ourAPD, parentAPD);
 }
 
 nsPoint
 nsView::ConvertFromParentCoords(nsPoint aPt) const
 {
   const nsView* parent = GetParent();
   if (parent) {
-    aPt = aPt.ConvertAppUnits(parent->GetViewManager()->AppUnitsPerDevPixel(),
-                              GetViewManager()->AppUnitsPerDevPixel());
+    aPt = aPt.ScaleToOtherAppUnits(
+      parent->GetViewManager()->AppUnitsPerDevPixel(),
+      GetViewManager()->AppUnitsPerDevPixel());
   }
   aPt -= GetPosition();
   return aPt;
 }
 
 static bool
 IsPopupWidget(nsIWidget* aWidget)
 {
--- a/view/nsViewManager.cpp
+++ b/view/nsViewManager.cpp
@@ -238,17 +238,17 @@ nsViewManager::FlushDelayedResize(bool a
 // Convert aIn from being relative to and in appunits of aFromView, to being
 // relative to and in appunits of aToView.
 static nsRegion ConvertRegionBetweenViews(const nsRegion& aIn,
                                           nsView* aFromView,
                                           nsView* aToView)
 {
   nsRegion out = aIn;
   out.MoveBy(aFromView->GetOffsetTo(aToView));
-  out = out.ConvertAppUnitsRoundOut(
+  out = out.ScaleToOtherAppUnitsRoundOut(
     aFromView->GetViewManager()->AppUnitsPerDevPixel(),
     aToView->GetViewManager()->AppUnitsPerDevPixel());
   return out;
 }
 
 nsView* nsViewManager::GetDisplayRootFor(nsView* aView)
 {
   nsView *displayRoot = aView;
@@ -635,17 +635,17 @@ nsViewManager::InvalidateViewNoSuppressi
   nsView* displayRoot = GetDisplayRootFor(aView);
   nsViewManager* displayRootVM = displayRoot->GetViewManager();
   // Propagate the update to the displayRoot, since iframes, for example,
   // can overlap each other and be translucent.  So we have to possibly
   // invalidate our rect in each of the widgets we have lying about.
   damagedRect.MoveBy(aView->GetOffsetTo(displayRoot));
   int32_t rootAPD = displayRootVM->AppUnitsPerDevPixel();
   int32_t APD = AppUnitsPerDevPixel();
-  damagedRect = damagedRect.ConvertAppUnitsRoundOut(APD, rootAPD);
+  damagedRect = damagedRect.ScaleToOtherAppUnitsRoundOut(APD, rootAPD);
 
   // accumulate this rectangle in the view's dirty region, so we can
   // process it later.
   AddDirtyRegion(displayRoot, nsRegion(damagedRect));
 }
 
 void
 nsViewManager::InvalidateAllViews()