onUnapplyTheme: function(iframeWin, newTheme) { Trace.sysout("consoleOverlay.onUnapplyTheme;", iframeWin); let doc = iframeWin.document; let win = doc.getElementById("devtools-webconsole"); Theme.customizeSideBarSplitter(iframeWin, false); Win.loaded(iframeWin).then(doc => { this.updateSideSplitterTheme(); this.updatePersistButton(false); this.updateSearchBox(false); RemoteLoggingFilter.update(this, false); }); this.toggleSideBar.destroy(); // Unload theme stylesheets from the Console frame. removeSheet(iframeWin, "chrome://firebug/skin/domTree.css", "author"); removeSheet(iframeWin, "chrome://firebug/skin/html.css", "author"); removeSheet(iframeWin, "chrome://firebug/skin/performance-timing.css", "author"); Theme.customizeSideBarSplitter(iframeWin, false); // Default themes don't have UI for manual side bar close (unlike // the Firebug theme), so make sure to close it if Firebug theme // is deactivated. let jsterm = this.getTerminal(); if (jsterm && jsterm.sidebar) { jsterm.sidebar.hide(); } },
onUnapplyTheme: function(iframeWin, newTheme) { removeSheet(iframeWin, "chrome://firebug/skin/inspector.css", "author"); removeSheet(iframeWin, "chrome://firebug-os/skin/inspector.css", "author"); // Remove splitter customization Theme.customizeSideBarSplitter(iframeWin, false); this.toggleSideBar.destroy(); this.removeSidePanels(); },
function doUnloadInWindow(window) { let domwin = getChromeWindow(window); if (gButtonCSS) { stylesheet_utils.removeSheet(domwin, gButtonCSS); } if (gWidthCSS) { stylesheet_utils.removeSheet(domwin, gWidthCSS); } let doc = domwin.document; applyTabCropToWindow(doc, "end"); doc.getElementById("tabbrowser-tabs").removeEventListener("TabOpen", newTabListener, false); }
onUnapplyTheme: function(win, newTheme) { Trace.sysout("networkOverlay.onUnapplyTheme;"); removeSheet(win, "chrome://firebug/skin/panel-content.css", "author"); removeSheet(win, "chrome://firebug-os/skin/netmonitor.css", "author"); removeSheet(win, "chrome://firebug/skin/netmonitor.css", "author"); removeSheet(win, "chrome://firebug/skin/variables-view.css", "author"); removeSheet(win, "chrome://firebug/skin/net-export/net-export.css", "author"); // Not sure if the user can manage to unapply the theme manually // before the document is loaded, but robots are fast, so check // the document ready status anyway. Win.loaded(win).then(() => this.unapplyFirebugLayout(win)). then(null, TraceError.sysout); },
var unloadFromWindow = function(_window) { try { styleUtil.removeSheet(_window, style.href, style.type); } catch (e) {} // no need for an exception if its already removed }
onUnapplyTheme: function(iframeWin, newTheme) { Trace.sysout("debuggerOverlay.onUnapplyTheme; new theme: " + newTheme, iframeWin); removeSheet(iframeWin, "chrome://firebug/skin/debugger.css", "author"); getCodeMirrorDoc(iframeWin, doc => { let html = doc.getElementsByTagName("html")[0]; html.classList.remove("theme-firebug"); html.classList.remove("cm-s-firebug"); }); this.toggleSideBar.destroy(); // Move the Callstack panel back to the left sidebar. let win = this.getPanelWindow(); Win.domContentLoaded(win).then(doc => { let tab = doc.getElementById("callstack-tab"); let panel = doc.getElementById("callstack-tabpanel"); let sidebar = doc.getElementById("sources-pane"); sidebar.tabs.appendChild(tab); sidebar.tabpanels.appendChild(panel); this.updateSearchBox(false); this.updatePrettyPrintButton(false); }); },
onUnapplyTheme: function(win, newTheme) { PanelOverlay.prototype.onUnapplyTheme.apply(this, arguments); Trace.sysout("StyleEditorOverlay.onUnapplyTheme; " + win.location.href); removeSheet(win, "chrome://firebug/skin/style-editor.css", "author"); if (!this.mainToolbar) { return; } this.sidebarOverlay.removeSidePanels(); this.toggleSideBar.destroy(); this.mainToolbar.remove(); this.splitter.remove(); this.tabbox.remove(); // xxxHonza: Executing destroy causes an exception // TypeError: this._tabbox.tabpanels is undefined // this.sidebar.destroy(); this.sidebar = null; this.mainToolbar = null; Theme.customizeSideBarSplitter(win, false); },
unapplyTheme: function(win, newTheme) { BaseOverlay.prototype.unapplyTheme.apply(this, arguments); if (win.location.href.indexOf("VariablesView.xul") == -1) return; removeSheet(win, "chrome://firebug/skin/variables-view.css", "author"); },
destroy: function() { PanelOverlay.prototype.destroy.apply(this, arguments); let win = this.getPanelWindow(); removeSheet(win, NETWORK_STYLES_URL, "author"); win.off("websocketmonitor:navigate", this.onNavigate); },
onUnapplyTheme: function(win, newTheme) { SidePanelOverlay.prototype.onUnapplyTheme.apply(this, arguments); removeSheet(win, "chrome://firebug/skin/computed-view.css", "author"); let doc = win.document; let checkbox = doc.querySelector(".includebrowserstyles"); if (checkbox) { checkbox.removeAttribute("fb-collapsed"); } },
onUnapplyTheme: function(iframeWin, newTheme) { Trace.sysout("consoleOverlay.onUnapplyTheme;", iframeWin); let doc = iframeWin.document; let win = doc.getElementById("devtools-webconsole"); Theme.customizeSideBarSplitter(iframeWin, false); Win.loaded(iframeWin).then(doc => { this.updateSideSplitterTheme(); this.updatePersistButton(false); RemoteLoggingFilter.update(this, false); }); this.toggleSideBar.destroy(); // Unload theme stylesheets from the Console frame. removeSheet(iframeWin, "chrome://firebug/skin/domTree.css", "author"); removeSheet(iframeWin, "chrome://firebug/skin/html.css", "author"); removeSheet(iframeWin, "chrome://firebug/skin/performance-timing.css", "author"); Theme.customizeSideBarSplitter(iframeWin, false); },
onUnapplyTheme: function(win, newTheme) { removeSheet(win, "chrome://firebug/skin/font-inspector.css", "author"); let doc = this.getPanelDocument(); let fontURLs = doc.querySelectorAll(".is-remote .font-url"); for (let fontURL of fontURLs) { let inputBox = doc.createElement("input"); inputBox.setAttribute("class", "font-url"); inputBox.setAttribute("readonly", "readonly"); inputBox.value = fontURL.textContent; fontURL.parentElement.insertBefore(inputBox, fontURL); fontURL.parentElement.removeChild(fontURL); } },
this.unload = (uri, window, type) => { if ( ! window) window = w; styleUtils.removeSheet(window, uri, type); for (let x=0;x<loadedSheets.length;x++) { let s = loadedSheets[x]; if (s.uri == uri && s.window == window && s.type == type) { loadedSheets.splice(x, 1); break; } } };
function switchTheme(newTheme, oldTheme) { if (newTheme === oldTheme) { return; } let oldThemeDef = gDevTools.getThemeDefinition(oldTheme); // Unload all theme stylesheets related to the old theme. if (oldThemeDef) { for (let url of oldThemeDef.stylesheets) { StylesheetUtils.removeSheet(window, url, "author"); } } // Load all stylesheets associated with the new theme. let newThemeDef = gDevTools.getThemeDefinition(newTheme); // The theme might not be available anymore (e.g. uninstalled) // Use the default one. if (!newThemeDef) { newThemeDef = gDevTools.getThemeDefinition("light"); } for (let url of newThemeDef.stylesheets) { StylesheetUtils.loadSheet(window, url, "author"); } // Floating scroll-bars like in OSX let hiddenDOMWindow = Cc["@mozilla.org/appshell/appShellService;1"] .getService(Ci.nsIAppShellService) .hiddenDOMWindow; // TODO: extensions might want to customize scrollbar styles too. if (!hiddenDOMWindow.matchMedia("(-moz-overlay-scrollbars)").matches) { let scrollbarsUrl = Services.io.newURI( DEVTOOLS_SKIN_URL + "floating-scrollbars-light.css", null, null); if (newTheme == "dark") { StylesheetUtils.loadSheet( window, scrollbarsUrl, "agent" ); } else if (oldTheme == "dark") { StylesheetUtils.removeSheet( window, scrollbarsUrl, "agent" ); } forceStyle(); } if (oldThemeDef) { for (let name of oldThemeDef.classList) { documentElement.classList.remove(name); } if (oldThemeDef.onUnapply) { oldThemeDef.onUnapply(window, newTheme); } } for (let name of newThemeDef.classList) { documentElement.classList.add(name); } if (newThemeDef.onApply) { newThemeDef.onApply(window, oldTheme); } // Final notification for further theme-switching related logic. gDevTools.emit("theme-switched", window, newTheme, oldTheme); }
function doUnloadInWindow(window) { stylesheet_utils.removeSheet(viewFor(window), current_sheet); }
onUnapplyTheme: function(iframeWin, newTheme) { PanelOverlay.prototype.onUnapplyTheme.apply(this, arguments); removeSheet(iframeWin, "chrome://firebug/skin/memory.css", "author"); },
onUnapplyTheme: function(win, newTheme) { removeSheet(win, "chrome://firebug/skin/rule-view.css", "author"); removeSheet(win, "chrome://firebug/skin/console.css", "author"); },
/* * Apply all the sheets from `newTheme` and remove all of the sheets * from `oldTheme` */ function switchTheme(newTheme) { if (newTheme === gOldTheme) { return; } let oldTheme = gOldTheme; gOldTheme = newTheme; let oldThemeDef = gDevTools.getThemeDefinition(oldTheme); let newThemeDef = gDevTools.getThemeDefinition(newTheme); // The theme might not be available anymore (e.g. uninstalled) // Use the default one. if (!newThemeDef) { newThemeDef = gDevTools.getThemeDefinition("light"); } // Store the sheets in a WeakMap for access later when the theme gets // unapplied. It's hard to query for processing instructions so this // is an easy way to access them later without storing a property on // the window devtoolsStyleSheets.set(newThemeDef, []); let loadEvents = []; for (let url of newThemeDef.stylesheets) { let {styleSheet, loadPromise} = appendStyleSheet(url); devtoolsStyleSheets.get(newThemeDef).push(styleSheet); loadEvents.push(loadPromise); } try { const StylesheetUtils = require("sdk/stylesheet/utils"); const SCROLLBARS_URL = "chrome://devtools/skin/floating-scrollbars-dark-theme.css"; // TODO: extensions might want to customize scrollbar styles too. if (!Services.appShell.hiddenDOMWindow .matchMedia("(-moz-overlay-scrollbars)").matches) { if (newTheme == "dark") { StylesheetUtils.loadSheet(window, SCROLLBARS_URL, "agent"); } else if (oldTheme == "dark") { StylesheetUtils.removeSheet(window, SCROLLBARS_URL, "agent"); } forceStyle(); } } catch (e) { console.warn("customize scrollbar styles is only supported in firefox"); } Promise.all(loadEvents).then(() => { // Unload all stylesheets and classes from the old theme. if (oldThemeDef) { for (let name of oldThemeDef.classList) { documentElement.classList.remove(name); } for (let sheet of devtoolsStyleSheets.get(oldThemeDef) || []) { sheet.remove(); } if (oldThemeDef.onUnapply) { oldThemeDef.onUnapply(window, newTheme); } } // Load all stylesheets and classes from the new theme. for (let name of newThemeDef.classList) { documentElement.classList.add(name); } if (newThemeDef.onApply) { newThemeDef.onApply(window, oldTheme); } // Final notification for further theme-switching related logic. gDevTools.emit("theme-switched", window, newTheme, oldTheme); notifyWindow(); }, console.error.bind(console)); }
removeStylesheet(uri) { uri = ioServices.newURI(uri, null, null); stylesheetUtils.removeSheet(this.window, uri); // this.debugOutput(uri); }
onUnapplyTheme: function(win, newTheme) { Trace.sysout("styleEditorOverlay.onUnapplyTheme; " + win.location.href); removeSheet(win, "chrome://firebug/skin/style-editor.css", "author"); Win.loaded(win).then(() => this.unapplyFirebugLayout(win)); },
destroy: doToAllWindows((win) => { removeSheet(win, self.data.url("browser.css"), "author"); }),
theme.stylesheets.forEach(function(sheet) { StylesheetUtils.removeSheet(win, sheet, 'author'); });