Bug 1014246 - Don't drop the newline handling preference for the editor on the floor when it gets reinitialized. r=roc, a=lsblakk
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 22 May 2014 18:06:44 -0400
changeset 199346 32cfaa06b5a4866e048ae9735c13fa10fc63ef17
parent 199345 18bd62a3aa7a8003ebebd8fa145e4268a410ff49
child 199347 bf098f063410fca4c58586d7878855129be05cfe
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, lsblakk
bugs1014246
milestone31.0a2
Bug 1014246 - Don't drop the newline handling preference for the editor on the floor when it gets reinitialized. r=roc, a=lsblakk
editor/libeditor/text/nsPlaintextEditor.cpp
--- a/editor/libeditor/text/nsPlaintextEditor.cpp
+++ b/editor/libeditor/text/nsPlaintextEditor.cpp
@@ -75,17 +75,20 @@ nsPlaintextEditor::nsPlaintextEditor()
 , mInitTriggerCounter(0)
 , mNewlineHandling(nsIPlaintextEditor::eNewlinesPasteToFirst)
 #ifdef XP_WIN
 , mCaretStyle(1)
 #else
 , mCaretStyle(0)
 #endif
 {
-} 
+  // check the "single line editor newline handling"
+  // and "caret behaviour in selection" prefs
+  GetDefaultEditorPrefs(mNewlineHandling, mCaretStyle);
+}
 
 nsPlaintextEditor::~nsPlaintextEditor()
 {
   // Remove event listeners. Note that if we had an HTML editor,
   //  it installed its own instead of these
   RemoveEventListeners();
 
   if (mRules)
@@ -130,20 +133,16 @@ NS_IMETHODIMP nsPlaintextEditor::Init(ns
   {
     // block to scope nsAutoEditInitRulesTrigger
     nsAutoEditInitRulesTrigger rulesTrigger(this, rulesRes);
   
     // Init the base editor
     res = nsEditor::Init(aDoc, aRoot, aSelCon, aFlags, aInitialValue);
   }
 
-  // check the "single line editor newline handling"
-  // and "caret behaviour in selection" prefs
-  GetDefaultEditorPrefs(mNewlineHandling, mCaretStyle);
-
   NS_ENSURE_SUCCESS(rulesRes, rulesRes);
 
   // mRules may not have been initialized yet, when this is called via
   // nsHTMLEditor::Init.
   if (mRules) {
     mRules->SetInitialValue(aInitialValue);
   }