forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1665459 - Control pre-xul skele UI registry value via prefs r=mho…
…well This patch uses the prefs relevant to the pre-xul skeleton UI to control the registry value. There are three prefs: - A new pref intended to be the global toggle once all themes can be handled. - browser.startup.blankWindow - we currently depend on the code in BrowserGlue.jsm, gated on this pref, which immediately specifies the width and height of the window and ultimately causes XUL to consume and take ownership of our pre-xul window. Without this, we resize to fit a small content area, and then resize again back to the correct size. - extensions.activeThemeID - Given that we have hardcoded layout and colors, we need to ensure that we're only presenting the skeleton UI for the default theme. We're hoping to not need to gate on any prefs other than the new pref that we're adding, but this allows us to provide a simple direction for users who may want to dogfood our changes in the mean time: use the default theme, ensure the browser.startup.blankWindow pref is set, and turn our new pref on. Differential Revision: https://phabricator.services.mozilla.com/D90884
- Loading branch information
1 parent
00727cc
commit 7aced27
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,7 @@ | |
# include <intrin.h> | ||
# include <math.h> | ||
# include "cairo/cairo-features.h" | ||
# include "mozilla/EarlyBlankWindow.h" | ||
# include "mozilla/DllPrefetchExperimentRegistryInfo.h" | ||
# include "mozilla/WindowsDllBlocklist.h" | ||
# include "mozilla/WindowsProcessMitigations.h" | ||
|
@@ -268,6 +269,13 @@ static const char kPrefSecurityContentSignatureRootHash[] = | |
"security.content.signature.root_hash"; | ||
#endif // defined(MOZ_DEFAULT_BROWSER_AGENT) | ||
|
||
#if defined(XP_WIN) | ||
static const char kPrefThemeId[] = "extensions.activeThemeID"; | ||
static const char kPrefBrowserStartupBlankWindow[] = | ||
"browser.startup.blankWindow"; | ||
static const char kPrefPreXulSkeletonUI[] = "browser.startup.preXulSkeletonUI"; | ||
#endif // defined(XP_WIN) | ||
|
||
int gArgc; | ||
char** gArgv; | ||
|
||
|
@@ -1591,6 +1599,33 @@ static void SetupAlteredPrefetchPref() { | |
PREF_WIN_ALTERED_DLL_PREFETCH); | ||
} | ||
|
||
static void ReflectSkeletonUIPrefToRegistry(const char* aPref, void* aData) { | ||
Unused << aPref; | ||
Unused << aData; | ||
|
||
bool shouldBeEnabled = | ||
Preferences::GetBool(kPrefPreXulSkeletonUI, false) && | ||
Preferences::GetBool(kPrefBrowserStartupBlankWindow, false); | ||
if (shouldBeEnabled && Preferences::HasUserValue(kPrefThemeId)) { | ||
nsCString themeId; | ||
Preferences::GetCString(kPrefThemeId, themeId); | ||
shouldBeEnabled = themeId.EqualsLiteral("[email protected]"); | ||
} | ||
|
||
if (GetEarlyBlankWindowEnabled() != shouldBeEnabled) { | ||
SetEarlyBlankWindowEnabled(shouldBeEnabled); | ||
} | ||
} | ||
|
||
static void SetupSkeletonUIPrefs() { | ||
ReflectSkeletonUIPrefToRegistry(nullptr, nullptr); | ||
Preferences::RegisterCallback(&ReflectSkeletonUIPrefToRegistry, | ||
kPrefPreXulSkeletonUI); | ||
Preferences::RegisterCallback(&ReflectSkeletonUIPrefToRegistry, | ||
kPrefBrowserStartupBlankWindow); | ||
Preferences::RegisterCallback(&ReflectSkeletonUIPrefToRegistry, kPrefThemeId); | ||
} | ||
|
||
# if defined(MOZ_LAUNCHER_PROCESS) | ||
|
||
static void OnLauncherPrefChanged(const char* aPref, void* aData) { | ||
|
@@ -4625,6 +4660,7 @@ nsresult XREMain::XRE_mainRun() { | |
Preferences::RegisterCallbackAndCall(RegisterApplicationRestartChanged, | ||
PREF_WIN_REGISTER_APPLICATION_RESTART); | ||
SetupAlteredPrefetchPref(); | ||
SetupSkeletonUIPrefs(); | ||
# if defined(MOZ_LAUNCHER_PROCESS) | ||
SetupLauncherProcessPref(); | ||
# endif // defined(MOZ_LAUNCHER_PROCESS) | ||
|