Bug 1401195 - Make double-clicking draggable parts of the window always do the titlebar-double-click action, regardless of whether the click targeted the titlebar or some other draggable element. r?spohl draft
authorMarkus Stange <mstange@themasta.com>
Fri, 09 Mar 2018 14:41:50 -0500
changeset 765430 f77e2ea878be01fdf911aaf2836cf74f6edbb55a
parent 765429 6d91d0cc7d61af160b2ccd340adf23cb41389eed
child 766093 863744e872d538bc4c1c31270f0df5ed22849446
child 766094 158b64395bc05e65ff3d6adca8bb079d3ed722bc
push id102071
push userbmo:mstange@themasta.com
push dateFri, 09 Mar 2018 19:42:25 +0000
reviewersspohl
bugs1401195
milestone60.0a1
Bug 1401195 - Make double-clicking draggable parts of the window always do the titlebar-double-click action, regardless of whether the click targeted the titlebar or some other draggable element. r?spohl In the past there were cases where treating double click behavior differently from draggability was necessary, but there don't seem to exist such cases any more. For example, we don't have any windows with bottom bars / draggable status bars any more. This change simplifies the code and frees the frontend from having to use special -moz-appearance values to indicate titlebary parts of the window. MozReview-Commit-ID: IRe3FPU2EaT
widget/cocoa/nsChildView.mm
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -4591,24 +4591,20 @@ NSEvent* gLastDragMouseDownEvent = nil;
     geckoEvent.button = WidgetMouseEvent::eRightButton;
   else
     geckoEvent.button = WidgetMouseEvent::eLeftButton;
 
   // 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 the titlebar.
-  CGFloat locationInTitlebar = [[self window] frame].size.height - [theEvent locationInWindow].y;
+  // 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) &&
-      [[self window] isKindOfClass:[ToolbarWindow class]] &&
-      (locationInTitlebar < [(ToolbarWindow*)[self window] titlebarHeight] ||
-       locationInTitlebar < [(ToolbarWindow*)[self window] unifiedToolbarHeight])) {
+      !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];
     }
   }