Bug 212753. Make sure mouse capture is released when combobox popup is hidden. r+sr=bryner,a=mkaply

This commit is contained in:
roc+%cs.cmu.edu 2003-09-02 15:21:13 +00:00
parent 6e967acb16
commit ec0c023645
7 changed files with 22 additions and 15 deletions

View File

@ -629,7 +629,7 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList)
presShell->FlushPendingNotifications(PR_FALSE);
if (widget)
widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, PR_TRUE);
widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, aShowList);
}

View File

@ -398,7 +398,6 @@ nsListControlFrame::nsListControlFrame(nsIPresShell* aShell,
mMaxWidth = 0;
mMaxHeight = 0;
mPresContext = nsnull;
mIsCapturingMouseEvents = PR_FALSE;
mIsAllContentHere = PR_FALSE;
mIsAllFramesHere = PR_FALSE;
@ -1659,18 +1658,24 @@ nsListControlFrame::CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGra
// It's not clear why we don't have the widget capture mouse events here.
if (aGrabMouseEvents) {
viewMan->GrabMouseEvents(view, result);
mIsCapturingMouseEvents = PR_TRUE;
} else {
nsIView* curGrabber;
viewMan->GetMouseEventGrabber(curGrabber);
if (curGrabber == view) {
PRBool dropDownIsHidden = PR_FALSE;
if (IsInDropDownMode()) {
PRBool isDroppedDown;
mComboboxFrame->IsDroppedDown(&isDroppedDown);
dropDownIsHidden = !isDroppedDown;
}
if (curGrabber == view || dropDownIsHidden) {
// only unset the grabber if *we* are the ones doing the grabbing
// (or if the dropdown is hidden, in which case NO-ONE should be
// grabbing anything
// it could be a scrollbar inside this listbox which is actually grabbing
// This shouldn't be necessary. We should simply ensure that events targeting
// scrollbars are never visible to DOM consumers.
viewMan->GrabMouseEvents(nsnull,result);
viewMan->GrabMouseEvents(nsnull, result);
}
mIsCapturingMouseEvents = PR_FALSE;
}
}

View File

@ -394,7 +394,6 @@ protected:
PRPackedBool mButtonDown;
nscoord mMaxWidth;
nscoord mMaxHeight;
PRPackedBool mIsCapturingMouseEvents;
PRInt32 mNumDisplayRows;
PRBool mIsAllContentHere;

View File

@ -629,7 +629,7 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList)
presShell->FlushPendingNotifications(PR_FALSE);
if (widget)
widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, PR_TRUE);
widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, aShowList);
}

View File

@ -398,7 +398,6 @@ nsListControlFrame::nsListControlFrame(nsIPresShell* aShell,
mMaxWidth = 0;
mMaxHeight = 0;
mPresContext = nsnull;
mIsCapturingMouseEvents = PR_FALSE;
mIsAllContentHere = PR_FALSE;
mIsAllFramesHere = PR_FALSE;
@ -1659,18 +1658,24 @@ nsListControlFrame::CaptureMouseEvents(nsIPresContext* aPresContext, PRBool aGra
// It's not clear why we don't have the widget capture mouse events here.
if (aGrabMouseEvents) {
viewMan->GrabMouseEvents(view, result);
mIsCapturingMouseEvents = PR_TRUE;
} else {
nsIView* curGrabber;
viewMan->GetMouseEventGrabber(curGrabber);
if (curGrabber == view) {
PRBool dropDownIsHidden = PR_FALSE;
if (IsInDropDownMode()) {
PRBool isDroppedDown;
mComboboxFrame->IsDroppedDown(&isDroppedDown);
dropDownIsHidden = !isDroppedDown;
}
if (curGrabber == view || dropDownIsHidden) {
// only unset the grabber if *we* are the ones doing the grabbing
// (or if the dropdown is hidden, in which case NO-ONE should be
// grabbing anything
// it could be a scrollbar inside this listbox which is actually grabbing
// This shouldn't be necessary. We should simply ensure that events targeting
// scrollbars are never visible to DOM consumers.
viewMan->GrabMouseEvents(nsnull,result);
viewMan->GrabMouseEvents(nsnull, result);
}
mIsCapturingMouseEvents = PR_FALSE;
}
}

View File

@ -394,7 +394,6 @@ protected:
PRPackedBool mButtonDown;
nscoord mMaxWidth;
nscoord mMaxHeight;
PRPackedBool mIsCapturingMouseEvents;
PRInt32 mNumDisplayRows;
PRBool mIsAllContentHere;

View File

@ -214,7 +214,6 @@ protected:
nsIMenuFrame* mCurrentMenu; // The current menu that is active.
PRBool mIsCapturingMouseEvents; // Whether or not we're grabbing the mouse events.
// XXX Hack
nsIPresContext* mPresContext; // weak reference