Bug 926976 - Give nsTextControlFrame::mUseEditor a more useful name. r=ehsan

This commit is contained in:
Jonathan Watt 2013-10-16 14:43:03 +01:00
parent dd1cb5d0bf
commit 1336b61695
2 changed files with 7 additions and 9 deletions

View File

@ -100,7 +100,7 @@ private:
nsTextControlFrame::nsTextControlFrame(nsIPresShell* aShell, nsStyleContext* aContext) nsTextControlFrame::nsTextControlFrame(nsIPresShell* aShell, nsStyleContext* aContext)
: nsContainerFrame(aContext) : nsContainerFrame(aContext)
, mUseEditor(false) , mEditorHasBeenInitialized(false)
, mIsProcessing(false) , mIsProcessing(false)
#ifdef DEBUG #ifdef DEBUG
, mInEditorInitialization(false) , mInEditorInitialization(false)
@ -253,9 +253,7 @@ nsTextControlFrame::EnsureEditorInitialized()
// never get used. So, now this method is being called lazily only // never get used. So, now this method is being called lazily only
// when we actually need an editor. // when we actually need an editor.
// Check if this method has been called already. if (mEditorHasBeenInitialized)
// If so, just return early.
if (mUseEditor)
return NS_OK; return NS_OK;
nsIDocument* doc = mContent->GetCurrentDoc(); nsIDocument* doc = mContent->GetCurrentDoc();
@ -308,9 +306,9 @@ nsTextControlFrame::EnsureEditorInitialized()
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_STATE(weakFrame.IsAlive()); 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. // editor.
mUseEditor = true; mEditorHasBeenInitialized = true;
// Set the selection to the beginning of the text field. // Set the selection to the beginning of the text field.
if (weakFrame.IsAlive()) { if (weakFrame.IsAlive()) {
@ -1138,7 +1136,7 @@ nsTextControlFrame::AttributeChanged(int32_t aNameSpaceID,
return NS_OK; return NS_OK;
} }
if (!mUseEditor && nsGkAtoms::value == aAttribute) { if (!mEditorHasBeenInitialized && nsGkAtoms::value == aAttribute) {
UpdateValueDisplay(true); UpdateValueDisplay(true);
return NS_OK; return NS_OK;
} }
@ -1280,7 +1278,7 @@ nsTextControlFrame::UpdateValueDisplay(bool aNotify,
nsIContent* rootNode = txtCtrl->GetRootEditorNode(); nsIContent* rootNode = txtCtrl->GetRootEditorNode();
NS_PRECONDITION(rootNode, "Must have a div content\n"); NS_PRECONDITION(rootNode, "Must have a div content\n");
NS_PRECONDITION(!mUseEditor, NS_PRECONDITION(!mEditorHasBeenInitialized,
"Do not call this after editor has been initialized"); "Do not call this after editor has been initialized");
NS_ASSERTION(!mUsePlaceholder || txtCtrl->GetPlaceholderNode(), NS_ASSERTION(!mUsePlaceholder || txtCtrl->GetPlaceholderNode(),
"A placeholder div must exist"); "A placeholder div must exist");

View File

@ -301,7 +301,7 @@ private:
private: private:
// these packed bools could instead use the high order bits on mState, saving 4 bytes // these packed bools could instead use the high order bits on mState, saving 4 bytes
bool mUseEditor; bool mEditorHasBeenInitialized;
bool mIsProcessing; bool mIsProcessing;
// Keep track if we have asked a placeholder node creation. // Keep track if we have asked a placeholder node creation.
bool mUsePlaceholder; bool mUsePlaceholder;