Bug 971129 - Set a minimum page size to 25px when initializing the devtools toolbox host;r=jryans

This commit is contained in:
Brian Grinstead 2015-03-27 10:35:32 -07:00
Родитель da1028199c
Коммит 371e5229aa
2 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -25,12 +25,12 @@ add_task(function*() {
is (nbox.clientWidth, nboxWidth, "Opening the toolbox hasn't changed the width of the nbox");
let iframe = document.getAnonymousElementByAttribute(nbox, "class", "devtools-toolbox-bottom-iframe");
is (iframe.clientHeight, nboxHeight - 10, "The iframe fits within the available space ");
is (iframe.clientHeight, nboxHeight - 25, "The iframe fits within the available space");
yield toolbox.switchHost(devtools.Toolbox.HostType.SIDE);
iframe = document.getAnonymousElementByAttribute(nbox, "class", "devtools-toolbox-side-iframe");
iframe.style.minWidth = "1px"; // Disable the min width set in css
is (iframe.clientWidth, nboxWidth - 10, "The iframe fits within the available space");
is (iframe.clientWidth, nboxWidth - 25, "The iframe fits within the available space");
yield cleanup(toolbox);
});

Просмотреть файл

@ -10,6 +10,12 @@ const {Promise: promise} = require("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/devtools/DOMHelpers.jsm");
/* A host should always allow this much space for the page to be displayed.
* There is also a min-height on the browser, but we still don't want to set
* frame.height to be larger than that, since it can cause problems with
* resizing the toolbox and panel layout. */
const MIN_PAGE_SIZE = 25;
/**
* A toolbox host represents an object that contains a toolbox (e.g. the
* sidebar or a separate window). Any host object should implement the
@ -57,7 +63,7 @@ BottomHost.prototype = {
this.frame.className = "devtools-toolbox-bottom-iframe";
this.frame.height = Math.min(
Services.prefs.getIntPref(this.heightPref),
this._nbox.clientHeight - 10 // Always show at least some page content
this._nbox.clientHeight - MIN_PAGE_SIZE
);
this._nbox.appendChild(this._splitter);
@ -144,7 +150,7 @@ SidebarHost.prototype = {
this.frame.width = Math.min(
Services.prefs.getIntPref(this.widthPref),
this._sidebar.clientWidth - 10 // Always show at least some page content
this._sidebar.clientWidth - MIN_PAGE_SIZE
);
this._sidebar.appendChild(this._splitter);