Bug 1482665 Part 4 - Remove nsDeviceContext::AppUnitsPerCSSPixel() and replace it with mozilla::AppUnitsPerCSSPixel(). r=dholbert
authorTing-Yu Lin <tlin@mozilla.com>
Sat, 11 Aug 2018 15:17:50 -0700
changeset 486425 ed67e5b2479a9d37ccfeeb5d215acb89e37c3c45
parent 486424 67c05f411b4867ed39c83a70226b527fadd9d3b0
child 486426 0bbf7aa0ab2e54adcd0f2234e77a4603b6c4dd2b
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1482665
milestone63.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 1482665 Part 4 - Remove nsDeviceContext::AppUnitsPerCSSPixel() and replace it with mozilla::AppUnitsPerCSSPixel(). r=dholbert Differential Revision: https://phabricator.services.mozilla.com/D3157
gfx/layers/AnimationHelper.cpp
gfx/src/nsDeviceContext.h
gfx/src/nsFontMetrics.cpp
gfx/src/nsRect.cpp
gfx/thebes/gfxFontMissingGlyphs.cpp
layout/base/nsLayoutUtils.cpp
--- a/gfx/layers/AnimationHelper.cpp
+++ b/gfx/layers/AnimationHelper.cpp
@@ -67,17 +67,17 @@ CompositorAnimationStorage::GetOMTAValue
       // Undo the rebasing applied by
       // nsDisplayTransform::GetResultingTransformMatrixInternal
       transform.ChangeBasis(-transformOrigin);
 
       // 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());
+        double(scale) / double(AppUnitsPerCSSPixel());
       transform._41 *= devPerCss;
       transform._42 *= devPerCss;
       transform._43 *= devPerCss;
       omtaValue = transform;
       break;
     }
     case AnimatedValue::NONE:
       break;
--- a/gfx/src/nsDeviceContext.h
+++ b/gfx/src/nsDeviceContext.h
@@ -77,22 +77,16 @@ public:
      * Create a reference rendering context and initialize it.  Only call this
      * method on device contexts that were initialized for printing.
      *
      * @return the new rendering context.
      */
     already_AddRefed<gfxContext> CreateReferenceRenderingContext();
 
     /**
-     * Gets the number of app units in one CSS pixel; this number is global,
-     * not unique to each device context.
-     */
-    static int32_t AppUnitsPerCSSPixel() { return mozilla::AppUnitsPerCSSPixel(); }
-
-    /**
      * Gets the number of app units in one device pixel; this number
      * is usually a factor of AppUnitsPerCSSPixel(), although that is
      * not guaranteed.
      */
     int32_t AppUnitsPerDevPixel() const { return mAppUnitsPerDevPixel; }
 
     /**
      * Convert device pixels which is used for gfx/thebes to nearest
--- a/gfx/src/nsFontMetrics.cpp
+++ b/gfx/src/nsFontMetrics.cpp
@@ -133,17 +133,17 @@ nsFontMetrics::nsFontMetrics(const nsFon
                        aFont.synthesis & NS_FONT_SYNTHESIS_WEIGHT,
                        aFont.synthesis & NS_FONT_SYNTHESIS_STYLE,
                        aFont.languageOverride);
 
     aFont.AddFontFeaturesToStyle(&style, mOrientation == gfxFont::eVertical);
     aFont.AddFontVariationsToStyle(&style);
 
     gfxFloat devToCssSize = gfxFloat(mP2A) /
-        gfxFloat(nsDeviceContext::AppUnitsPerCSSPixel());
+        gfxFloat(AppUnitsPerCSSPixel());
     mFontGroup = gfxPlatform::GetPlatform()->
         CreateFontGroup(aFont.fontlist, &style, aParams.textPerf,
                         aParams.userFontSet, devToCssSize);
 }
 
 nsFontMetrics::~nsFontMetrics()
 {
     // Should not be dropped by stylo
--- a/gfx/src/nsRect.cpp
+++ b/gfx/src/nsRect.cpp
@@ -40,24 +40,24 @@ bool nsRect::Overflows() const {
 
 FILE* operator<<(FILE* out, const nsRect& rect)
 {
   nsAutoString tmp;
 
   // Output the coordinates in fractional pixels so they're easier to read
   tmp.Append('{');
   tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.X(),
-                       nsDeviceContext::AppUnitsPerCSSPixel()));
+                       AppUnitsPerCSSPixel()));
   tmp.AppendLiteral(", ");
   tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.Y(),
-                       nsDeviceContext::AppUnitsPerCSSPixel()));
+                       AppUnitsPerCSSPixel()));
   tmp.AppendLiteral(", ");
   tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.Width(),
-                       nsDeviceContext::AppUnitsPerCSSPixel()));
+                       AppUnitsPerCSSPixel()));
   tmp.AppendLiteral(", ");
   tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.Height(),
-                       nsDeviceContext::AppUnitsPerCSSPixel()));
+                       AppUnitsPerCSSPixel()));
   tmp.Append('}');
   fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
   return out;
 }
 
 #endif // DEBUG
--- a/gfx/thebes/gfxFontMissingGlyphs.cpp
+++ b/gfx/thebes/gfxFontMissingGlyphs.cpp
@@ -254,17 +254,17 @@ gfxFontMissingGlyphs::DrawMissingGlyph(u
 
 #ifndef MOZ_GFX_OPTIMIZE_MOBILE
     Point center = rect.Center();
     Float halfGap = HEX_CHAR_GAP / 2.f;
     Float top = -(MINIFONT_HEIGHT + halfGap);
     // We always want integer scaling, otherwise the "bitmap" glyphs will look
     // even uglier than usual when zoomed
     int32_t devPixelsPerCSSPx =
-        std::max<int32_t>(1, nsDeviceContext::AppUnitsPerCSSPixel() /
+        std::max<int32_t>(1, AppUnitsPerCSSPixel() /
                              aAppUnitsPerDevPixel);
 
     Matrix tempMat;
     if (aMat) {
         // If there is an orientation transform, since draw target transforms may
         // not be supported, scale and translate it so that it can be directly used
         // for rendering the mini font without changing the draw target transform.
         tempMat = Matrix(*aMat).PostScale(devPixelsPerCSSPx, devPixelsPerCSSPx)
@@ -332,11 +332,11 @@ gfxFontMissingGlyphs::GetDesiredMinWidth
  * like this so you can see what goes where.
  */
     Float width = BOX_HORIZONTAL_INSET + BOX_BORDER_WIDTH + HEX_CHAR_GAP +
         MINIFONT_WIDTH + HEX_CHAR_GAP + MINIFONT_WIDTH +
          ((aChar < 0x10000) ? 0 : HEX_CHAR_GAP + MINIFONT_WIDTH) +
         HEX_CHAR_GAP + BOX_BORDER_WIDTH + BOX_HORIZONTAL_INSET;
     // Note that this will give us floating-point division, so the width will
     // -not- be snapped to integer multiples of its basic pixel value
-    width *= Float(nsDeviceContext::AppUnitsPerCSSPixel()) / aAppUnitsPerDevPixel;
+    width *= Float(AppUnitsPerCSSPixel()) / aAppUnitsPerDevPixel;
     return width;
 }
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -6882,17 +6882,17 @@ nsLayoutUtils::DrawSingleImage(gfxContex
                                const SamplingFilter   aSamplingFilter,
                                const nsRect&          aDest,
                                const nsRect&          aDirty,
                                const Maybe<SVGImageContext>& aSVGContext,
                                uint32_t               aImageFlags,
                                const nsPoint*         aAnchorPoint,
                                const nsRect*          aSourceArea)
 {
-  nscoord appUnitsPerCSSPixel = nsDeviceContext::AppUnitsPerCSSPixel();
+  nscoord appUnitsPerCSSPixel = AppUnitsPerCSSPixel();
   CSSIntSize pixelImageSize(ComputeSizeForDrawingWithFallback(aImage, aDest.Size()));
   if (pixelImageSize.width < 1 || pixelImageSize.height < 1) {
     NS_ASSERTION(pixelImageSize.width >= 0 && pixelImageSize.height >= 0,
                  "Image width or height is negative");
     return ImgDrawResult::SUCCESS;  // no point in drawing a zero size image
   }
 
   nsSize imageSize(CSSPixel::ToAppUnits(pixelImageSize));