From 771a3bd6318173074ff93bec5c1cb763d818c877 Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Sun, 11 Sep 2016 16:12:37 +0900 Subject: [PATCH] Update "tabs in titlebar" style correctly #1186 --- content/treestyletab/windowHelper.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/content/treestyletab/windowHelper.js b/content/treestyletab/windowHelper.js index d99a25b9..f3e193ac 100644 --- a/content/treestyletab/windowHelper.js +++ b/content/treestyletab/windowHelper.js @@ -48,9 +48,19 @@ var TreeStyleTabWindowHelper = { // See: https://dxr.mozilla.org/mozilla-central/rev/dbe4b47941c7b3d6298a0ead5e40dd828096c808/browser/base/content/browser-tabsintitlebar.js#104 let result = this.__treestyletab__update(...aArgs); if (gBrowser.treeStyleTab && // possibly not available while the startup process - gBrowser.treeStyleTab.position != 'top') + gBrowser.treeStyleTab.position == 'top') { + let heightOfItemsInTitlebar = 0; + if (AppConstants.platform != 'macosx') { + let menubar = document.getElementById('toolbar-menubar'); + let style = window.getComputedStyle(menubar); + heightOfItemsInTitlebar = menubar.boxObject.height + + parseFloat(style.marginTop) + + parseFloat(style.marginBottom); + } + let marginBottom = heightOfItemsInTitlebar ? '-' + heightOfItemsInTitlebar + 'px' : '' ; document.getElementById('titlebar').style.marginBottom = - document.getElementById('titlebar-content').style.marginBottom = ''; + document.getElementById('titlebar-content').style.marginBottom = marginBottom; + } return result; }; }