зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1540387 - Replace browser-compacttheme.js with theme experiments. r=dao
Differential Revision: https://phabricator.services.mozilla.com/D25536 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4b40cf8785
Коммит
5429683dc7
|
@ -1,70 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this, "LightweightThemeManager",
|
||||
"resource://gre/modules/LightweightThemeManager.jsm");
|
||||
|
||||
/**
|
||||
* Enables compacttheme.css when needed.
|
||||
*/
|
||||
var CompactTheme = {
|
||||
get styleSheet() {
|
||||
delete this.styleSheet;
|
||||
for (let styleSheet of document.styleSheets) {
|
||||
if (styleSheet.href == "chrome://browser/skin/compacttheme.css") {
|
||||
this.styleSheet = styleSheet;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return this.styleSheet;
|
||||
},
|
||||
|
||||
get isStyleSheetEnabled() {
|
||||
return this.styleSheet && !this.styleSheet.disabled;
|
||||
},
|
||||
|
||||
isCompactTheme(theme) {
|
||||
return theme && (theme.id == "firefox-compact-dark@mozilla.org" ||
|
||||
theme.id == "firefox-compact-light@mozilla.org");
|
||||
},
|
||||
|
||||
get isThemeCurrentlyApplied() {
|
||||
return this.isCompactTheme(LightweightThemeManager.currentThemeWithFallback);
|
||||
},
|
||||
|
||||
init() {
|
||||
Services.obs.addObserver(this, "lightweight-theme-styling-update");
|
||||
|
||||
if (this.isThemeCurrentlyApplied) {
|
||||
this._toggleStyleSheet(true);
|
||||
}
|
||||
},
|
||||
|
||||
observe(subject, topic, data) {
|
||||
if (topic == "lightweight-theme-styling-update") {
|
||||
if (this.isCompactTheme(subject.wrappedJSObject.theme)) {
|
||||
// We are using the theme ID on this object instead of always referencing
|
||||
// LightweightThemeManager.currentTheme in case this is a preview
|
||||
this._toggleStyleSheet(true);
|
||||
} else {
|
||||
this._toggleStyleSheet(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_toggleStyleSheet(enabled) {
|
||||
let wasEnabled = this.isStyleSheetEnabled;
|
||||
if (enabled) {
|
||||
this.styleSheet.disabled = false;
|
||||
} else if (!enabled && wasEnabled) {
|
||||
this.styleSheet.disabled = true;
|
||||
}
|
||||
},
|
||||
|
||||
uninit() {
|
||||
Services.obs.removeObserver(this, "lightweight-theme-styling-update");
|
||||
this.styleSheet = null;
|
||||
},
|
||||
};
|
|
@ -1376,7 +1376,6 @@ var gBrowserInit = {
|
|||
TabsInTitlebar.init();
|
||||
|
||||
new LightweightThemeConsumer(document);
|
||||
CompactTheme.init();
|
||||
|
||||
if (AppConstants.platform == "win") {
|
||||
if (window.matchMedia("(-moz-os-version: windows-win8)").matches &&
|
||||
|
@ -2004,8 +2003,6 @@ var gBrowserInit = {
|
|||
|
||||
ToolbarIconColor.uninit();
|
||||
|
||||
CompactTheme.uninit();
|
||||
|
||||
// In certain scenarios it's possible for unload to be fired before onload,
|
||||
// (e.g. if the window is being closed after browser.js loads but before the
|
||||
// load completes). In that case, there's nothing to do here.
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
<?xml-stylesheet href="chrome://browser/skin/searchbar.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/places/tree-icons.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/places/editBookmark.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/compacttheme.css" type="text/css" alternate="yes" title="Light/Dark"?>
|
||||
|
||||
# All DTD information is stored in a separate file so that it can be shared by
|
||||
# hiddenWindow.xul.
|
||||
|
@ -84,7 +83,6 @@
|
|||
<script type="application/javascript">
|
||||
Services.scriptloader.loadSubScript("chrome://global/content/contentAreaUtils.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-captivePortal.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-compacttheme.js", this);
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-contentblocking.js", this);
|
||||
#ifdef MOZ_DATA_REPORTING
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/browser-data-submission-info-bar.js", this);
|
||||
|
|
|
@ -121,9 +121,6 @@ with Files("browser-addons.js"):
|
|||
with Files("*menu*"):
|
||||
BUG_COMPONENT = ("Firefox", "Menus")
|
||||
|
||||
with Files("browser-compacttheme.js"):
|
||||
BUG_COMPONENT = ("Firefox", "Themes")
|
||||
|
||||
with Files("browser-customization.js"):
|
||||
BUG_COMPONENT = ("Firefox", "Toolbars and Customization")
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ browser.jar:
|
|||
content/browser/browser-ctrlTab.js (content/browser-ctrlTab.js)
|
||||
content/browser/browser-customization.js (content/browser-customization.js)
|
||||
content/browser/browser-data-submission-info-bar.js (content/browser-data-submission-info-bar.js)
|
||||
content/browser/browser-compacttheme.js (content/browser-compacttheme.js)
|
||||
content/browser/browser-contentblocking.js (content/browser-contentblocking.js)
|
||||
#ifndef MOZILLA_OFFICIAL
|
||||
content/browser/browser-development-helpers.js (content/browser-development-helpers.js)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
@import url("chrome://browser/skin/compacttheme.css");
|
|
@ -35,5 +35,9 @@
|
|||
"sidebar_text": "rgb(249, 249, 250)",
|
||||
"sidebar_border": "rgba(255, 255, 255, 0.1)"
|
||||
}
|
||||
},
|
||||
|
||||
"theme_experiment": {
|
||||
"stylesheet": "experiment.css"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXTRA_JS_MODULES.themes['dark'] += [
|
||||
'experiment.css',
|
||||
'icon.svg',
|
||||
'manifest.json',
|
||||
]
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
@import url("chrome://browser/skin/compacttheme.css");
|
|
@ -28,5 +28,9 @@
|
|||
"toolbar_field": "#fff",
|
||||
"toolbar_field_border": "#ccc"
|
||||
}
|
||||
},
|
||||
|
||||
"theme_experiment": {
|
||||
"stylesheet": "experiment.css"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXTRA_JS_MODULES.themes['light'] += [
|
||||
'experiment.css',
|
||||
'icon.svg',
|
||||
'manifest.json',
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче