Bug 928722 - Resample the system scrollbar width when the UI theme is changed or mouse plugged in. (pair programmed with mconley). r=mconley

This commit is contained in:
Jared Wein 2014-03-06 09:17:00 -05:00
parent d2a09efaae
commit cba4ee8eb1
2 changed files with 14 additions and 0 deletions

View File

@ -47,6 +47,8 @@ const PanelUI = {
this.menuButton.addEventListener("mousedown", this);
this.menuButton.addEventListener("keypress", this);
this._overlayScrollListenerBoundFn = this._overlayScrollListener.bind(this);
window.matchMedia("(-moz-overlay-scrollbars)").addListener(this._overlayScrollListenerBoundFn);
this._initialized = true;
},
@ -77,6 +79,8 @@ const PanelUI = {
this.helpView.removeEventListener("ViewShowing", this._onHelpViewShow);
this.menuButton.removeEventListener("mousedown", this);
this.menuButton.removeEventListener("keypress", this);
window.matchMedia("(-moz-overlay-scrollbars)").removeListener(this._overlayScrollListenerBoundFn);
this._overlayScrollListenerBoundFn = null;
},
/**
@ -443,6 +447,12 @@ const PanelUI = {
quitButton.setAttribute("tooltiptext", tooltipString);
#endif
},
_overlayScrollListenerBoundFn: null,
_overlayScrollListener: function(aMQL) {
ScrollbarSampler.resetSystemScrollbarWidth();
this._scrollWidth = null;
},
};
/**

View File

@ -31,6 +31,10 @@ this.ScrollbarSampler = {
return deferred.promise;
},
resetSystemScrollbarWidth: function() {
gSystemScrollbarWidth = null;
},
_sampleSystemScrollbarWidth: function() {
let deferred = Promise.defer();
let hwin = Services.appShell.hiddenDOMWindow;