diff --git a/mozilla/editor/idl/nsIPlaintextEditor.idl b/mozilla/editor/idl/nsIPlaintextEditor.idl index 8a3669f73e4..750a644b9a1 100644 --- a/mozilla/editor/idl/nsIPlaintextEditor.idl +++ b/mozilla/editor/idl/nsIPlaintextEditor.idl @@ -39,7 +39,7 @@ interface nsIDOMKeyEvent; -[scriptable, uuid(35d74f2b-3d03-43c5-8ace-9d90c3e31244)] +[scriptable, uuid(1480e196-0d5c-40cf-8563-ed8a33eabcf2)] interface nsIPlaintextEditor : nsISupports { @@ -89,6 +89,14 @@ interface nsIPlaintextEditor : nsISupports */ attribute long wrapWidth; + /** + * Similar to the setter for wrapWidth, but just sets the editor + * internal state without actually changing the content being edited + * to wrap at that column. This should only be used by callers who + * are sure that their content is already set up correctly. + */ + void setWrapColumn(in long aWrapColumn); + /** Get and set newline handling. * * Values are the constants defined above. diff --git a/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp b/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp index eb701524bff..797c0268a24 100644 --- a/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp @@ -980,7 +980,7 @@ static void CutStyle(const char* stylename, nsString& styleValue) NS_IMETHODIMP nsPlaintextEditor::SetWrapWidth(PRInt32 aWrapColumn) { - mWrapColumn = aWrapColumn; + SetWrapColumn(aWrapColumn); // Make sure we're a plaintext editor, otherwise we shouldn't // do the rest of this. @@ -1049,6 +1049,13 @@ nsPlaintextEditor::SetWrapWidth(PRInt32 aWrapColumn) return rootElement->SetAttribute(styleName, styleValue); } +NS_IMETHODIMP +nsPlaintextEditor::SetWrapColumn(PRInt32 aWrapColumn) +{ + mWrapColumn = aWrapColumn; + return NS_OK; +} + // // Get the newline handling for this editor // diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index a91fe7867c1..30de49b353b 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -1489,7 +1489,7 @@ nsTextControlFrame::CreateFrameFor(nsIContent* aContent) } } else { // Never wrap non-textareas - textEditor->SetWrapWidth(-1); + textEditor->SetWrapColumn(-1); } diff --git a/mozilla/layout/style/forms.css b/mozilla/layout/style/forms.css index 350ec1f1031..5829d477e15 100644 --- a/mozilla/layout/style/forms.css +++ b/mozilla/layout/style/forms.css @@ -96,7 +96,7 @@ input { } input > .anonymous-div { - white-space : nowrap; + white-space: pre; } textarea {