Bug 1402845 - Fix panelview sizing when customRectGetter is used. r=mikedeboer,Paolo

* The extension content drives the sizing of the browser and popup that contains it via the Extension:BrowserResized message. The ignoreResizes property throttles/debounces this initially, stashing the dimensions received rather than triggering resize of the popup for every message. When the popup is a subview and fixedWidth, we ignore width but *do* want to use the stashed height value.

* Until the panel is given visibility, it has 0 height, so after setting visibility, wait until the next refresh-driver tick before measuring any header which should get added to the overall view height

MozReview-Commit-ID: AgcruVb9QPA

--HG--
extra : rebase_source : 429503a7d38559cc8670a3205b3290b8e0bbbfa2
This commit is contained in:
Sam Foster 2017-10-05 10:23:53 -07:00
Родитель 7085c55905
Коммит c11210d2df
2 изменённых файлов: 10 добавлений и 3 удалений

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

@ -875,11 +875,15 @@ var PanelMultiView = class extends AssociatedToNode {
let width = prevPanelView.knownWidth;
let height = prevPanelView.knownHeight;
viewRect = Object.assign({height, width}, viewNode.customRectGetter());
nextPanelView.visible = true;
// Until the header is visible, it has 0 height.
// Wait for layout before measuring it
let header = viewNode.firstChild;
if (header && header.classList.contains("panel-header")) {
viewRect.height += this._dwu.getBoundsWithoutFlushing(header).height;
viewRect.height += await window.promiseDocumentFlushed(() => {
return this._dwu.getBoundsWithoutFlushing(header).height;
});
}
nextPanelView.visible = true;
await nextPanelView.descriptionHeightWorkaround();
} else {
this._offscreenViewStack.style.minHeight = olderView.knownHeight + "px";

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

@ -512,7 +512,10 @@ class ViewPopup extends BasePopup {
this.browser.swapDocShells(browser);
this.destroyBrowser(browser);
if (this.dimensions && !this.fixedWidth) {
if (this.dimensions) {
if (this.fixedWidth) {
delete this.dimensions.width;
}
this.resizeBrowser(this.dimensions);
}