Bug 1499883 - Avoid a reflow on tab detaching by calculating in advance the value needed by ondragend. r=florian
authorFelipe Gomes <felipc@gmail.com>
Fri, 19 Oct 2018 01:12:01 -0300
changeset 490593 f4873573579f0a2937036a45009802541cda2d3a
parent 490592 1d34fad96d5d182db213456aec5dea1cdad30cd5
child 490596 62e384532eeb60f5c61383ca8b16d614c49e1838
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersflorian
bugs1499883
milestone64.0a1
Bug 1499883 - Avoid a reflow on tab detaching by calculating in advance the value needed by ondragend. r=florian Differential Revision: https://phabricator.services.mozilla.com/D9208
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1812,21 +1812,21 @@
         }
 
         // Disable detach within the browser toolbox
         var eX = event.screenX;
         var eY = event.screenY;
         var wX = window.screenX;
         // check if the drop point is horizontally within the window
         if (eX > wX && eX < (wX + window.outerWidth)) {
-          let bo = this.arrowScrollbox.boxObject;
           // also avoid detaching if the the tab was dropped too close to
           // the tabbar (half a tab)
-          let endScreenY = bo.screenY + 1.5 * bo.height;
-          if (eY < endScreenY && eY > window.screenY)
+          let rect = window.windowUtils.getBoundsWithoutFlushing(this.arrowScrollbox);
+          let detachTabThresholdY = window.screenY + rect.top + 1.5 * rect.height;
+          if (eY < detachTabThresholdY && eY > window.screenY)
             return;
         }
 
         // screen.availLeft et. al. only check the screen that this window is on,
         // but we want to look at the screen the tab is being dropped onto.
         var screen = Cc["@mozilla.org/gfx/screenmanager;1"]
                        .getService(Ci.nsIScreenManager)
                        .screenForRect(eX, eY, 1, 1);