Skip to content
Snippets Groups Projects
Verified Commit bec1f691 authored by ma1's avatar ma1
Browse files

Bug 42443: Shrink window to match letterboxing size when the emtpy area is clicked.

parent 1cb8d16a
No related branches found
No related tags found
No related merge requests found
......@@ -750,8 +750,27 @@ class _RFPHelper {
});
}
// We will attach this method to each browser window. When called
// it will instantly resize the window to exactly fit the selected
// (possibly letterboxed) browser.
shrinkToLetterbox() {
let { selectedBrowser } = this.gBrowser;
let stack = selectedBrowser.closest(".browserStack");
const outer = stack.getBoundingClientRect();
const inner = selectedBrowser.getBoundingClientRect();
this.resizeBy(inner.width - outer.width, inner.height - outer.height);
}
_onWindowDoubleClick(e) {
if (e.target.classList.contains("browserStack")) {
e.currentTarget.shrinkToLetterbox();
}
}
_attachWindow(aWindow) {
aWindow.addEventListener("sizemodechange", windowResizeHandler);
aWindow.shrinkToLetterbox = this.shrinkToLetterbox;
aWindow.addEventListener("dblclick", this._onWindowDoubleClick);
aWindow.gBrowser.addTabsProgressListener(this);
aWindow.addEventListener("TabOpen", this);
const resizeObserver = (aWindow._rfpResizeObserver =
......@@ -783,9 +802,12 @@ class _RFPHelper {
let browser = tab.linkedBrowser;
this._resetContentSize(browser);
}
aWindow.removeEventListener("dblclick", this._onWindowDoubleClick);
delete aWindow.shrinkToLetterbox;
aWindow.removeEventListener("sizemodechange", windowResizeHandler);
}
_handleDOMWindowOpened(win) {
let self = this;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment