diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp
index a3d7b5b3ac2..125031a9219 100644
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -2908,13 +2908,11 @@ nsGenericHTMLElement::ColorToString(const nsHTMLValue& aValue,
}
// static
-nsIFormControlFrame *
-nsGenericHTMLElement::GetFormControlFrameFor(nsIContent *aContent,
- nsIDocument *aDocument,
- PRBool aFlushContent)
+nsIFrame *
+nsGenericHTMLElement::GetPrimaryFrameFor(nsIContent* aContent,
+ nsIDocument* aDocument,
+ PRBool aFlushContent)
{
- nsIFormControlFrame *form_frame = nsnull;
-
if (aFlushContent) {
// Cause a flush of content, so we get up-to-date frame
// information
@@ -2928,13 +2926,26 @@ nsGenericHTMLElement::GetFormControlFrameFor(nsIContent *aContent,
if (presShell) {
nsIFrame *frame = nsnull;
presShell->GetPrimaryFrameFor(aContent, &frame);
-
- if (frame) {
- CallQueryInterface(frame, &form_frame);
- }
+ return frame;
}
- return form_frame;
+ return nsnull;
+}
+
+// static
+nsIFormControlFrame*
+nsGenericHTMLElement::GetFormControlFrameFor(nsIContent* aContent,
+ nsIDocument* aDocument,
+ PRBool aFlushContent)
+{
+ nsIFrame* frame = GetPrimaryFrameFor(aContent, aDocument, aFlushContent);
+ if (frame) {
+ nsIFormControlFrame* form_frame = nsnull;
+ CallQueryInterface(frame, &form_frame);
+ return form_frame;
+ }
+
+ return nsnull;
}
nsresult
diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h
index 204ebf84274..a31485c57cc 100644
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -208,15 +208,37 @@ public:
PRUint32 BaseSizeOf(nsISizeOfHandler* aSizer) const;
#endif
- nsIFormControlFrame *GetFormControlFrame(PRBool aFlushContent)
+ /**
+ * Get the primary form control frame for this content (see
+ * GetFormControlFrameFor)
+ *
+ * @param aFlushContent whether to flush the content sink
+ * @return the primary form control frame
+ */
+ nsIFormControlFrame* GetFormControlFrame(PRBool aFlushContent)
{
- if (!mDocument || !mParent) {
+ if (!mDocument) {
return nsnull;
}
return GetFormControlFrameFor(this, mDocument, aFlushContent);
}
+ /**
+ * Get the primary frame for this content (see GetPrimaryFrameFor)
+ *
+ * @param aFlushContent whether to flush the content sink
+ * @return the primary frame
+ */
+ nsIFrame* GetPrimaryFrame(PRBool aFlushContent)
+ {
+ if (!mDocument) {
+ return nsnull;
+ }
+
+ return GetPrimaryFrameFor(this, mDocument, aFlushContent);
+ }
+
//----------------------------------------
// Attribute parsing utilities
@@ -354,6 +376,29 @@ public:
static PRBool GetBackgroundAttributesImpact(const nsIAtom* aAttribute,
PRInt32& aHint);
+ /**
+ * Get the primary frame for a piece of content.
+ *
+ * @param aContent the content to get the primary frame for
+ * @param aDocument the document for this content
+ * @param aFlushContent whether to flush the content sink, which creates
+ * frames for content that do not already have it. EXPENSIVE.
+ * @return the primary frame
+ */
+ static nsIFrame* GetPrimaryFrameFor(nsIContent* aContent,
+ nsIDocument* aDocument,
+ PRBool aFlushContent);
+
+ /**
+ * Get the primary form control frame for a piece of content. Same as
+ * GetPrimaryFrameFor, except it QI's to nsIFormControlFrame.
+ *
+ * @param aContent the content to get the primary frame for
+ * @param aDocument the document for this content
+ * @param aFlushContent whether to flush the content sink, which creates
+ * frames for content that do not already have it. EXPENSIVE.
+ * @return the primary frame as nsIFormControlFrame
+ */
static nsIFormControlFrame* GetFormControlFrameFor(nsIContent* aContent,
nsIDocument* aDocument,
PRBool aFlushContent);
diff --git a/content/html/content/src/nsHTMLBodyElement.cpp b/content/html/content/src/nsHTMLBodyElement.cpp
index 591d758edb3..4b175cee324 100644
--- a/content/html/content/src/nsHTMLBodyElement.cpp
+++ b/content/html/content/src/nsHTMLBodyElement.cpp
@@ -565,6 +565,7 @@ nsHTMLBodyElement::GetBgColor(nsAString& aBgColor)
// If we don't have an attribute, find the actual color used for
// (generally from the user agent style sheet) for compatibility
if (rv == NS_CONTENT_ATTR_NOT_THERE) {
+ // XXX This should just use nsGenericHTMLElement::GetPrimaryFrame()
if (mDocument) {
// Make sure the presentation is up-to-date
rv = mDocument->FlushPendingNotifications();
diff --git a/content/html/content/src/nsHTMLImageElement.cpp b/content/html/content/src/nsHTMLImageElement.cpp
index 7a628c67874..fa3f1991bf7 100644
--- a/content/html/content/src/nsHTMLImageElement.cpp
+++ b/content/html/content/src/nsHTMLImageElement.cpp
@@ -287,35 +287,7 @@ nsHTMLImageElement::GetImageFrame(nsIImageFrame** aImageFrame)
NS_ENSURE_ARG_POINTER(aImageFrame);
*aImageFrame = nsnull;
- if (!mDocument) {
- return NS_OK;
- }
-
- // Make sure the presentation is up-to-date
- nsresult rv = mDocument->FlushPendingNotifications();
- if (NS_FAILED(rv)) {
- return rv;
- }
-
- nsCOMPtr shell;
- mDocument->GetShellAt(0, getter_AddRefs(shell));
-
- if (!shell) {
- return NS_OK;
- }
-
- nsCOMPtr context;
- rv = shell->GetPresContext(getter_AddRefs(context));
- if (!context) {
- return NS_OK;
- }
-
- nsIFrame* frame = nsnull;
- rv = shell->GetPrimaryFrameFor(this, &frame);
- if (!frame || NS_FAILED(rv)) {
- return rv;
- }
-
+ nsIFrame* frame = GetPrimaryFrame(PR_TRUE);
CallQueryInterface(frame, aImageFrame);
return NS_OK;
diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp
index 56e779f7b42..97e2e3feba1 100644
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -859,21 +859,7 @@ nsHTMLInputElement::SetCheckedInternal(PRBool aChecked)
//
// Notify the frame
//
- // If the document or parent is not there, don't even bother looking
- // for the frame. It won't (shouldn't) be there.
- if (!mDocument || !mParent) {
- return NS_OK;
- }
-
- // Get presentation shell 0
- nsCOMPtr presShell;
- mDocument->GetShellAt(0, getter_AddRefs(presShell));
- if (!presShell) {
- return NS_OK;
- }
-
- nsIFrame *frame = nsnull;
- presShell->GetPrimaryFrameFor(this, &frame);
+ nsIFrame* frame = GetPrimaryFrame(PR_FALSE);
if (!frame) {
return NS_OK;
}
diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp
index 1db66e30086..56fea01cbca 100644
--- a/content/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/content/html/content/src/nsHTMLTextAreaElement.cpp
@@ -146,10 +146,20 @@ public:
protected:
nsCOMPtr mControllers;
+ /** The current value. This is null if the frame owns the value. */
char* mValue;
+ /** Whether or not the value has changed since its default value was given. */
PRPackedBool mValueChanged;
NS_IMETHOD SelectAll(nsIPresContext* aPresContext);
+ /**
+ * Get the value, whether it is from the content or the frame.
+ * @param aValue the value [out]
+ * @param aIgnoreWrap whether to ignore the wrap attribute when getting the
+ * value. If this is true, linebreaks will not be inserted even if
+ * wrap=hard.
+ */
+ void GetValueInternal(nsAString& aValue, PRBool aIgnoreWrap);
};
nsresult
@@ -181,7 +191,7 @@ NS_NewHTMLTextAreaElement(nsIHTMLContent** aInstancePtrResult,
nsHTMLTextAreaElement::nsHTMLTextAreaElement()
{
- mValue = 0;
+ mValue = nsnull;
mValueChanged = PR_FALSE;
}
@@ -409,23 +419,29 @@ nsHTMLTextAreaElement::GetType(nsAString& aType)
NS_IMETHODIMP
nsHTMLTextAreaElement::GetValue(nsAString& aValue)
{
+ GetValueInternal(aValue, PR_TRUE);
+ return NS_OK;
+}
+
+void
+nsHTMLTextAreaElement::GetValueInternal(nsAString& aValue, PRBool aIgnoreWrap)
+{
+ // Get the frame.
// No need to flush here, if there is no frame yet for this textarea
// there won't be a value in it we don't already have even if we
// force the frame to be created.
- nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE);
-
+ nsIFrame* primaryFrame = GetPrimaryFrame(PR_FALSE);
nsIGfxTextControlFrame2* textControlFrame = nsnull;
- if (formControlFrame) {
- CallQueryInterface(formControlFrame, &textControlFrame);
- }
+ CallQueryInterface(primaryFrame, &textControlFrame);
+ // If the frame exists and owns the value, get it from the frame. Otherwise
+ // get it from content.
PRBool frameOwnsValue = PR_FALSE;
if (textControlFrame) {
textControlFrame->OwnsValue(&frameOwnsValue);
}
if (frameOwnsValue) {
- formControlFrame->GetProperty(nsHTMLAtoms::value, aValue);
- return NS_OK;
+ textControlFrame->GetValue(aValue, aIgnoreWrap);
} else {
if (!mValueChanged || !mValue) {
GetDefaultValue(aValue);
@@ -433,7 +449,6 @@ nsHTMLTextAreaElement::GetValue(nsAString& aValue)
aValue = NS_ConvertUTF8toUCS2(mValue);
}
}
- return NS_OK;
}
@@ -913,10 +928,7 @@ nsHTMLTextAreaElement::SubmitNamesValues(nsIFormSubmission* aFormSubmission,
// Get the value
//
nsAutoString value;
- rv = GetValue(value);
- if (NS_FAILED(rv)) {
- return rv;
- }
+ GetValueInternal(value, PR_FALSE);
//
// Submit
@@ -938,7 +950,7 @@ nsHTMLTextAreaElement::SaveState()
rv = GetPrimaryPresState(this, getter_AddRefs(state));
if (state) {
nsAutoString value;
- GetValue(value);
+ GetValueInternal(value, PR_TRUE);
rv = nsLinebreakConverter::ConvertStringLineBreaks(
value,
diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp
index 40a91cb243f..ebcbfd17078 100644
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -632,7 +632,7 @@ NS_IMETHODIMP nsFileControlFrame::SetProperty(nsIPresContext* aPresContext,
nsresult rv = NS_OK;
if (nsHTMLAtoms::value == aName) {
if (mTextFrame) {
- mTextFrame->SetTextControlFrameState(aValue);
+ mTextFrame->SetValue(aValue);
} else {
if (mCachedState) delete mCachedState;
mCachedState = new nsString(aValue);
@@ -648,7 +648,7 @@ NS_IMETHODIMP nsFileControlFrame::GetProperty(nsIAtom* aName, nsAString& aValue)
if (nsHTMLAtoms::value == aName) {
if (mTextFrame) {
- mTextFrame->GetTextControlFrameState(aValue);
+ mTextFrame->GetValue(aValue, PR_FALSE);
}
else if (mCachedState) {
aValue.Assign(*mCachedState);
diff --git a/layout/forms/nsITextControlFrame.h b/layout/forms/nsITextControlFrame.h
index dc57320441e..b59e05edd4a 100644
--- a/layout/forms/nsITextControlFrame.h
+++ b/layout/forms/nsITextControlFrame.h
@@ -53,7 +53,23 @@ public:
NS_IMETHOD GetEditor(nsIEditor **aEditor) = 0;
+ /**
+ * Tell whether the frame currently owns the value or the content does (for
+ * edge cases where the frame has just been created or is just going away).
+ *
+ * @param aOwnsValue whether the frame owns the value [out]
+ */
NS_IMETHOD OwnsValue(PRBool* aOwnsValue) = 0;
+
+ /**
+ * Get the current value, either from the editor or from the textarea.
+ *
+ * @param aValue the value [out]
+ * @param aIgnoreWrap whether to ignore the wrap attribute when getting the
+ * value. If this is true, linebreaks will not be inserted even if
+ * wrap=hard.
+ */
+ NS_IMETHOD GetValue(nsAString& aValue, PRBool aIgnoreWrap) = 0;
NS_IMETHOD GetTextLength(PRInt32* aTextLength) = 0;
diff --git a/layout/forms/nsIsIndexFrame.cpp b/layout/forms/nsIsIndexFrame.cpp
index 525617740cb..5ec3b30a680 100644
--- a/layout/forms/nsIsIndexFrame.cpp
+++ b/layout/forms/nsIsIndexFrame.cpp
@@ -193,7 +193,7 @@ nsIsIndexFrame::GetInputValue(nsIPresContext* aPresContext,
nsIFormControlFrame* frame = nsnull;
GetInputFrame(aPresContext, &frame);
if (frame) {
- ((nsNewFrame*)frame)->GetTextControlFrameState(oString);
+ ((nsNewFrame*)frame)->GetValue(oString, PR_FALSE);
}
return NS_OK;
}
@@ -205,7 +205,7 @@ nsIsIndexFrame::SetInputValue(nsIPresContext* aPresContext,
nsIFormControlFrame* frame = nsnull;
GetInputFrame(aPresContext, &frame);
if (frame) {
- ((nsNewFrame*)frame)->SetTextControlFrameState(aString);
+ ((nsNewFrame*)frame)->SetValue(aString);
}
return NS_OK;
}
diff --git a/layout/html/forms/public/nsIGfxTextControlFrame.h b/layout/html/forms/public/nsIGfxTextControlFrame.h
index dc57320441e..b59e05edd4a 100644
--- a/layout/html/forms/public/nsIGfxTextControlFrame.h
+++ b/layout/html/forms/public/nsIGfxTextControlFrame.h
@@ -53,7 +53,23 @@ public:
NS_IMETHOD GetEditor(nsIEditor **aEditor) = 0;
+ /**
+ * Tell whether the frame currently owns the value or the content does (for
+ * edge cases where the frame has just been created or is just going away).
+ *
+ * @param aOwnsValue whether the frame owns the value [out]
+ */
NS_IMETHOD OwnsValue(PRBool* aOwnsValue) = 0;
+
+ /**
+ * Get the current value, either from the editor or from the textarea.
+ *
+ * @param aValue the value [out]
+ * @param aIgnoreWrap whether to ignore the wrap attribute when getting the
+ * value. If this is true, linebreaks will not be inserted even if
+ * wrap=hard.
+ */
+ NS_IMETHOD GetValue(nsAString& aValue, PRBool aIgnoreWrap) = 0;
NS_IMETHOD GetTextLength(PRInt32* aTextLength) = 0;
diff --git a/layout/html/forms/public/nsITextControlFrame.h b/layout/html/forms/public/nsITextControlFrame.h
index dc57320441e..b59e05edd4a 100644
--- a/layout/html/forms/public/nsITextControlFrame.h
+++ b/layout/html/forms/public/nsITextControlFrame.h
@@ -53,7 +53,23 @@ public:
NS_IMETHOD GetEditor(nsIEditor **aEditor) = 0;
+ /**
+ * Tell whether the frame currently owns the value or the content does (for
+ * edge cases where the frame has just been created or is just going away).
+ *
+ * @param aOwnsValue whether the frame owns the value [out]
+ */
NS_IMETHOD OwnsValue(PRBool* aOwnsValue) = 0;
+
+ /**
+ * Get the current value, either from the editor or from the textarea.
+ *
+ * @param aValue the value [out]
+ * @param aIgnoreWrap whether to ignore the wrap attribute when getting the
+ * value. If this is true, linebreaks will not be inserted even if
+ * wrap=hard.
+ */
+ NS_IMETHOD GetValue(nsAString& aValue, PRBool aIgnoreWrap) = 0;
NS_IMETHOD GetTextLength(PRInt32* aTextLength) = 0;
diff --git a/layout/html/forms/src/nsFileControlFrame.cpp b/layout/html/forms/src/nsFileControlFrame.cpp
index 40a91cb243f..ebcbfd17078 100644
--- a/layout/html/forms/src/nsFileControlFrame.cpp
+++ b/layout/html/forms/src/nsFileControlFrame.cpp
@@ -632,7 +632,7 @@ NS_IMETHODIMP nsFileControlFrame::SetProperty(nsIPresContext* aPresContext,
nsresult rv = NS_OK;
if (nsHTMLAtoms::value == aName) {
if (mTextFrame) {
- mTextFrame->SetTextControlFrameState(aValue);
+ mTextFrame->SetValue(aValue);
} else {
if (mCachedState) delete mCachedState;
mCachedState = new nsString(aValue);
@@ -648,7 +648,7 @@ NS_IMETHODIMP nsFileControlFrame::GetProperty(nsIAtom* aName, nsAString& aValue)
if (nsHTMLAtoms::value == aName) {
if (mTextFrame) {
- mTextFrame->GetTextControlFrameState(aValue);
+ mTextFrame->GetValue(aValue, PR_FALSE);
}
else if (mCachedState) {
aValue.Assign(*mCachedState);
diff --git a/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/layout/html/forms/src/nsGfxTextControlFrame2.cpp
index e363179dddc..cf69e44f191 100644
--- a/layout/html/forms/src/nsGfxTextControlFrame2.cpp
+++ b/layout/html/forms/src/nsGfxTextControlFrame2.cpp
@@ -1423,14 +1423,14 @@ nsGfxTextControlFrame2::PreDestroy(nsIPresContext* aPresContext)
{
// First get the frame state from the editor
nsAutoString value;
- GetTextControlFrameState(value);
+ GetValue(value, PR_TRUE);
mUseEditor = PR_FALSE;
// Next store the frame state in the control
// (now that mUseEditor is false values get stored
// in content).
- SetTextControlFrameState(value);
+ SetValue(value);
}
mEditor->PreDestroy();
}
@@ -1836,7 +1836,7 @@ nsGfxTextControlFrame2::SetInitialValue()
// Get the current value of the textfield from the content.
nsAutoString defaultValue;
- GetTextControlFrameState(defaultValue);
+ GetValue(defaultValue, PR_TRUE);
// Turn on mUseEditor so that subsequent calls will use the
// editor.
@@ -1844,8 +1844,8 @@ nsGfxTextControlFrame2::SetInitialValue()
// If we have a default value, insert it under the div we created
// above, but be sure to use the editor so that '*' characters get
- // displayed for password fields, etc. SetTextControlFrameState()
- // will call the editor for us.
+ // displayed for password fields, etc. SetValue() will call the
+ // editor for us.
if (!defaultValue.IsEmpty()) {
PRUint32 editorFlags = 0;
@@ -1866,18 +1866,17 @@ nsGfxTextControlFrame2::SetInitialValue()
if (NS_FAILED(rv))
return rv;
- // Now call SetTextControlFrameState() which will make the
- // neccessary editor calls to set the default value.
- // Make sure to turn off undo before setting the default
- // value, and turn it back on afterwards. This will make
- // sure we can't undo past the default value.
+ // Now call SetValue() which will make the neccessary editor calls to set
+ // the default value. Make sure to turn off undo before setting the default
+ // value, and turn it back on afterwards. This will make sure we can't undo
+ // past the default value.
rv = mEditor->EnableUndo(PR_FALSE);
if (NS_FAILED(rv))
return rv;
- SetTextControlFrameState(defaultValue);
+ SetValue(defaultValue);
rv = mEditor->EnableUndo(PR_TRUE);
NS_ASSERTION(!rv,"Transaction Manager must have failed");
@@ -2584,7 +2583,7 @@ NS_IMETHODIMP nsGfxTextControlFrame2::SetProperty(nsIPresContext* aPresContext,
// has changed.
SetValueChanged(PR_TRUE);
}
- SetTextControlFrameState(aValue); // set new text value
+ SetValue(aValue); // set new text value
if (mEditor) {
mEditor->EnableUndo(PR_TRUE); // fire up a new txn stack
}
@@ -2599,13 +2598,14 @@ NS_IMETHODIMP nsGfxTextControlFrame2::SetProperty(nsIPresContext* aPresContext,
return NS_OK;
}
-NS_IMETHODIMP nsGfxTextControlFrame2::GetProperty(nsIAtom* aName, nsAString& aValue)
+NS_IMETHODIMP
+nsGfxTextControlFrame2::GetProperty(nsIAtom* aName, nsAString& aValue)
{
// Return the value of the property from the widget it is not null.
// If widget is null, assume the widget is GFX-rendered and return a member variable instead.
if (nsHTMLAtoms::value == aName) {
- GetTextControlFrameState(aValue);
+ GetValue(aValue, PR_FALSE);
}
return NS_OK;
}
@@ -2635,7 +2635,7 @@ nsGfxTextControlFrame2::GetTextLength(PRInt32* aTextLength)
NS_ENSURE_ARG_POINTER(aTextLength);
nsAutoString textContents;
- GetTextControlFrameState(textContents); // this is expensive!
+ GetValue(textContents, PR_FALSE); // this is expensive!
*aTextLength = textContents.Length();
return NS_OK;
}
@@ -3065,7 +3065,8 @@ nsGfxTextControlFrame2::GetText(nsString* aText)
PRInt32 type;
GetType(&type);
if ((NS_FORM_INPUT_TEXT == type) || (NS_FORM_INPUT_PASSWORD == type)) {
- GetTextControlFrameState(*aText);
+ // If we're going to remove newlines anyway, ignore the wrap property
+ GetValue(*aText, PR_TRUE);
RemoveNewlines(*aText);
} else {
nsCOMPtr textArea = do_QueryInterface(mContent);
@@ -3244,7 +3245,8 @@ nsGfxTextControlFrame2::CallOnChange()
//======
//privates
-void nsGfxTextControlFrame2::GetTextControlFrameState(nsAString& aValue)
+NS_IMETHODIMP
+nsGfxTextControlFrame2::GetValue(nsAString& aValue, PRBool aIgnoreWrap)
{
aValue.Truncate(); // initialize out param
@@ -3257,14 +3259,16 @@ void nsGfxTextControlFrame2::GetTextControlFrameState(nsAString& aValue)
flags |= nsIDocumentEncoder::OutputBodyOnly;
}
- nsFormControlHelper::nsHTMLTextWrap wrapProp;
- nsresult rv = nsFormControlHelper::GetWrapPropertyEnum(mContent, wrapProp);
flags |= nsIDocumentEncoder::OutputPreformatted;
- if (NS_CONTENT_ATTR_NOT_THERE != rv)
- {
- if (wrapProp == nsFormControlHelper::eHTMLTextWrap_Hard)
- {
- flags |= nsIDocumentEncoder::OutputWrap;
+
+ if (!aIgnoreWrap) {
+ nsFormControlHelper::nsHTMLTextWrap wrapProp;
+ nsresult rv = nsFormControlHelper::GetWrapPropertyEnum(mContent, wrapProp);
+ if (rv != NS_CONTENT_ATTR_NOT_THERE) {
+ if (wrapProp == nsFormControlHelper::eHTMLTextWrap_Hard)
+ {
+ flags |= nsIDocumentEncoder::OutputWrap;
+ }
}
}
@@ -3288,18 +3292,20 @@ void nsGfxTextControlFrame2::GetTextControlFrameState(nsAString& aValue)
}
}
}
+
+ return NS_OK;
}
// END IMPLEMENTING NS_IFORMCONTROLFRAME
void
-nsGfxTextControlFrame2::SetTextControlFrameState(const nsAString& aValue)
+nsGfxTextControlFrame2::SetValue(const nsAString& aValue)
{
if (mEditor && mUseEditor)
{
nsAutoString currentValue;
- GetTextControlFrameState(currentValue);
+ GetValue(currentValue, PR_FALSE);
if (IsSingleLineTextControl())
{
RemoveNewlines(currentValue);
diff --git a/layout/html/forms/src/nsGfxTextControlFrame2.h b/layout/html/forms/src/nsGfxTextControlFrame2.h
index 8813fd841be..6a37b0f7b86 100644
--- a/layout/html/forms/src/nsGfxTextControlFrame2.h
+++ b/layout/html/forms/src/nsGfxTextControlFrame2.h
@@ -116,9 +116,8 @@ public:
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,
nsISupportsArray& aChildList);
- // Utility methods to get and set current widget state
- void GetTextControlFrameState(nsAString& aValue);
- void SetTextControlFrameState(const nsAString& aValue);
+ // Utility methods to set current widget state
+ void SetValue(const nsAString& aValue);
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
nsIAtom* aListName,
nsIFrame* aChildList);
@@ -153,6 +152,7 @@ public:
NS_IMETHOD GetEditor(nsIEditor **aEditor);
NS_IMETHOD OwnsValue(PRBool* aOwnsValue);
+ NS_IMETHOD GetValue(nsAString& aValue, PRBool aIgnoreWrap);
NS_IMETHOD GetTextLength(PRInt32* aTextLength);
NS_IMETHOD SetSelectionStart(PRInt32 aSelectionStart);
NS_IMETHOD SetSelectionEnd(PRInt32 aSelectionEnd);
diff --git a/layout/html/forms/src/nsIsIndexFrame.cpp b/layout/html/forms/src/nsIsIndexFrame.cpp
index 525617740cb..5ec3b30a680 100644
--- a/layout/html/forms/src/nsIsIndexFrame.cpp
+++ b/layout/html/forms/src/nsIsIndexFrame.cpp
@@ -193,7 +193,7 @@ nsIsIndexFrame::GetInputValue(nsIPresContext* aPresContext,
nsIFormControlFrame* frame = nsnull;
GetInputFrame(aPresContext, &frame);
if (frame) {
- ((nsNewFrame*)frame)->GetTextControlFrameState(oString);
+ ((nsNewFrame*)frame)->GetValue(oString, PR_FALSE);
}
return NS_OK;
}
@@ -205,7 +205,7 @@ nsIsIndexFrame::SetInputValue(nsIPresContext* aPresContext,
nsIFormControlFrame* frame = nsnull;
GetInputFrame(aPresContext, &frame);
if (frame) {
- ((nsNewFrame*)frame)->SetTextControlFrameState(aString);
+ ((nsNewFrame*)frame)->SetValue(aString);
}
return NS_OK;
}