Bug 926976 - Give nsTextControlFrame::mUseEditor a more useful name. r=ehsan
authorJonathan Watt <jwatt@jwatt.org>
Wed, 16 Oct 2013 14:43:03 +0100
changeset 165713 1406ff031c196382bed11fe810d48f746daa3858
parent 165712 89600e65912368d6bf02974029b7bec611e8ee3b
child 165714 97e7c6a2b6a545835850cd4a13807bc443e15f7f
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs926976
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 926976 - Give nsTextControlFrame::mUseEditor a more useful name. r=ehsan
layout/forms/nsTextControlFrame.cpp
layout/forms/nsTextControlFrame.h
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -95,17 +95,17 @@ public:
 private:
   nsTextControlFrame &mFrame;
   bool mFirstEntry;
 };
 #endif
 
 nsTextControlFrame::nsTextControlFrame(nsIPresShell* aShell, nsStyleContext* aContext)
   : nsContainerFrame(aContext)
-  , mUseEditor(false)
+  , mEditorHasBeenInitialized(false)
   , mIsProcessing(false)
 #ifdef DEBUG
   , mInEditorInitialization(false)
 #endif
 {
 }
 
 nsTextControlFrame::~nsTextControlFrame()
@@ -248,19 +248,17 @@ nsTextControlFrame::EnsureEditorInitiali
   // PresShell listener which called FlushPendingNotifications()
   // during frame construction. This was causing other form controls
   // to display wrong values.  Additionally, calling this every time
   // a text frame control is instantiated means that we're effectively
   // instantiating the editor for all text fields, even if they
   // never get used.  So, now this method is being called lazily only
   // when we actually need an editor.
 
-  // Check if this method has been called already.
-  // If so, just return early.
-  if (mUseEditor)
+  if (mEditorHasBeenInitialized)
     return NS_OK;
 
   nsIDocument* doc = mContent->GetCurrentDoc();
   NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
 
   nsWeakFrame weakFrame(this);
 
   // Flush out content on our document.  Have to do this, because script
@@ -303,19 +301,19 @@ nsTextControlFrame::EnsureEditorInitiali
 
     // Create an editor for the frame, if one doesn't already exist
     nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
     NS_ASSERTION(txtCtrl, "Content not a text control element");
     nsresult rv = txtCtrl->CreateEditor();
     NS_ENSURE_SUCCESS(rv, rv);
     NS_ENSURE_STATE(weakFrame.IsAlive());
 
-    // Turn on mUseEditor so that subsequent calls will use the
+    // Set mEditorHasBeenInitialized so that subsequent calls will use the
     // editor.
-    mUseEditor = true;
+    mEditorHasBeenInitialized = true;
 
     // Set the selection to the beginning of the text field.
     if (weakFrame.IsAlive()) {
       SetSelectionEndPoints(0, 0);
     }
   }
   NS_ENSURE_STATE(weakFrame.IsAlive());
   return NS_OK;
@@ -1133,17 +1131,17 @@ nsTextControlFrame::AttributeChanged(int
     selCon->SetDisplaySelection(displaySelection);
     if (focused) {
       selCon->SetCaretEnabled(!hasAttr);
     }
     editor->SetFlags(flags);
     return NS_OK;
   }
 
-  if (!mUseEditor && nsGkAtoms::value == aAttribute) {
+  if (!mEditorHasBeenInitialized && nsGkAtoms::value == aAttribute) {
     UpdateValueDisplay(true);
     return NS_OK;
   }
 
   // Allow the base class to handle common attributes supported by all form
   // elements...
   return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
 }
@@ -1275,17 +1273,17 @@ nsTextControlFrame::UpdateValueDisplay(b
   if (!IsSingleLineTextControl()) // textareas don't use this
     return NS_OK;
 
   nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
   NS_ASSERTION(txtCtrl, "Content not a text control element");
   nsIContent* rootNode = txtCtrl->GetRootEditorNode();
 
   NS_PRECONDITION(rootNode, "Must have a div content\n");
-  NS_PRECONDITION(!mUseEditor,
+  NS_PRECONDITION(!mEditorHasBeenInitialized,
                   "Do not call this after editor has been initialized");
   NS_ASSERTION(!mUsePlaceholder || txtCtrl->GetPlaceholderNode(),
                "A placeholder div must exist");
 
   nsIContent *textContent = rootNode->GetChildAt(0);
   if (!textContent) {
     // Set up a textnode with our value
     nsRefPtr<nsTextNode> textNode =
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -296,17 +296,17 @@ private:
   nsresult GetRootNodeAndInitializeEditor(nsIDOMElement **aRootElement);
 
   void FinishedInitializer() {
     Properties().Delete(TextControlInitializer());
   }
 
 private:
   // these packed bools could instead use the high order bits on mState, saving 4 bytes 
-  bool mUseEditor;
+  bool mEditorHasBeenInitialized;
   bool mIsProcessing;
   // Keep track if we have asked a placeholder node creation.
   bool mUsePlaceholder;
 
 #ifdef DEBUG
   bool mInEditorInitialization;
   friend class EditorInitializerEntryTracker;
 #endif