Fixed options to have their text stripped of junk and whitespace compressed before creating the widget

This commit is contained in:
kipp 1998-06-06 01:08:43 +00:00
parent f1a935eb02
commit dcc388075e

View File

@ -131,9 +131,11 @@ public:
virtual PRBool GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues,
nsString* aValues, nsString* aNames);
PRBool GetContent(nsString& aString) const;
virtual PRBool GetContent(nsString& aString) const;
void SetContent(const nsString& aValue);
virtual void SetContent(const nsString& aValue);
void CompressContent();
protected:
virtual ~nsOption();
@ -223,6 +225,7 @@ nsSelectFrame::GetDesiredSize(nsIPresContext* aPresContext,
PRInt32 numChildren = select->ChildCount();
for (int i = 0; i < numChildren; i++) {
nsOption* option = (nsOption*) select->ChildAt(i); // YYY this had better be an option
option->CompressContent();
nsString text;
if (PR_FALSE == option->GetContent(text)) {
continue;
@ -571,6 +574,14 @@ void nsOption::SetContent(const nsString& aString)
*mContent = aString;
}
void
nsOption::CompressContent()
{
if (nsnull != mContent) {
mContent->CompressWhitespace(PR_TRUE, PR_TRUE);
}
}
PRBool
nsOption::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues,
nsString* aValues, nsString* aNames)