From fa72d3b1b18be628821f2db6cc00e302de6188d4 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Tue, 22 Mar 2011 17:42:45 -0400 Subject: [PATCH] Back out changeset 905ba2a1095a (bug 597525) because it breaks accessibility tests --- content/html/content/src/nsHTMLTextAreaElement.cpp | 3 +++ content/html/content/src/nsTextEditorState.cpp | 4 +++- content/html/content/src/nsTextEditorState.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index ccd8511de8e..a3202bffe9a 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -593,6 +593,9 @@ nsHTMLTextAreaElement::SetValueChanged(PRBool aValueChanged) PRBool previousValue = mValueChanged; mValueChanged = aValueChanged; + if (!aValueChanged && !mState->IsEmpty()) { + mState->EmptyValue(); + } if (mValueChanged != previousValue) { nsEventStates states = NS_EVENT_STATE_MOZ_UI_VALID | diff --git a/content/html/content/src/nsTextEditorState.cpp b/content/html/content/src/nsTextEditorState.cpp index c5990505abd..c2034f08c8a 100644 --- a/content/html/content/src/nsTextEditorState.cpp +++ b/content/html/content/src/nsTextEditorState.cpp @@ -1718,7 +1718,9 @@ nsTextEditorState::GetValue(nsAString& aValue, PRBool aIgnoreWrap) const mCachedValue.Truncate(); } } else { - if (mValue) { + if (!mTextCtrlElement->ValueChanged() || !mValue) { + mTextCtrlElement->GetDefaultValueFromContent(aValue); + } else { aValue = NS_ConvertUTF8toUTF16(*mValue); } } diff --git a/content/html/content/src/nsTextEditorState.h b/content/html/content/src/nsTextEditorState.h index 0ac4a805f9c..e97154c5f7f 100644 --- a/content/html/content/src/nsTextEditorState.h +++ b/content/html/content/src/nsTextEditorState.h @@ -158,6 +158,8 @@ public: void SetValue(const nsAString& aValue, PRBool aUserInput); void GetValue(nsAString& aValue, PRBool aIgnoreWrap) const; + void EmptyValue() { if (mValue) mValue->Truncate(); } + PRBool IsEmpty() const { return mValue ? mValue->IsEmpty() : PR_TRUE; } nsresult CreatePlaceholderNode();