зеркало из https://github.com/mozilla/gecko-dev.git
Bug 733630 Use native window border size if there is no content under mouse cursor r=jimm
This commit is contained in:
Родитель
b46e1cd08a
Коммит
8dd7086160
|
@ -5406,37 +5406,61 @@ nsWindow::ClientMarginHitTestPoint(PRInt32 mx, PRInt32 my)
|
||||||
if (mSizeMode == nsSizeMode_Maximized)
|
if (mSizeMode == nsSizeMode_Maximized)
|
||||||
isResizable = false;
|
isResizable = false;
|
||||||
|
|
||||||
|
// Ensure being accessible to borders of window. Even if contents are in
|
||||||
|
// this area, the area must behave as border.
|
||||||
|
nsIntMargin nonClientSize(NS_MAX(mHorResizeMargin - mNonClientOffset.left,
|
||||||
|
kResizableBorderMinSize),
|
||||||
|
NS_MAX(mCaptionHeight - mNonClientOffset.top,
|
||||||
|
kResizableBorderMinSize),
|
||||||
|
NS_MAX(mHorResizeMargin - mNonClientOffset.right,
|
||||||
|
kResizableBorderMinSize),
|
||||||
|
NS_MAX(mVertResizeMargin - mNonClientOffset.bottom,
|
||||||
|
kResizableBorderMinSize));
|
||||||
|
|
||||||
|
bool allowContentOverride = mSizeMode == nsSizeMode_Maximized ||
|
||||||
|
(mx >= winRect.left + nonClientSize.left &&
|
||||||
|
mx <= winRect.right - nonClientSize.right &&
|
||||||
|
my >= winRect.top + nonClientSize.top &&
|
||||||
|
my <= winRect.bottom - nonClientSize.bottom);
|
||||||
|
|
||||||
|
// The border size. If there is no content under mouse cursor, the border
|
||||||
|
// size should be larger than the values in system settings. Otherwise,
|
||||||
|
// contents under the mouse cursor should be able to override the behavior.
|
||||||
|
// E.g., user must expect that Firefox button always opens the popup menu
|
||||||
|
// even when the user clicks on the above edge of it.
|
||||||
|
nsIntMargin borderSize(NS_MAX(nonClientSize.left, mHorResizeMargin),
|
||||||
|
NS_MAX(nonClientSize.top, mVertResizeMargin),
|
||||||
|
NS_MAX(nonClientSize.right, mHorResizeMargin),
|
||||||
|
NS_MAX(nonClientSize.bottom, mVertResizeMargin));
|
||||||
|
|
||||||
|
bool contentMayOverlap = false;
|
||||||
|
|
||||||
bool top = false;
|
bool top = false;
|
||||||
bool bottom = false;
|
bool bottom = false;
|
||||||
bool left = false;
|
bool left = false;
|
||||||
bool right = false;
|
bool right = false;
|
||||||
|
|
||||||
int topOffset = NS_MAX(mCaptionHeight - mNonClientOffset.top,
|
if (my >= winRect.top && my < winRect.top + borderSize.top) {
|
||||||
kResizableBorderMinSize);
|
|
||||||
int bottomOffset = NS_MAX(mVertResizeMargin - mNonClientOffset.bottom,
|
|
||||||
kResizableBorderMinSize);
|
|
||||||
int topBounds = winRect.top + topOffset;
|
|
||||||
int bottomBounds = winRect.bottom - bottomOffset;
|
|
||||||
|
|
||||||
if (my >= winRect.top && my < topBounds)
|
|
||||||
top = true;
|
top = true;
|
||||||
else if (my <= winRect.bottom && my > bottomBounds)
|
contentMayOverlap = (my >= winRect.top + nonClientSize.top);
|
||||||
|
} else if (my <= winRect.bottom && my > winRect.bottom - borderSize.bottom) {
|
||||||
bottom = true;
|
bottom = true;
|
||||||
|
contentMayOverlap = (my <= winRect.bottom - nonClientSize.bottom);
|
||||||
|
}
|
||||||
|
|
||||||
int leftOffset = NS_MAX(mHorResizeMargin - mNonClientOffset.left,
|
|
||||||
kResizableBorderMinSize);
|
|
||||||
int rightOffset = NS_MAX(mHorResizeMargin - mNonClientOffset.right,
|
|
||||||
kResizableBorderMinSize);
|
|
||||||
// (the 2x case here doubles the resize area for corners)
|
// (the 2x case here doubles the resize area for corners)
|
||||||
int leftBounds = winRect.left +
|
int multiplier = (top || bottom) ? 2 : 1;
|
||||||
(bottom ? (2*leftOffset) : leftOffset);
|
if (mx >= winRect.left &&
|
||||||
int rightBounds = winRect.right -
|
mx < winRect.left + (multiplier * borderSize.left)) {
|
||||||
(bottom ? (2*rightOffset) : rightOffset);
|
|
||||||
|
|
||||||
if (mx >= winRect.left && mx < leftBounds)
|
|
||||||
left = true;
|
left = true;
|
||||||
else if (mx <= winRect.right && mx > rightBounds)
|
contentMayOverlap =
|
||||||
|
contentMayOverlap || (mx >= winRect.left + nonClientSize.left);
|
||||||
|
} else if (mx <= winRect.right &&
|
||||||
|
mx > winRect.right - (multiplier * borderSize.right)) {
|
||||||
right = true;
|
right = true;
|
||||||
|
contentMayOverlap =
|
||||||
|
contentMayOverlap || (mx <= winRect.right - nonClientSize.right);
|
||||||
|
}
|
||||||
|
|
||||||
if (isResizable) {
|
if (isResizable) {
|
||||||
if (top) {
|
if (top) {
|
||||||
|
@ -5464,22 +5488,7 @@ nsWindow::ClientMarginHitTestPoint(PRInt32 mx, PRInt32 my)
|
||||||
testResult = HTBORDER;
|
testResult = HTBORDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool contentOverlap = true;
|
if (!sIsInMouseCapture && allowContentOverride && contentMayOverlap) {
|
||||||
|
|
||||||
if (mSizeMode != nsSizeMode_Maximized) {
|
|
||||||
contentOverlap = mx >= winRect.left + leftOffset &&
|
|
||||||
mx <= winRect.right - rightOffset &&
|
|
||||||
my >= winRect.top + topOffset &&
|
|
||||||
my <= winRect.bottom - bottomOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sIsInMouseCapture &&
|
|
||||||
contentOverlap &&
|
|
||||||
(testResult == HTCLIENT ||
|
|
||||||
testResult == HTTOP ||
|
|
||||||
testResult == HTBORDER ||
|
|
||||||
testResult == HTTOPLEFT ||
|
|
||||||
testResult == HTCAPTION)) {
|
|
||||||
LPARAM lParam = MAKELPARAM(mx, my);
|
LPARAM lParam = MAKELPARAM(mx, my);
|
||||||
LPARAM lParamClient = lParamToClient(lParam);
|
LPARAM lParamClient = lParamToClient(lParam);
|
||||||
bool result = DispatchMouseEvent(NS_MOUSE_MOZHITTEST, 0, lParamClient,
|
bool result = DispatchMouseEvent(NS_MOUSE_MOZHITTEST, 0, lParamClient,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче