Bug 1445131 - When testing the event's position against the window's draggable region, read the position when it's still in the correct coordinate space. r?spohl
MozReview-Commit-ID: HqnXgIjDWrW
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -4587,22 +4587,25 @@ NSEvent* gLastDragMouseDownEvent = nil;
WidgetMouseEvent geckoEvent(true, eMouseUp, mGeckoChild,
WidgetMouseEvent::eReal);
[self convertCocoaMouseEvent:theEvent toGeckoEvent:&geckoEvent];
if ([theEvent modifierFlags] & NSControlKeyMask)
geckoEvent.button = WidgetMouseEvent::eRightButton;
else
geckoEvent.button = WidgetMouseEvent::eLeftButton;
+ // Remember the event's position before calling DispatchInputEvent, because
+ // that call can mutate it and convert it into a different coordinate space.
+ LayoutDeviceIntPoint pos = geckoEvent.mRefPoint;
+
// This might destroy our widget (and null out mGeckoChild).
bool defaultPrevented =
(mGeckoChild->DispatchInputEvent(&geckoEvent) == nsEventStatus_eConsumeNoDefault);
// Check to see if we are double-clicking in draggable parts of the window.
- LayoutDeviceIntPoint pos = geckoEvent.mRefPoint;
if (!defaultPrevented && [theEvent clickCount] == 2 &&
!mGeckoChild->GetNonDraggableRegion().Contains(pos.x, pos.y)) {
if ([self shouldZoomOnDoubleClick]) {
[[self window] performZoom:nil];
} else if ([self shouldMinimizeOnTitlebarDoubleClick]) {
NSButton *minimizeButton = [[self window] standardWindowButton:NSWindowMiniaturizeButton];
[minimizeButton performClick:self];
}