diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index 0e49df28d11..fbbca2a812a 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -192,7 +192,7 @@ nsComboboxControlFrame::IsSuccessful(nsIFormControlFrame* aSubmitter) // If nothing is selected, and we have options, select item 0 // This is a UI decision that goes against the HTML 4 spec. // See bugzilla bug 15841 for justification of this deviation. -nsresult +NS_IMETHODIMP nsComboboxControlFrame::MakeSureSomethingIsSelected(nsIPresContext* aPresContext) { nsIFormControlFrame* fcFrame = nsnull; @@ -210,7 +210,7 @@ nsComboboxControlFrame::MakeSureSomethingIsSelected(nsIPresContext* aPresContext rv = fcFrame->SetProperty(aPresContext, nsHTMLAtoms::selectedindex, "0"); mSelectedIndex = 0; } - // XXX UpdateSelection(PR_FALSE, PR_TRUE, mSelectedIndex); // Needed to reflow when removing last option + UpdateSelection(PR_FALSE, PR_TRUE, mSelectedIndex); // Needed to reflow when removing last option } // Don't NS_RELEASE fcFrame here as it isn't addRef'd in the QI (???) @@ -1113,7 +1113,7 @@ nsComboboxControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) // We should call MakeSureSomethingIsSelected here, but since it // it changes selection, which currently causes a reframe, and thus // deletes the frame out from under the caller, causing a crash. (Bug 17995) - // XXX BAD MakeSureSomethingIsSelected(aPresContext); + // XXX MakeSureSomethingIsSelected(aPresContext); return rv; } diff --git a/mozilla/layout/forms/nsComboboxControlFrame.h b/mozilla/layout/forms/nsComboboxControlFrame.h index 3d2d6cf7686..63cedddc925 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.h +++ b/mozilla/layout/forms/nsComboboxControlFrame.h @@ -203,7 +203,7 @@ protected: nsIFrame* GetButtonFrame(nsIPresContext& aPresContext); nsIFrame* GetDropdownFrame(); NS_IMETHOD ToggleList(nsIPresContext* aPresContext); - nsresult MakeSureSomethingIsSelected(nsIPresContext* aPresContext); // Default to option 0 + NS_IMETHOD MakeSureSomethingIsSelected(nsIPresContext* aPresContext); // Default to option 0 nsFrameList mPopupFrames; // additional named child list nsIPresContext* mPresContext; // XXX: Remove the need to cache the pres context. diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index b8793af033f..ceb49bef74a 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -1488,7 +1488,9 @@ nsListControlFrame::Reset(nsIPresContext* aPresContext) } InitSelectionCache(numOptions); - + if (mComboboxFrame) { + mComboboxFrame->MakeSureSomethingIsSelected(mPresContext); + } } //--------------------------------------------------------- diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index 0e49df28d11..fbbca2a812a 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -192,7 +192,7 @@ nsComboboxControlFrame::IsSuccessful(nsIFormControlFrame* aSubmitter) // If nothing is selected, and we have options, select item 0 // This is a UI decision that goes against the HTML 4 spec. // See bugzilla bug 15841 for justification of this deviation. -nsresult +NS_IMETHODIMP nsComboboxControlFrame::MakeSureSomethingIsSelected(nsIPresContext* aPresContext) { nsIFormControlFrame* fcFrame = nsnull; @@ -210,7 +210,7 @@ nsComboboxControlFrame::MakeSureSomethingIsSelected(nsIPresContext* aPresContext rv = fcFrame->SetProperty(aPresContext, nsHTMLAtoms::selectedindex, "0"); mSelectedIndex = 0; } - // XXX UpdateSelection(PR_FALSE, PR_TRUE, mSelectedIndex); // Needed to reflow when removing last option + UpdateSelection(PR_FALSE, PR_TRUE, mSelectedIndex); // Needed to reflow when removing last option } // Don't NS_RELEASE fcFrame here as it isn't addRef'd in the QI (???) @@ -1113,7 +1113,7 @@ nsComboboxControlFrame::AddOption(nsIPresContext* aPresContext, PRInt32 aIndex) // We should call MakeSureSomethingIsSelected here, but since it // it changes selection, which currently causes a reframe, and thus // deletes the frame out from under the caller, causing a crash. (Bug 17995) - // XXX BAD MakeSureSomethingIsSelected(aPresContext); + // XXX MakeSureSomethingIsSelected(aPresContext); return rv; } diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h index 3d2d6cf7686..63cedddc925 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.h +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.h @@ -203,7 +203,7 @@ protected: nsIFrame* GetButtonFrame(nsIPresContext& aPresContext); nsIFrame* GetDropdownFrame(); NS_IMETHOD ToggleList(nsIPresContext* aPresContext); - nsresult MakeSureSomethingIsSelected(nsIPresContext* aPresContext); // Default to option 0 + NS_IMETHOD MakeSureSomethingIsSelected(nsIPresContext* aPresContext); // Default to option 0 nsFrameList mPopupFrames; // additional named child list nsIPresContext* mPresContext; // XXX: Remove the need to cache the pres context. diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index b8793af033f..ceb49bef74a 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -1488,7 +1488,9 @@ nsListControlFrame::Reset(nsIPresContext* aPresContext) } InitSelectionCache(numOptions); - + if (mComboboxFrame) { + mComboboxFrame->MakeSureSomethingIsSelected(mPresContext); + } } //---------------------------------------------------------