diff --git a/layout/html/forms/src/nsSelect.cpp b/layout/html/forms/src/nsSelect.cpp index 3b76b0e564f..9fc1be4ce42 100644 --- a/layout/html/forms/src/nsSelect.cpp +++ b/layout/html/forms/src/nsSelect.cpp @@ -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)