Bug 1251634, release mouse capture when a context menu is opened, r=tn
authorNeil Deakin <neil@mozilla.com>
Wed, 04 May 2016 10:08:01 -0400
changeset 296104 594736cae3ad287d2c145a1a5463f55a868246da
parent 296103 fa8d527717fa2f01edaf958789a4d683b976dd90
child 296105 8c4cf92bea9117d656b5e2f669809aa7e02f2d3c
push id76189
push userneil@mozilla.com
push dateWed, 04 May 2016 14:10:05 +0000
treeherdermozilla-inbound@594736cae3ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1251634
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1251634, release mouse capture when a context menu is opened, r=tn
layout/xul/nsMenuPopupFrame.cpp
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -842,16 +842,21 @@ nsMenuPopupFrame::ShowPopup(bool aIsCont
   mIsContextMenu = aIsContextMenu;
 
   InvalidateFrameSubtree();
 
   if (mPopupState == ePopupShowing) {
     mPopupState = ePopupOpening;
     mIsOpenChanged = true;
 
+    // Clear mouse capture when a context menu is opened.
+    if (aIsContextMenu) {
+      nsIPresShell::SetCapturingContent(nullptr, 0);
+    }
+
     nsMenuFrame* menuFrame = do_QueryFrame(GetParent());
     if (menuFrame) {
       nsWeakFrame weakFrame(this);
       menuFrame->PopupOpened();
       if (!weakFrame.IsAlive())
         return;
     }