Added MakeSureSomethingIsSelected to the combobox so the ListBox can

call it after it is initialized.


git-svn-id: svn://10.0.0.236/trunk@53690 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rods%netscape.com
1999-11-16 22:47:23 +00:00
parent 7d32b5b957
commit 39c4cb7c9e
6 changed files with 14 additions and 10 deletions

View File

@@ -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;
}

View File

@@ -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.

View File

@@ -1488,7 +1488,9 @@ nsListControlFrame::Reset(nsIPresContext* aPresContext)
}
InitSelectionCache(numOptions);
if (mComboboxFrame) {
mComboboxFrame->MakeSureSomethingIsSelected(mPresContext);
}
}
//---------------------------------------------------------

View File

@@ -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;
}

View File

@@ -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.

View File

@@ -1488,7 +1488,9 @@ nsListControlFrame::Reset(nsIPresContext* aPresContext)
}
InitSelectionCache(numOptions);
if (mComboboxFrame) {
mComboboxFrame->MakeSureSomethingIsSelected(mPresContext);
}
}
//---------------------------------------------------------