Fixing bug 313337. Make input control onchange events only fire when the change is made by the user, not by script. r=bzbarsky@mit.edu, sr=bugmail@sicking.cc
git-svn-id: svn://10.0.0.236/trunk@201614 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -315,6 +315,8 @@ nsTextInputListener::Focus(nsIDOMEvent* aEvent)
|
||||
editor->AddEditorObserver(this);
|
||||
}
|
||||
|
||||
mFrame->SetHasFocus(PR_TRUE);
|
||||
|
||||
return mFrame->InitFocusedValue();
|
||||
}
|
||||
|
||||
@@ -330,6 +332,8 @@ nsTextInputListener::Blur(nsIDOMEvent* aEvent)
|
||||
editor->RemoveEditorObserver(this);
|
||||
}
|
||||
|
||||
mFrame->SetHasFocus(PR_FALSE);
|
||||
|
||||
return mFrame->CheckFireOnChange();
|
||||
}
|
||||
|
||||
@@ -988,6 +992,7 @@ nsTextControlFrame::nsTextControlFrame(nsIPresShell* aShell, nsStyleContext* aCo
|
||||
mNotifyOnInput = PR_TRUE;
|
||||
mScrollableView = nsnull;
|
||||
mDidPreDestroy = PR_FALSE;
|
||||
mHasFocus = PR_FALSE;
|
||||
|
||||
#ifdef DEBUG
|
||||
mCreateFrameForCalled = PR_FALSE;
|
||||
@@ -2795,6 +2800,12 @@ nsTextControlFrame::SetValue(const nsAString& aValue)
|
||||
|
||||
if (outerTransaction)
|
||||
mNotifyOnInput = PR_TRUE;
|
||||
|
||||
if (mHasFocus) {
|
||||
// Since this code doesn't handle user-generated changes, reset
|
||||
// mFocusedValue so the onchange event doesn't fire incorrectly.
|
||||
InitFocusedValue();
|
||||
}
|
||||
}
|
||||
|
||||
if (mScrollableView)
|
||||
|
||||
Reference in New Issue
Block a user