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
Родитель cabd0efab4
Коммит 5217fe6d78
7 изменённых файлов: 22 добавлений и 15 удалений

Просмотреть файл

@ -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