Bug 1387182 - fix border (empty space) compensation when dragging items in customize mode in RTL, r?jaws draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 07 Aug 2017 12:14:19 +0100
changeset 641625 d6bd47b35ef24d7253ecd12113c1449287f289b4
parent 641624 8437bfefc8417d057015e8b4d77b6a5c67360863
child 724857 e44b50388454c54b07a40ec52025c6a482dbe353
push id72596
push usergijskruitbosch@gmail.com
push dateMon, 07 Aug 2017 11:15:55 +0000
reviewersjaws
bugs1387182
milestone57.0a1
Bug 1387182 - fix border (empty space) compensation when dragging items in customize mode in RTL, r?jaws MozReview-Commit-ID: AblsJGmu5zm
browser/components/customizableui/CustomizeMode.jsm
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -1704,20 +1704,21 @@ CustomizeMode.prototype = {
         dragValue = "after";
       } else {
         dragOverItem = targetParent.children[position];
         if (targetAreaType == "toolbar") {
           // Check if the aDraggedItem is hovered past the first half of dragOverItem
           let itemRect = this._dwu.getBoundsWithoutFlushing(dragOverItem);
           let dropTargetCenter = itemRect.left + (itemRect.width / 2);
           let existingDir = dragOverItem.getAttribute("dragover");
+          let dirFactor = this._dir == "ltr" ? 1 : -1;
           if (existingDir == "before") {
-            dropTargetCenter += (parseInt(dragOverItem.style.borderInlineStartWidth) || 0) / 2;
+            dropTargetCenter += (parseInt(dragOverItem.style.borderInlineStartWidth) || 0) / 2 * dirFactor;
           } else {
-            dropTargetCenter -= (parseInt(dragOverItem.style.borderInlineEndWidth) || 0) / 2;
+            dropTargetCenter -= (parseInt(dragOverItem.style.borderInlineEndWidth) || 0) / 2 * dirFactor;
           }
           let before = this._dir == "ltr" ? aEvent.clientX < dropTargetCenter : aEvent.clientX > dropTargetCenter;
           dragValue = before ? "before" : "after";
         } else if (targetAreaType == "menu-panel") {
           let itemRect = this._dwu.getBoundsWithoutFlushing(dragOverItem);
           let dropTargetCenter = itemRect.top + (itemRect.height / 2);
           let existingDir = dragOverItem.getAttribute("dragover");
           if (existingDir == "before") {