Bug 926019 - focus and blur an input element should not trigger change event if content hasn't changed. r=smaug

This commit is contained in:
Jessica Jong
2016-05-30 02:26:00 +02:00
parent 7713b548b2
commit d35a0b5292
2 changed files with 23 additions and 6 deletions

View File

@@ -3800,6 +3800,15 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
// We must cache type because mType may change during JS event (bug 2369)
aVisitor.mItemFlags |= mType;
if (aVisitor.mEvent->mMessage == eFocus &&
aVisitor.mEvent->IsTrusted() &&
MayFireChangeOnBlur() &&
// StartRangeThumbDrag already set mFocusedValue on 'mousedown' before
// we get the 'focus' event.
!mIsDraggingRange) {
GetValue(mFocusedValue);
}
// Fire onchange (if necessary), before we do the blur, bug 357684.
if (aVisitor.mEvent->mMessage == eBlur) {
// Experimental mobile types rely on the system UI to prevent users to not
@@ -4235,12 +4244,6 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
if (aVisitor.mEvent->mMessage == eFocus ||
aVisitor.mEvent->mMessage == eBlur) {
if (aVisitor.mEvent->mMessage == eFocus &&
MayFireChangeOnBlur() &&
!mIsDraggingRange) { // StartRangeThumbDrag already set mFocusedValue
GetValue(mFocusedValue);
}
if (aVisitor.mEvent->mMessage == eBlur) {
if (mIsDraggingRange) {
FinishRangeThumbDrag();