Activate "draw in titlebar" when the menubar is permanently shown #893

Because the special binding chrome://browser/content/customizableui/toolbar.xml#toolbar-drag works only when the "chromemargin" attribute is specified for the root element like "0,2,2,2". In other words, draggable UI elements don't work as expected for regular window.
This commit is contained in:
Piro / YUKI Hiroshi 2015-11-08 22:50:39 +09:00
parent 6f90b666ee
commit a6eb66c216

View File

@ -424,6 +424,7 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
this.fullscreenObserver = new FullscreenObserver(this.window);
this.initUIShowHideObserver();
this.initMenubarShowHideObserver();
var appcontent = d.getElementById('appcontent');
appcontent.addEventListener('SubBrowserAdded', this, false);
@ -519,6 +520,19 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
if (socialBox)
this.socialBoxObserver = new BrowserUIShowHideObserver(this, socialBox);
},
initMenubarShowHideObserver : function TSTWindow_initMenubarShowHideObserver()
{
var w = this.window;
var MutationObserver = w.MutationObserver || w.MozMutationObserver;
this.menubarShowHideObserver = new MutationObserver((function(aMutations, aObserver) {
this.updateTabsInTitlebar();
}).bind(this));
this.menubarShowHideObserver.observe(w.document.getElementById('toolbar-menubar'), {
attributes : true,
attributeFilter : ['autohide']
});
},
destroy : function TSTWindow_destroy()
{
@ -578,6 +592,11 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
delete this.socialBoxObserver;
}
if (this.menubarShowHideObserver) {
this.menubarShowHideObserver.disconnect();
delete this.menubarShowHideObserver;
}
for (let i = 0, maxi = this._tabFocusAllowance.length; i < maxi; i++)
{
w.removeEventListener(this.kEVENT_TYPE_FOCUS_NEXT_TAB, this._tabFocusAllowance[i], false);
@ -1143,7 +1162,11 @@ TreeStyleTabWindow.prototype = inherit(TreeStyleTabBase, {
try {
if (TabsInTitlebar) {
let allowed = isTopTabbar && this.browser.treeStyleTab.fixed;
let menubar = this.window.document.getElementById('toolbar-menubar');
let allowed = (
(isTopTabbar && this.browser.treeStyleTab.fixed) ||
menubar.getAttribute('autohide') !== 'true'
);
if (
(this.window.TabsOnBottom && utils.getTreePref('compatibility.TabsOnBottom')) ||
('navbarontop' in this.window && utils.getTreePref('compatibility.NavbarOnTitlebar')) ||