[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-115.9.0esr-13.5-1] Bug 42443: Shrink window to match letterboxing size when the emtpy area is clicked.



Title: GitLab

ma1 pushed to branch tor-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser

Commits:

  • c99204f2
    by hackademix at 2024-03-13T16:39:27+01:00
    Bug 42443: Shrink window to match letterboxing size when the emtpy area is clicked.
    

1 changed file:

Changes:

  • toolkit/components/resistfingerprinting/RFPHelper.sys.mjs
    ... ... @@ -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
     
    

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits