From baaede95a8207fb0d9479818e54b4221e9d4cefd Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Thu, 30 Aug 2012 09:43:23 +0900 Subject: [PATCH] Fix wrong live preview of moving tabs after auto-expansion while dragging --- modules/tabbarDNDObserver.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/tabbarDNDObserver.js b/modules/tabbarDNDObserver.js index 4000c021..ccb891ab 100644 --- a/modules/tabbarDNDObserver.js +++ b/modules/tabbarDNDObserver.js @@ -701,7 +701,8 @@ catch(e) { if (aEvent.target == sourceNode) return; - this.mAutoExpandTimerNext = w.setTimeout(function(aSelf, aTarget) { + var draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0); + this.mAutoExpandTimerNext = w.setTimeout(function(aSelf, aTarget, aDragged) { aSelf.mAutoExpandTimerNext = null; aSelf.mAutoExpandTimer = w.setTimeout( function() { @@ -709,22 +710,31 @@ catch(e) { if (tab && sv.shouldTabAutoExpanded(tab) && tab.getAttribute(sv.kDROP_POSITION) == 'self') { + let draggedTab = sv.getTabById(aDragged); if (sv.getTreePref('autoExpand.intelligently')) { sv.collapseExpandTreesIntelligentlyFor(tab); + aSelf.updateDragData(draggedTab); } else { if (aSelf.mAutoExpandedTabs.indexOf(aTarget) < 0) aSelf.mAutoExpandedTabs.push(aTarget); sv.collapseExpandSubtree(tab, false); + aSelf.updateDragData(draggedTab); } } }, sv.getTreePref('autoExpand.delay') ); - }, 0, this, tab.getAttribute(sv.kID)); + }, 0, this, tab.getAttribute(sv.kID), draggedTab.getAttribute(sv.kID)); tab = null; }, + updateDragData : function TabbarDND_updateDragData(aTab) + { + if (!aTab || !aTab._dragData) return; + var sv = this.treeStyleTab; + aTab._dragData[sv.offsetProp] += sv.getYOffsetOfTab(aTab); + }, onDragLeave : function TabbarDND_onDragLeave(aEvent) {