Bug 9136: Combobox selectedIndex now defaults to 0 instead of -1

This commit is contained in:
pollmann%netscape.com 1999-09-17 07:22:23 +00:00
Родитель 652575941e
Коммит 75c5f6cbbc
2 изменённых файлов: 8 добавлений и 2 удалений

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

@ -1587,7 +1587,7 @@ nsListControlFrame::AddOption(PRInt32 aIndex)
if (1 == numOptions || mSelectedIndex == kNothingSelected || selectedIndex != mSelectedIndex) {
mSelectedIndex = selectedIndex;
if (nsnull != mComboboxFrame) {
if (mComboboxFrame) {
mComboboxFrame->UpdateSelection(PR_FALSE, PR_TRUE, selectedIndex); // don't dispatch event
}
} else {
@ -1705,6 +1705,9 @@ nsListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue)
// figures out the first selected item from the content
PRInt32 selectedIndex;
GetSelectedIndexFromDOM(&selectedIndex);
if ((kNothingSelected == selectedIndex) && (mComboboxFrame)) {
selectedIndex = 0;
}
aValue.Append(selectedIndex, 10);
//aValue.Append(mSelectedIndex, 10);

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

@ -1587,7 +1587,7 @@ nsListControlFrame::AddOption(PRInt32 aIndex)
if (1 == numOptions || mSelectedIndex == kNothingSelected || selectedIndex != mSelectedIndex) {
mSelectedIndex = selectedIndex;
if (nsnull != mComboboxFrame) {
if (mComboboxFrame) {
mComboboxFrame->UpdateSelection(PR_FALSE, PR_TRUE, selectedIndex); // don't dispatch event
}
} else {
@ -1705,6 +1705,9 @@ nsListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue)
// figures out the first selected item from the content
PRInt32 selectedIndex;
GetSelectedIndexFromDOM(&selectedIndex);
if ((kNothingSelected == selectedIndex) && (mComboboxFrame)) {
selectedIndex = 0;
}
aValue.Append(selectedIndex, 10);
//aValue.Append(mSelectedIndex, 10);