Bug 1396833 - Fix tab drag&drop not finishing due to CSS transform not kicking in r=mconley

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

--HG--
extra : amend_source : f1427cfe4c30066373b1acbd0d4017d8a02bc0ac
This commit is contained in:
Tim Taubert 2017-11-22 08:15:09 +01:00
Родитель 0d3f601004
Коммит 663e3294da
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -7582,8 +7582,8 @@
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) {