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:
jst%mozilla.jstenback.com
2006-07-05 22:15:01 +00:00
parent caa74fdd61
commit e2f9b9dd68
2 changed files with 18 additions and 1 deletions

View File

@@ -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)