author | Nihanth Subramanya <nhnt11@gmail.com> |
Thu, 15 Feb 2018 19:31:03 +0530 | |
changeset 404320 | be58311261fcad925faeaceefe3303ceb1653865 |
parent 404306 | 6cfa628374192bc053d5837c892fc5d6f44a6778 |
child 404321 | 3ae4195fba9785117f76bdbe2cf3775cbb806a46 |
push id | 33463 |
push user | shindli@mozilla.com |
push date | Sun, 18 Feb 2018 09:34:46 +0000 |
treeherder | mozilla-central@c2b3a9f871a3 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | florian |
bugs | 1438511 |
milestone | 60.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
browser/base/content/browser-sidebar.js | file | annotate | diff | comparison | revisions | |
browser/base/content/browser.js | file | annotate | diff | comparison | revisions |
--- a/browser/base/content/browser-sidebar.js +++ b/browser/base/content/browser-sidebar.js @@ -43,29 +43,36 @@ var SidebarUI = { return this.__title = document.getElementById("sidebar-title"); }, _splitter: null, _icon: null, _reversePositionButton: null, _switcherPanel: null, _switcherTarget: null, _switcherArrow: null, + _inited: false, + + get initialized() { + return this._inited; + }, init() { this._box = document.getElementById("sidebar-box"); this._splitter = document.getElementById("sidebar-splitter"); this._icon = document.getElementById("sidebar-icon"); this._reversePositionButton = document.getElementById("sidebar-reverse-position"); this._switcherPanel = document.getElementById("sidebarMenu-popup"); this._switcherTarget = document.getElementById("sidebar-switcher-target"); this._switcherArrow = document.getElementById("sidebar-switcher-arrow"); this._switcherTarget.addEventListener("command", () => { this.toggleSwitcherPanel(); }); + + this._inited = true; }, uninit() { // If this is the last browser window, persist various values that should be // remembered for after a restart / reopening a browser window. let enumerator = Services.wm.getEnumerator("navigator:browser"); if (!enumerator.hasMoreElements()) { document.persist("sidebar-box", "sidebarcommand");
--- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -5605,39 +5605,42 @@ var gUIDensity = { Services.prefs.setIntPref(this.uiDensityPref, mode); }, update(mode) { if (mode == null) { mode = this.getCurrentDensity().mode; } - let docs = [ - document.documentElement, - SidebarUI.browser.contentDocument.documentElement, - ]; + let docs = [document.documentElement]; + let shouldUpdateSidebar = SidebarUI.initialized && SidebarUI.isOpen; + if (shouldUpdateSidebar) { + docs.push(SidebarUI.browser.contentDocument.documentElement); + } for (let doc of docs) { switch (mode) { case this.MODE_COMPACT: doc.setAttribute("uidensity", "compact"); break; case this.MODE_TOUCH: doc.setAttribute("uidensity", "touch"); break; default: doc.removeAttribute("uidensity"); break; } } - let tree = SidebarUI.browser.contentDocument.querySelector(".sidebar-placesTree"); - if (tree) { - // Tree items don't update their styles without changing some property on the - // parent tree element, like background-color or border. See bug 1407399. - tree.style.border = "1px"; - tree.style.border = ""; + if (shouldUpdateSidebar) { + let tree = SidebarUI.browser.contentDocument.querySelector(".sidebar-placesTree"); + if (tree) { + // Tree items don't update their styles without changing some property on the + // parent tree element, like background-color or border. See bug 1407399. + tree.style.border = "1px"; + tree.style.border = ""; + } } TabsInTitlebar.updateAppearance(true); gBrowser.tabContainer.uiDensityChanged(); }, }; var gHomeButton = {