Bug 1396833 - Fix tab drag&drop not finishing due to CSS transform not kicking in r=mconley a=gchang
authorTim Taubert <ttaubert@mozilla.com>
Wed, 22 Nov 2017 08:15:09 +0100
changeset 444946 33e95d96edd254f38dcd29bae7f9974ebfeea703
parent 444945 35e083bb82efff62d48a0ca947816ab44d38eb81
child 444947 47c97637717fc01e6abcf769bb00ce3cc7a16276
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, gchang
bugs1396833
milestone58.0
Bug 1396833 - Fix tab drag&drop not finishing due to CSS transform not kicking in r=mconley a=gchang Summary: In very rare situations, the right number of tabs and the right drop position will lead to the drop event handler trying to start a translateX() transform and then wait for the transitionend event that will never fire. If the old and the new translateX values are too close together (e.g. 1259.1000061035156 and 1259.0999450683594) then the layout engine won't actually start a transform. A simple solution is to round translateX values before comparing them and deciding whether to initiate a transition. Reviewers: mconley Reviewed By: mconley Bug #: 1396833 Differential Revision: https://phabricator.services.mozilla.com/D265
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -7577,18 +7577,18 @@
         if (draggedTab && dropEffect == "copy") {
           // copy the dropped tab (wherever it's from)
           let newIndex = this._getDropIndex(event, false);
           let newTab = this.tabbrowser.duplicateTab(draggedTab);
           this.tabbrowser.moveTabTo(newTab, newIndex);
           if (draggedTab.parentNode != this || event.shiftKey)
             this.selectedItem = newTab;
         } else if (draggedTab && draggedTab.parentNode == this) {
-          let oldTranslateX = draggedTab._dragData.translateX;
-          let tabWidth = draggedTab._dragData.tabWidth;
+          let oldTranslateX = Math.round(draggedTab._dragData.translateX);
+          let tabWidth = Math.round(draggedTab._dragData.tabWidth);
           let translateOffset = oldTranslateX % tabWidth;
           let newTranslateX = oldTranslateX - translateOffset;
           if (oldTranslateX > 0 && translateOffset > tabWidth / 2) {
             newTranslateX += tabWidth;
           } else if (oldTranslateX < 0 && -translateOffset > tabWidth / 2) {
             newTranslateX -= tabWidth;
           }