Bug 1301306 - Stop focus events from anon. content when moving inside input=time element. r=smaug

This commit is contained in:
Jessica Jong
2016-11-04 00:47:00 -04:00
parent 24f074f01e
commit f0bd2cc848
4 changed files with 119 additions and 1 deletions

View File

@@ -4087,6 +4087,26 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
}
}
// Stop the event if the related target's first non-native ancestor is the
// same as the original target's first non-native ancestor (we are moving
// inside of the same element).
if (mType == NS_FORM_INPUT_TIME && !IsExperimentalMobileType(mType) &&
(aVisitor.mEvent->mMessage == eFocus ||
aVisitor.mEvent->mMessage == eFocusIn ||
aVisitor.mEvent->mMessage == eFocusOut ||
aVisitor.mEvent->mMessage == eBlur)) {
nsCOMPtr<nsIContent> originalTarget =
do_QueryInterface(aVisitor.mEvent->AsFocusEvent()->mRelatedTarget);
nsCOMPtr<nsIContent> relatedTarget =
do_QueryInterface(aVisitor.mEvent->AsFocusEvent()->mRelatedTarget);
if (originalTarget && relatedTarget &&
originalTarget->FindFirstNonChromeOnlyAccessContent() ==
relatedTarget->FindFirstNonChromeOnlyAccessContent()) {
aVisitor.mCanHandle = false;
}
}
return rv;
}