зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1288760 patch 2.3 - Support GetContentsScaleFactor and GetDefaultCSSScaleFactor in ScreenProxy. r=emk
This commit is contained in:
Родитель
9192d29ccd
Коммит
128f84ebd8
|
@ -23,6 +23,7 @@ struct ScreenDetails {
|
|||
int32_t pixelDepth;
|
||||
int32_t colorDepth;
|
||||
double contentsScaleFactor;
|
||||
double defaultCSSScaleFactor;
|
||||
};
|
||||
|
||||
prio(normal upto high) sync protocol PScreenManager
|
||||
|
|
|
@ -216,6 +216,11 @@ ScreenManagerParent::ExtractScreenDetails(nsIScreen* aScreen, ScreenDetails &aDe
|
|||
NS_ENSURE_SUCCESS(rv, false);
|
||||
aDetails.contentsScaleFactor() = contentsScaleFactor;
|
||||
|
||||
double defaultCSSScaleFactor = 1.0;
|
||||
rv = aScreen->GetDefaultCSSScaleFactor(&defaultCSSScaleFactor);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
aDetails.defaultCSSScaleFactor() = defaultCSSScaleFactor;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
|||
|
||||
ScreenProxy::ScreenProxy(nsScreenManagerProxy* aScreenManager, ScreenDetails aDetails)
|
||||
: mContentsScaleFactor(0)
|
||||
, mDefaultCSSScaleFactor(0)
|
||||
, mScreenManager(aScreenManager)
|
||||
, mId(0)
|
||||
, mPixelDepth(0)
|
||||
|
@ -128,6 +129,28 @@ ScreenProxy::GetColorDepth(int32_t *aColorDepth)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ScreenProxy::GetContentsScaleFactor(double* aContentsScaleFactor)
|
||||
{
|
||||
if (!EnsureCacheIsValid()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aContentsScaleFactor = mContentsScaleFactor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ScreenProxy::GetDefaultCSSScaleFactor(double* aScaleFactor)
|
||||
{
|
||||
if (!EnsureCacheIsValid()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aScaleFactor = mDefaultCSSScaleFactor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ScreenProxy::PopulateByDetails(ScreenDetails aDetails)
|
||||
{
|
||||
|
@ -139,6 +162,7 @@ ScreenProxy::PopulateByDetails(ScreenDetails aDetails)
|
|||
mPixelDepth = aDetails.pixelDepth();
|
||||
mColorDepth = aDetails.colorDepth();
|
||||
mContentsScaleFactor = aDetails.contentsScaleFactor();
|
||||
mDefaultCSSScaleFactor = aDetails.defaultCSSScaleFactor();
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -44,6 +44,9 @@ public:
|
|||
NS_IMETHOD GetPixelDepth(int32_t* aPixelDepth) override;
|
||||
NS_IMETHOD GetColorDepth(int32_t* aColorDepth) override;
|
||||
|
||||
NS_IMETHOD GetContentsScaleFactor(double* aContentsScaleFactor) override;
|
||||
NS_IMETHOD GetDefaultCSSScaleFactor(double* aScaleFactor) override;
|
||||
|
||||
private:
|
||||
|
||||
void PopulateByDetails(mozilla::dom::ScreenDetails aDetails);
|
||||
|
@ -52,6 +55,7 @@ private:
|
|||
void InvalidateCache();
|
||||
|
||||
double mContentsScaleFactor;
|
||||
double mDefaultCSSScaleFactor;
|
||||
RefPtr<nsScreenManagerProxy> mScreenManager;
|
||||
uint32_t mId;
|
||||
int32_t mPixelDepth;
|
||||
|
|
Загрузка…
Ссылка в новой задаче