Operate drag and drop of pinned tabs more correctly

This commit is contained in:
Piro / YUKI Hiroshi 2012-12-04 01:40:31 +09:00
parent 8e37edc535
commit 5e09e88bb2
2 changed files with 16 additions and 5 deletions

View File

@ -410,7 +410,13 @@
collectAlignedTabs : function TDU_collectAlignedTabs(tabs, context)
{
context.allAnimatedTabs = tabs;
var base = context.draggedTab.boxObject[context.align];
var baseTab = context.draggedTab;
if (!baseTab.pinned)
return tabs;
// With Tree Style Tabs, pinned tabs are shown with multiple rows.
// We should animate only tabs in the same row.
var base = baseTab.boxObject[context.align];
return tabs.filter(function(aTab) {
return aTab.boxObject[context.align] == base;
});

View File

@ -268,11 +268,16 @@ catch(e) {
let draggedTab = aEvent.dataTransfer && aEvent.dataTransfer.mozGetDataAt(TAB_DROP_TYPE, 0);
if (draggedTab._dragData) {
let tabs = sv.getTabs(b).filter(function(aTab) {
return !aTab._dragData;
let sameTypeUndraggedTabs = tabs.filter(function(aTab) {
return !aTab._dragData && aTab.pinned == draggedTab.pinned;
});
tab = sv.getTabFromCoordinates(aEvent, tabs) ||
sv.getTabFromCoordinates(aEvent);
tab = draggedTab.pinned ?
// pinned tabs cannot be dropped to another pinned tab, so
// we can use the drop position calculated by "_animateTabMove()".
tabs[draggedTab._dragData.animDropIndex] :
// otherwise, we have to find "drop target" tab from screen coordinates.
sv.getTabFromCoordinates(aEvent, sameTypeUndraggedTabs) ||
sv.getTabFromCoordinates(aEvent);
}
var isTabMoveFromOtherWindow = aSourceTab && aSourceTab.ownerDocument != d;