зеркало из https://github.com/mozilla/pjs.git
Bug 212753. Make sure mouse capture is released when combobox popup is hidden. r+sr=bryner,a=mkaply
This commit is contained in:
Родитель
cabd0efab4
Коммит
5217fe6d78
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -394,7 +394,6 @@ protected:
|
|||
PRPackedBool mButtonDown;
|
||||
nscoord mMaxWidth;
|
||||
nscoord mMaxHeight;
|
||||
PRPackedBool mIsCapturingMouseEvents;
|
||||
PRInt32 mNumDisplayRows;
|
||||
|
||||
PRBool mIsAllContentHere;
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -394,7 +394,6 @@ protected:
|
|||
PRPackedBool mButtonDown;
|
||||
nscoord mMaxWidth;
|
||||
nscoord mMaxHeight;
|
||||
PRPackedBool mIsCapturingMouseEvents;
|
||||
PRInt32 mNumDisplayRows;
|
||||
|
||||
PRBool mIsAllContentHere;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче