Bug 1356023 - Remove nsIScreenManager.systemDefaultScale. r=jfkthame

MozReview-Commit-ID: 6Ha8XrJBSiU

--HG--
extra : rebase_source : a83a64acf01dc9d1a0593c0ddbff76f74809a79b
This commit is contained in:
Masatoshi Kimura 2017-04-13 07:20:35 +09:00
Родитель b4261cfb61
Коммит 7e1158fd16
14 изменённых файлов: 7 добавлений и 107 удалений

Просмотреть файл

@ -61,26 +61,14 @@ this.PageThumbUtils = {
let left = {}, top = {}, screenWidth = {}, screenHeight = {};
screenManager.primaryScreen.GetRectDisplayPix(left, top, screenWidth, screenHeight);
/** *
* The system default scale might be different than
* what is reported by the window. For example,
* retina displays have 1:1 system scales, but 2:1 window
* scale as 1 pixel system wide == 2 device pixels.
/**
* The primary monitor default scale might be different than
* what is reported by the window on mixed-DPI systems.
* To get the best image quality, query both and take the highest one.
*/
let systemScale = screenManager.systemDefaultScale;
let windowScale = aWindow ? aWindow.devicePixelRatio : systemScale;
let scale = Math.max(systemScale, windowScale);
/** *
* On retina displays, we can sometimes go down this path
* without a window object. In those cases, force 2x scaling
* as the system scale doesn't represent the 2x scaling
* on OS X.
*/
if (AppConstants.platform == "macosx" && !aWindow) {
scale = 2;
}
let primaryScale = screenManager.primaryScreen.defaultCSSScaleFactor;
let windowScale = aWindow ? aWindow.devicePixelRatio : primaryScale;
let scale = Math.max(primaryScale, windowScale);
/** *
* THESE VALUES ARE DEFINED IN newtab.css and hard coded.

Просмотреть файл

@ -1429,13 +1429,6 @@ PuppetScreenManager::ScreenForRect(int32_t inLeft,
return GetPrimaryScreen(outScreen);
}
NS_IMETHODIMP
PuppetScreenManager::GetSystemDefaultScale(float *aDefaultScale)
{
*aDefaultScale = 1.0f;
return NS_OK;
}
nsIWidgetListener*
PuppetWidget::GetCurrentWidgetListener()
{

Просмотреть файл

@ -188,16 +188,5 @@ ScreenManager::GetPrimaryScreen(nsIScreen** aPrimaryScreen)
return NS_OK;
}
NS_IMETHODIMP
ScreenManager::GetSystemDefaultScale(float* aDefaultScale)
{
if (mHelper) {
*aDefaultScale = mHelper->GetSystemDefaultScale();
return NS_OK;
}
*aDefaultScale = 1;
return NS_OK;
}
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -30,8 +30,7 @@ public:
class Helper
{
public:
virtual float GetSystemDefaultScale() = 0;
virtual ~Helper() {};
virtual ~Helper() {}
};
public:

Просмотреть файл

@ -203,13 +203,6 @@ nsScreenManagerAndroid::ScreenForRect(int32_t inLeft,
return GetPrimaryScreen(outScreen);
}
NS_IMETHODIMP
nsScreenManagerAndroid::GetSystemDefaultScale(float *aDefaultScale)
{
*aDefaultScale = 1.0f;
return NS_OK;
}
already_AddRefed<nsScreenAndroid>
nsScreenManagerAndroid::AddScreen(DisplayType aDisplayType, nsIntRect aRect)
{

Просмотреть файл

@ -21,8 +21,6 @@ public:
ScreenHelperCocoa();
~ScreenHelperCocoa() override;
float GetSystemDefaultScale() override;
void RefreshScreens();
static NSScreen* CocoaScreenForScreen(nsIScreen* aScreen);

Просмотреть файл

@ -107,12 +107,6 @@ MakeScreen(NSScreen* aScreen)
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(nullptr);
}
float
ScreenHelperCocoa::GetSystemDefaultScale()
{
return 1.0f;
}
void
ScreenHelperCocoa::RefreshScreens()
{

Просмотреть файл

@ -831,13 +831,6 @@ nsScreenManagerGonk::ScreenForRect(int32_t inLeft,
return GetPrimaryScreen(outScreen);
}
NS_IMETHODIMP
nsScreenManagerGonk::GetSystemDefaultScale(float *aDefaultScale)
{
*aDefaultScale = 1.0f;
return NS_OK;
}
void
nsScreenManagerGonk::VsyncControl(bool aEnabled)
{

Просмотреть файл

@ -148,16 +148,6 @@ GetDefaultCssScale()
return ScreenHelperGTK::GetGTKMonitorScaleFactor() * gfxPlatformGtk::GetDPIScale();
}
float
ScreenHelperGTK::GetSystemDefaultScale()
{
double scale = nsIWidget::DefaultScaleOverride();
if (scale <= 0.0) {
scale = GetDefaultCssScale();
}
return scale;
}
static uint32_t
GetGTKPixelDepth()
{

Просмотреть файл

@ -24,8 +24,6 @@ public:
ScreenHelperGTK();
~ScreenHelperGTK() override;
float GetSystemDefaultScale() override;
static gint GetGTKMonitorScaleFactor();
#ifdef MOZ_X11

Просмотреть файл

@ -21,24 +21,4 @@ interface nsIScreenManager : nsISupports
// The screen with the menubar/taskbar. This shouldn't be needed very
// often.
readonly attribute nsIScreen primaryScreen;
// The default DPI scaling factor of the screen environment (number of
// screen pixels corresponding to 1 CSS px, at the default zoom level).
//
// This is currently fixed at 1.0 on most platforms, but varies on Windows
// if the "logical DPI" scaling option in the Display control panel is set
// to a value other than 100% (e.g. 125% or 150% are increasingly common
// defaults on laptops with high-dpi screens). See bug 851520.
//
// NOTE that on OS X, this does -not- reflect the "backing scale factor"
// used to support Retina displays, which is a per-display property,
// not a system-wide scaling factor. The default ratio of CSS pixels to
// Cocoa points remains 1:1, even on a Retina screen where one Cocoa point
// corresponds to two device pixels. (This is exposed via other APIs:
// see window.devicePixelRatio).
//
// NOTE also that on Linux, this does -not- currently reflect changes
// to the system-wide (X11 or Gtk2) DPI value, as Firefox does not yet
// honor these settings. See bug 798362 and bug 712898.
readonly attribute float systemDefaultScale;
};

Просмотреть файл

@ -116,10 +116,3 @@ UIKitScreenManager::ScreenForRect(int32_t inLeft,
{
return GetPrimaryScreen(outScreen);
}
NS_IMETHODIMP
UIKitScreenManager::GetSystemDefaultScale(float* aScale)
{
*aScale = [UIScreen mainScreen].scale;
return NS_OK;
}

Просмотреть файл

@ -67,13 +67,6 @@ CollectMonitors(HMONITOR aMon, HDC, LPRECT, LPARAM ioParam)
return TRUE;
}
float
ScreenHelperWin::GetSystemDefaultScale()
{
HMONITOR primary = widget::WinUtils::GetPrimaryMonitor();
return float(widget::WinUtils::LogToPhysFactor(primary));
}
void
ScreenHelperWin::RefreshScreens()
{

Просмотреть файл

@ -17,7 +17,6 @@ class ScreenHelperWin final : public ScreenManager::Helper
public:
ScreenHelperWin() {};
~ScreenHelperWin() override {}
float GetSystemDefaultScale() override;
static void RefreshScreens();
};