Bug 1962688 - Fix tab drop zone calculation to account for window decorations correctly. r=tabbrowser-reviewers,nsharpley

This is more visible on Linux because the decorations there are bigger, but I
believe this also fixes issues on windows specially if you have the titlebar
checkbox on.

You need to use mozInnerScreen* coords in order to get the screen coordinates
of the client area.

Differential Revision: https://phabricator.services.mozilla.com/D246829
This commit is contained in:
Emilio Cobos Álvarez
2025-04-28 15:08:59 +00:00
parent 91f1e50650
commit d025939892

View File

@@ -1384,7 +1384,7 @@
: [event.screenX, window.screenX, window.screenX + window.outerWidth];
if (tabAxisPos > tabAxisStart && tabAxisPos < tabAxisEnd) {
// also avoid detaching if the the tab was dropped too close to
// also avoid detaching if the tab was dropped too close to
// the tabbar (half a tab)
let rect = window.windowUtils.getBoundsWithoutFlushing(
this.arrowScrollbox
@@ -1396,15 +1396,17 @@
(RTL_UI && this._sidebarPositionStart) ||
(!RTL_UI && !this._sidebarPositionStart)
) {
crossAxisStart = window.screenX + rect.right - 1.5 * rect.width;
crossAxisStart =
window.mozInnerScreenX + rect.right - 1.5 * rect.width;
crossAxisEnd = window.screenX;
} else {
crossAxisStart = window.screenX;
crossAxisEnd = window.screenX + rect.left + 1.5 * rect.width;
crossAxisEnd =
window.mozInnerScreenX + rect.left + 1.5 * rect.width;
}
} else {
crossAxisStart = window.screenY;
crossAxisEnd = window.screenY + rect.top + 1.5 * rect.height;
crossAxisEnd = window.mozInnerScreenY + rect.top + 1.5 * rect.height;
}
if (crossAxisPos > crossAxisStart && crossAxisPos < crossAxisEnd) {
return;