Bug 625367 - With tabs in the title bar, Firefox dialogs and target=_blank links open a new maximized window with tabs cut off at the top. r=gavin

This commit is contained in:
Dão Gottwald 2011-03-26 13:32:51 +01:00
parent 713aa1183e
commit 1920caa385

View File

@ -5068,23 +5068,19 @@ var TabsInTitlebar = {
let titlebar = $("titlebar");
if (allowed) {
let availTop = screen.availTop;
function top(ele) ele.boxObject.screenY - availTop;
function bottom(ele) top(ele) + rect(ele).height;
function rect(ele) ele.getBoundingClientRect();
let tabsToolbar = $("TabsToolbar");
let appmenuButtonBox = $("appmenu-button-container");
let captionButtonsBox = $("titlebar-buttonbox");
this._sizePlaceholder("appmenu-button", rect(appmenuButtonBox).width);
this._sizePlaceholder("caption-buttons", rect(captionButtonsBox).width);
let maxMargin = top(gNavToolbox);
let tabsBottom = maxMargin + rect(tabsToolbar).height;
let titlebarBottom = Math.max(bottom(appmenuButtonBox), bottom(captionButtonsBox));
let distance = tabsBottom - titlebarBottom;
titlebar.style.marginBottom = - Math.min(distance, maxMargin) + "px";
let tabsToolbarRect = rect(tabsToolbar);
let titlebarTop = rect($("titlebar-content")).top;
titlebar.style.marginBottom = - Math.min(tabsToolbarRect.top - titlebarTop,
tabsToolbarRect.height) + "px";
docElement.setAttribute("tabsintitlebar", "true");