Fixed the Onchange event, so it fires at the correct time.

Bug 62753 r=pollmann sr=attinasi
This commit is contained in:
rods%netscape.com 2001-04-09 12:08:40 +00:00
Родитель d04770c91b
Коммит e3a5513f79
8 изменённых файлов: 22 добавлений и 14 удалений

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

@ -1885,7 +1885,7 @@ nsComboboxControlFrame::GetDropDown(nsIFrame** aDropDownFrame)
}
NS_IMETHODIMP
nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate) // Added "aForceUpdate" for Bug 42661
nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate, PRBool aSendEvent) // Added "aForceUpdate" for Bug 42661
{
if (aPresContext == nsnull) {
aPresContext = mPresContext;
@ -1896,7 +1896,7 @@ nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext, PRBool aFo
PRInt32 indx;
mListControlFrame->GetSelectedIndex(&indx);
UpdateSelection(PR_TRUE, aForceUpdate, indx); // Added "aForceUpdate" for Bug 42661
UpdateSelection(aSendEvent, aForceUpdate, indx); // Added "aForceUpdate" for Bug 42661
return NS_OK;
}

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

@ -162,7 +162,7 @@ public:
NS_IMETHOD ShowDropDown(PRBool aDoDropDown);
NS_IMETHOD GetDropDown(nsIFrame** aDropDownFrame);
NS_IMETHOD SetDropDown(nsIFrame* aDropDownFrame);
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate);
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate, PRBool aSendEvent);
NS_IMETHOD UpdateSelection(PRBool aDoDispatchEvent, PRBool aForceUpdate, PRInt32 aNewIndex);
NS_IMETHOD AbsolutelyPositionDropDown();
NS_IMETHOD GetAbsoluteRect(nsRect* aRect);

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

@ -77,7 +77,7 @@ public:
* Notifies the Combobox the List was selected
*
*/
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate) = 0;
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate, PRBool aSendEvent) = 0;
/**
* Asks the Combobox to update the display frame

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

@ -2938,6 +2938,10 @@ nsListControlFrame::AboutToRollup()
// whatever it was before it was dropped down.
if (index != mSelectedIndex) {
ResetSelectedItem();
} else {
if (IsInDropDownMode() == PR_TRUE) {
mComboboxFrame->ListWasSelected(mPresContext, PR_TRUE, PR_TRUE);
}
}
}
return NS_OK;
@ -3089,7 +3093,7 @@ void nsListControlFrame::ResetSelectedItem()
if (mIsAllFramesHere) {
ToggleSelected(mSelectedIndexWhenPoppedDown);
if (IsInDropDownMode() == PR_TRUE) {
mComboboxFrame->ListWasSelected(mPresContext, PR_TRUE);
mComboboxFrame->ListWasSelected(mPresContext, PR_TRUE, PR_FALSE);
}
}
}
@ -3194,7 +3198,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
SetContentSelected(mSelectedIndex, PR_TRUE);
}
if (mComboboxFrame) {
mComboboxFrame->ListWasSelected(mPresContext, PR_FALSE);
mComboboxFrame->ListWasSelected(mPresContext, PR_FALSE, PR_TRUE);
}
mouseEvent->clickCount = 1;
} else {
@ -3828,7 +3832,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
if (IsInDropDownMode() == PR_TRUE) {
PRBool isDroppedDown;
mComboboxFrame->IsDroppedDown(&isDroppedDown);
mComboboxFrame->ListWasSelected(mPresContext, isDroppedDown);
mComboboxFrame->ListWasSelected(mPresContext, isDroppedDown, PR_TRUE);
} else {
UpdateSelection(PR_TRUE, PR_FALSE, mContent);
}

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

@ -77,7 +77,7 @@ public:
* Notifies the Combobox the List was selected
*
*/
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate) = 0;
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate, PRBool aSendEvent) = 0;
/**
* Asks the Combobox to update the display frame

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

@ -1885,7 +1885,7 @@ nsComboboxControlFrame::GetDropDown(nsIFrame** aDropDownFrame)
}
NS_IMETHODIMP
nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate) // Added "aForceUpdate" for Bug 42661
nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate, PRBool aSendEvent) // Added "aForceUpdate" for Bug 42661
{
if (aPresContext == nsnull) {
aPresContext = mPresContext;
@ -1896,7 +1896,7 @@ nsComboboxControlFrame::ListWasSelected(nsIPresContext* aPresContext, PRBool aFo
PRInt32 indx;
mListControlFrame->GetSelectedIndex(&indx);
UpdateSelection(PR_TRUE, aForceUpdate, indx); // Added "aForceUpdate" for Bug 42661
UpdateSelection(aSendEvent, aForceUpdate, indx); // Added "aForceUpdate" for Bug 42661
return NS_OK;
}

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

@ -162,7 +162,7 @@ public:
NS_IMETHOD ShowDropDown(PRBool aDoDropDown);
NS_IMETHOD GetDropDown(nsIFrame** aDropDownFrame);
NS_IMETHOD SetDropDown(nsIFrame* aDropDownFrame);
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate);
NS_IMETHOD ListWasSelected(nsIPresContext* aPresContext, PRBool aForceUpdate, PRBool aSendEvent);
NS_IMETHOD UpdateSelection(PRBool aDoDispatchEvent, PRBool aForceUpdate, PRInt32 aNewIndex);
NS_IMETHOD AbsolutelyPositionDropDown();
NS_IMETHOD GetAbsoluteRect(nsRect* aRect);

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

@ -2938,6 +2938,10 @@ nsListControlFrame::AboutToRollup()
// whatever it was before it was dropped down.
if (index != mSelectedIndex) {
ResetSelectedItem();
} else {
if (IsInDropDownMode() == PR_TRUE) {
mComboboxFrame->ListWasSelected(mPresContext, PR_TRUE, PR_TRUE);
}
}
}
return NS_OK;
@ -3089,7 +3093,7 @@ void nsListControlFrame::ResetSelectedItem()
if (mIsAllFramesHere) {
ToggleSelected(mSelectedIndexWhenPoppedDown);
if (IsInDropDownMode() == PR_TRUE) {
mComboboxFrame->ListWasSelected(mPresContext, PR_TRUE);
mComboboxFrame->ListWasSelected(mPresContext, PR_TRUE, PR_FALSE);
}
}
}
@ -3194,7 +3198,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
SetContentSelected(mSelectedIndex, PR_TRUE);
}
if (mComboboxFrame) {
mComboboxFrame->ListWasSelected(mPresContext, PR_FALSE);
mComboboxFrame->ListWasSelected(mPresContext, PR_FALSE, PR_TRUE);
}
mouseEvent->clickCount = 1;
} else {
@ -3828,7 +3832,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
if (IsInDropDownMode() == PR_TRUE) {
PRBool isDroppedDown;
mComboboxFrame->IsDroppedDown(&isDroppedDown);
mComboboxFrame->ListWasSelected(mPresContext, isDroppedDown);
mComboboxFrame->ListWasSelected(mPresContext, isDroppedDown, PR_TRUE);
} else {
UpdateSelection(PR_TRUE, PR_FALSE, mContent);
}