diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index 8960b950672..af9a8efc104 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -307,7 +307,7 @@ nsComboboxControlFrame::nsComboboxControlFrame(nsStyleContext* aContext) mInRedisplayText = PR_FALSE; - mRecentSelectedIndex = -1; + mRecentSelectedIndex = NS_SKIP_NOTIFY_INDEX; //Shrink the area around its contents //SetFlags(NS_BLOCK_SHRINK_WRAP); @@ -2007,7 +2007,7 @@ PRInt32 nsComboboxControlFrame::UpdateRecentIndex(PRInt32 aIndex) { PRInt32 index = mRecentSelectedIndex; - if (mRecentSelectedIndex == -1 || aIndex == -1) + if (mRecentSelectedIndex == NS_SKIP_NOTIFY_INDEX || aIndex == NS_SKIP_NOTIFY_INDEX) mRecentSelectedIndex = aIndex; return index; } diff --git a/mozilla/layout/forms/nsComboboxControlFrame.h b/mozilla/layout/forms/nsComboboxControlFrame.h index c0dd7f05308..80d900a424a 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.h +++ b/mozilla/layout/forms/nsComboboxControlFrame.h @@ -52,6 +52,9 @@ //#define DO_NEW_REFLOW #endif +//Mark used to indicate when onchange has been fired for current combobox item +#define NS_SKIP_NOTIFY_INDEX -2 + #include "nsAreaFrame.h" #include "nsIFormControlFrame.h" #include "nsIComboboxControlFrame.h" diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 70a4cdc0aa2..d62e4a48015 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -1977,8 +1977,8 @@ nsListControlFrame::FireOnChange() { if (mComboboxFrame) { // Return hit without changing anything - PRInt32 index = mComboboxFrame->UpdateRecentIndex(-1); - if (index == -1) + PRInt32 index = mComboboxFrame->UpdateRecentIndex(NS_SKIP_NOTIFY_INDEX); + if (index == NS_SKIP_NOTIFY_INDEX) return; // See if the selection actually changed @@ -2009,9 +2009,9 @@ NS_IMETHODIMP nsListControlFrame::OnSetSelectedIndex(PRInt32 aOldIndex, PRInt32 aNewIndex) { if (mComboboxFrame) { - // UpdateRecentIndex with -1, so that we won't fire an onchange + // UpdateRecentIndex with NS_SKIP_NOTIFY_INDEX, so that we won't fire an onchange // event for this setting of selectedIndex. - mComboboxFrame->UpdateRecentIndex(-1); + mComboboxFrame->UpdateRecentIndex(NS_SKIP_NOTIFY_INDEX); } ScrollToIndex(aNewIndex);