Bug 1356104 - (Part 1) The implementation inn Gecko of the FFI function `Gecko_GetAppUnitsPerPhysicalInch`. r=xidorn
authorKuoE0 <kuoe0.tw@gmail.com>
Tue, 25 Apr 2017 16:29:46 +0800
changeset 356046 da7e654620e61fa405c11ff49977cef93d2cb23d
parent 356045 fbc54f707dc421f8132340e45fa2719dbdc9621b
child 356047 0aaaa82e6013ba6af6ee15a5c036f01e8bdaddb9
push id89829
push userkwierso@gmail.com
push dateWed, 03 May 2017 00:40:08 +0000
treeherdermozilla-inbound@1325e2a34dfc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1356104
milestone55.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 1356104 - (Part 1) The implementation inn Gecko of the FFI function `Gecko_GetAppUnitsPerPhysicalInch`. r=xidorn MozReview-Commit-ID: IVmmpQIw0JG
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -1842,16 +1842,23 @@ Gecko_GetFontMetrics(RawGeckoPresContext
                                                        aUseUserFontSet);
   ret.mXSize = fm->XHeight();
   gfxFloat zeroWidth = fm->GetThebesFontGroup()->GetFirstValidFont()->
                            GetMetrics(fm->Orientation()).zeroOrAveCharWidth;
   ret.mChSize = ceil(aPresContext->AppUnitsPerDevPixel() * zeroWidth);
   return ret;
 }
 
+int32_t
+Gecko_GetAppUnitsPerPhysicalInch(RawGeckoPresContextBorrowed aPresContext)
+{
+  nsPresContext* presContext = const_cast<nsPresContext*>(aPresContext);
+  return presContext->DeviceContext()->AppUnitsPerPhysicalInch();
+}
+
 void
 Gecko_LoadStyleSheet(css::Loader* aLoader,
                      ServoStyleSheet* aParent,
                      RawServoStyleSheetBorrowed aChildSheet,
                      RawGeckoURLExtraData* aBaseURLData,
                      const uint8_t* aURLString,
                      uint32_t aURLStringLength,
                      RawServoMediaListStrong aMediaList)
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -437,16 +437,17 @@ struct GeckoFontMetrics
   nscoord mXSize;
 };
 
 GeckoFontMetrics Gecko_GetFontMetrics(RawGeckoPresContextBorrowed pres_context,
                                       bool is_vertical,
                                       const nsStyleFont* font,
                                       nscoord font_size,
                                       bool use_user_font_set);
+int32_t Gecko_GetAppUnitsPerPhysicalInch(RawGeckoPresContextBorrowed pres_context);
 void InitializeServo();
 void ShutdownServo();
 
 const nsMediaFeature* Gecko_GetMediaFeatures();
 nsCSSKeyword Gecko_LookupCSSKeyword(const uint8_t* string, uint32_t len);
 const char* Gecko_CSSKeywordString(nsCSSKeyword keyword, uint32_t* len);
 
 // Font face rule