зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1703118 - Remove unneeded caching / parent-process checks in android lookandfeel. r=agi,geckoview-reviewers
After bug 1697607 and the subsequent pref removal this code only runs in the parent process. After bug 1699088 the caller takes care of caching. So there should be no need to cache stuff ourselves. Differential Revision: https://phabricator.services.mozilla.com/D110871
This commit is contained in:
Родитель
7a2c22ce65
Коммит
606ab54d5c
|
@ -77,8 +77,6 @@ void nsLookAndFeel::RefreshImpl() {
|
||||||
|
|
||||||
mInitializedSystemColors = false;
|
mInitializedSystemColors = false;
|
||||||
mInitializedShowPassword = false;
|
mInitializedShowPassword = false;
|
||||||
mPrefersReducedMotionCached = false;
|
|
||||||
mSystemUsesDarkThemeCached = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme,
|
nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme,
|
||||||
|
@ -380,12 +378,7 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IntID::PrefersReducedMotion:
|
case IntID::PrefersReducedMotion:
|
||||||
if (!mPrefersReducedMotionCached && XRE_IsParentProcess()) {
|
aResult = java::GeckoSystemStateListener::PrefersReducedMotion();
|
||||||
mPrefersReducedMotion =
|
|
||||||
java::GeckoSystemStateListener::PrefersReducedMotion();
|
|
||||||
mPrefersReducedMotionCached = true;
|
|
||||||
}
|
|
||||||
aResult = mPrefersReducedMotion;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IntID::PrimaryPointerCapabilities:
|
case IntID::PrimaryPointerCapabilities:
|
||||||
|
@ -396,19 +389,8 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IntID::SystemUsesDarkTheme: {
|
case IntID::SystemUsesDarkTheme: {
|
||||||
if (!mSystemUsesDarkThemeCached && XRE_IsParentProcess()) {
|
java::GeckoRuntime::LocalRef runtime = java::GeckoRuntime::GetInstance();
|
||||||
// Bail out if AndroidBridge hasn't initialized.
|
aResult = runtime && runtime->UsesDarkTheme();
|
||||||
if (!jni::IsAvailable()) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
java::GeckoRuntime::LocalRef runtime =
|
|
||||||
java::GeckoRuntime::GetInstance();
|
|
||||||
mSystemUsesDarkTheme = runtime && runtime->UsesDarkTheme();
|
|
||||||
mSystemUsesDarkThemeCached = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
aResult = mSystemUsesDarkTheme;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,12 +30,6 @@ class nsLookAndFeel final : public nsXPLookAndFeel {
|
||||||
bool mInitializedShowPassword = false;
|
bool mInitializedShowPassword = false;
|
||||||
bool mShowPassword = false;
|
bool mShowPassword = false;
|
||||||
|
|
||||||
bool mSystemUsesDarkTheme = false;
|
|
||||||
bool mSystemUsesDarkThemeCached = false;
|
|
||||||
|
|
||||||
bool mPrefersReducedMotion = false;
|
|
||||||
bool mPrefersReducedMotionCached = false;
|
|
||||||
|
|
||||||
nsresult GetSystemColors();
|
nsresult GetSystemColors();
|
||||||
|
|
||||||
void EnsureInitSystemColors();
|
void EnsureInitSystemColors();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче