... |
... |
@@ -750,8 +750,27 @@ class _RFPHelper { |
750
|
750
|
});
|
751
|
751
|
}
|
752
|
752
|
|
|
753
|
+ // We will attach this method to each browser window. When called
|
|
754
|
+ // it will instantly resize the window to exactly fit the selected
|
|
755
|
+ // (possibly letterboxed) browser.
|
|
756
|
+ shrinkToLetterbox() {
|
|
757
|
+ let { selectedBrowser } = this.gBrowser;
|
|
758
|
+ let stack = selectedBrowser.closest(".browserStack");
|
|
759
|
+ const outer = stack.getBoundingClientRect();
|
|
760
|
+ const inner = selectedBrowser.getBoundingClientRect();
|
|
761
|
+ this.resizeBy(inner.width - outer.width, inner.height - outer.height);
|
|
762
|
+ }
|
|
763
|
+
|
|
764
|
+ _onWindowDoubleClick(e) {
|
|
765
|
+ if (e.target.classList.contains("browserStack")) {
|
|
766
|
+ e.currentTarget.shrinkToLetterbox();
|
|
767
|
+ }
|
|
768
|
+ }
|
|
769
|
+
|
753
|
770
|
_attachWindow(aWindow) {
|
754
|
771
|
aWindow.addEventListener("sizemodechange", windowResizeHandler);
|
|
772
|
+ aWindow.shrinkToLetterbox = this.shrinkToLetterbox;
|
|
773
|
+ aWindow.addEventListener("dblclick", this._onWindowDoubleClick);
|
755
|
774
|
aWindow.gBrowser.addTabsProgressListener(this);
|
756
|
775
|
aWindow.addEventListener("TabOpen", this);
|
757
|
776
|
const resizeObserver = (aWindow._rfpResizeObserver =
|
... |
... |
@@ -783,9 +802,12 @@ class _RFPHelper { |
783
|
802
|
let browser = tab.linkedBrowser;
|
784
|
803
|
this._resetContentSize(browser);
|
785
|
804
|
}
|
|
805
|
+ aWindow.removeEventListener("dblclick", this._onWindowDoubleClick);
|
|
806
|
+ delete aWindow.shrinkToLetterbox;
|
786
|
807
|
aWindow.removeEventListener("sizemodechange", windowResizeHandler);
|
787
|
808
|
}
|
788
|
809
|
|
|
810
|
+
|
789
|
811
|
_handleDOMWindowOpened(win) {
|
790
|
812
|
let self = this;
|
791
|
813
|
|