зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1579982 - Handle dark theme in profiler popup r=julienw
Differential Revision: https://phabricator.services.mozilla.com/D52235 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b4e7e3b82b
Коммит
cdfcf7765d
|
@ -66,6 +66,20 @@ const {
|
|||
ActorReadyGeckoProfilerInterface,
|
||||
} = require("devtools/server/performance-new/gecko-profiler-interface");
|
||||
|
||||
const { LightweightThemeManager } = ChromeUtils.import(
|
||||
"resource://gre/modules/LightweightThemeManager.jsm"
|
||||
);
|
||||
|
||||
/* Force one of our two themes depending on what theme the browser is
|
||||
* currently using. This might be different from the selected theme in
|
||||
* the devtools panel. By forcing a theme here, we're unaffected by
|
||||
* the devtools setting when we show the popup.
|
||||
*/
|
||||
document.documentElement.setAttribute(
|
||||
"force-theme",
|
||||
isCurrentThemeDark() ? "dark" : "light"
|
||||
);
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
gInit();
|
||||
});
|
||||
|
@ -116,3 +130,16 @@ function resizeWindow() {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the current (non-devtools) theme is the built in
|
||||
* dark theme.
|
||||
*/
|
||||
function isCurrentThemeDark() {
|
||||
const DARK_THEME_ID = "firefox-compact-dark@mozilla.org";
|
||||
return (
|
||||
LightweightThemeManager.themeData &&
|
||||
LightweightThemeManager.themeData.theme &&
|
||||
LightweightThemeManager.themeData.theme.id === DARK_THEME_ID
|
||||
);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче