зеркало из https://github.com/mozilla/gecko-dev.git
Added MakeSureSomethingIsSelected to the combobox so the ListBox can
call it after it is initialized.
This commit is contained in:
Родитель
c93837bf2a
Коммит
854e72dc25
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1488,7 +1488,9 @@ nsListControlFrame::Reset(nsIPresContext* aPresContext)
|
|||
}
|
||||
|
||||
InitSelectionCache(numOptions);
|
||||
|
||||
if (mComboboxFrame) {
|
||||
mComboboxFrame->MakeSureSomethingIsSelected(mPresContext);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -1488,7 +1488,9 @@ nsListControlFrame::Reset(nsIPresContext* aPresContext)
|
|||
}
|
||||
|
||||
InitSelectionCache(numOptions);
|
||||
|
||||
if (mComboboxFrame) {
|
||||
mComboboxFrame->MakeSureSomethingIsSelected(mPresContext);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
Загрузка…
Ссылка в новой задаче