Fix wrong live preview of moving tabs after auto-expansion while dragging

This commit is contained in:
Piro / YUKI Hiroshi 2012-08-30 09:43:23 +09:00
parent 6393abb4c9
commit baaede95a8

View File

@ -701,7 +701,8 @@ catch(e) {
if (aEvent.target == sourceNode) if (aEvent.target == sourceNode)
return; 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.mAutoExpandTimerNext = null;
aSelf.mAutoExpandTimer = w.setTimeout( aSelf.mAutoExpandTimer = w.setTimeout(
function() { function() {
@ -709,22 +710,31 @@ catch(e) {
if (tab && if (tab &&
sv.shouldTabAutoExpanded(tab) && sv.shouldTabAutoExpanded(tab) &&
tab.getAttribute(sv.kDROP_POSITION) == 'self') { tab.getAttribute(sv.kDROP_POSITION) == 'self') {
let draggedTab = sv.getTabById(aDragged);
if (sv.getTreePref('autoExpand.intelligently')) { if (sv.getTreePref('autoExpand.intelligently')) {
sv.collapseExpandTreesIntelligentlyFor(tab); sv.collapseExpandTreesIntelligentlyFor(tab);
aSelf.updateDragData(draggedTab);
} }
else { else {
if (aSelf.mAutoExpandedTabs.indexOf(aTarget) < 0) if (aSelf.mAutoExpandedTabs.indexOf(aTarget) < 0)
aSelf.mAutoExpandedTabs.push(aTarget); aSelf.mAutoExpandedTabs.push(aTarget);
sv.collapseExpandSubtree(tab, false); sv.collapseExpandSubtree(tab, false);
aSelf.updateDragData(draggedTab);
} }
} }
}, },
sv.getTreePref('autoExpand.delay') sv.getTreePref('autoExpand.delay')
); );
}, 0, this, tab.getAttribute(sv.kID)); }, 0, this, tab.getAttribute(sv.kID), draggedTab.getAttribute(sv.kID));
tab = null; 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) onDragLeave : function TabbarDND_onDragLeave(aEvent)
{ {