Bug 1396323 - Don't initialize HTMLInputElement editor for eVoidEvent. r=ehsan

Keyboard APZ dispatches an eVoidEvent to gather all event targets that a key event
would normally go to. This can sometimes trigger an HTMLInputElement to initialize its
editor, which can cause unnecessary DOM modifications.

MozReview-Commit-ID: 6EEttouVB81

--HG--
extra : rebase_source : e7ff9c50a13f43f66976e3f0294e3d1696b87169
This commit is contained in:
Ryan Hunt 2017-09-05 15:09:53 -05:00
Родитель 2e8b602108
Коммит 6ab1a5a3fc
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -3572,13 +3572,17 @@ HTMLInputElement::NeedToInitializeEditorForEvent(
// are lazily initialized. We don't need to initialize the control for
// certain types of events, because we know that those events are safe to be
// handled without the editor being initialized. These events include:
// mousein/move/out, overflow/underflow, and DOM mutation events.
// mousein/move/out, overflow/underflow, DOM mutation, and void events. Void
// events are dispatched frequently by async keyboard scrolling to focused
// elements, so it's important to handle them to prevent excessive DOM
// mutations.
if (!IsSingleLineTextControl(false) ||
aVisitor.mEvent->mClass == eMutationEventClass) {
return false;
}
switch (aVisitor.mEvent->mMessage) {
case eVoidEvent:
case eMouseMove:
case eMouseEnterIntoWidget:
case eMouseExitFromWidget: