Addressing review comments for bug 465186

--HG--
extra : rebase_source : d433b763a715eeb11845e1bc111dbcf66ea732a4
This commit is contained in:
Dão Gottwald 2011-07-04 12:54:41 +02:00
Родитель 08e9ef88ed
Коммит 0a103765fb
1 изменённых файлов: 22 добавлений и 19 удалений

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

@ -3304,14 +3304,15 @@
let canvas = tabPreviews.capture(tab, false); let canvas = tabPreviews.capture(tab, false);
dt.setDragImage(canvas, 0, 0); dt.setDragImage(canvas, 0, 0);
let bo = this.mTabstrip.boxObject; // _dragOffsetX/Y give the coordinates that the mouse should be
let paddingStart = this.mTabstrip.scrollboxPaddingStart;
// _dragOffset[X|Y] give the coordinates that the mouse should be
// positioned relative to the corner of the new window created upon // positioned relative to the corner of the new window created upon
// dragend such that the mouse appears to have the same position // dragend such that the mouse appears to have the same position
// relative to the corner of the dragged tab. // relative to the corner of the dragged tab.
tab._dragOffsetX = event.screenX - tab.boxObject.screenX + paddingStart + bo.screenX - window.screenX; function clientX(ele) ele.getBoundingClientRect().left;
tab._dragOffsetY = event.screenY - tab.boxObject.screenY + bo.screenY - window.screenY; let tabOffsetX = clientX(tab) -
clientX(this.children[0].pinned ? this.children[0] : this);
tab._dragOffsetX = event.screenX - window.screenX - tabOffsetX;
tab._dragOffsetY = event.screenY - window.screenY;
event.stopPropagation(); event.stopPropagation();
]]></handler> ]]></handler>
@ -3526,16 +3527,18 @@
var draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0); var draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0);
// screen.availLeft et. al. only check the screen that this window is on, // screen.availLeft et. al. only check the screen that this window is on,
// but we want to look at the screen the tab is being dropped onto. // but we want to look at the screen the tab is being dropped onto.
var sm = Cc["@mozilla.org/gfx/screenmanager;1"]. var sX = {}, sY = {}, sWidth = {}, sHeight = {};
getService(Ci.nsIScreenManager); Cc["@mozilla.org/gfx/screenmanager;1"]
var whichScreen = sm.screenForRect(eX, eY, 1, 1); .getService(Ci.nsIScreenManager)
var sX = {}, sY = {}, sW = {}, sH = {}; .screenForRect(eX, eY, 1, 1)
whichScreen.GetAvailRect(sX, sY, sW, sH); .GetAvailRect(sX, sY, sWidth, sHeight);
// ensure new window entirely within screen // ensure new window entirely within screen
var winWidth = Math.min(window.outerWidth, sW.value); var winWidth = Math.min(window.outerWidth, sWidth.value);
var winHeight = Math.min(window.outerHeight, sH.value); var winHeight = Math.min(window.outerHeight, sHeight.value);
var aLeft = Math.min(Math.max(eX - draggedTab._dragOffsetX, sX.value), sX.value + sW.value - winWidth); var left = Math.min(Math.max(eX - draggedTab._dragOffsetX, sX.value),
var aTop = Math.min(Math.max(eY - draggedTab._dragOffsetY, sY.value), sY.value + sH.value - winHeight); sX.value + sWidth.value - winWidth);
var top = Math.min(Math.max(eY - draggedTab._dragOffsetY, sY.value),
sY.value + sHeight.value - winHeight);
delete draggedTab._dragOffsetX; delete draggedTab._dragOffsetX;
delete draggedTab._dragOffsetY; delete draggedTab._dragOffsetY;
@ -3545,17 +3548,17 @@
// the window is too large for its screen, the window manager may do // the window is too large for its screen, the window manager may do
// automatic repositioning. // automatic repositioning.
window.resizeTo(winWidth, winHeight); window.resizeTo(winWidth, winHeight);
window.moveTo(aLeft, aTop); window.moveTo(left, top);
window.focus(); window.focus();
} } else {
else this.tabbrowser.replaceTabWithWindow(draggedTab, { screenX: left,
this.tabbrowser.replaceTabWithWindow(draggedTab, { screenX: aLeft, screenY: top,
screenY: aTop,
#ifndef XP_WIN #ifndef XP_WIN
outerWidth: winWidth, outerWidth: winWidth,
outerHeight: winHeight outerHeight: winHeight
#endif #endif
}); });
}
event.stopPropagation(); event.stopPropagation();
]]></handler> ]]></handler>