Bug 1742333 - part 12: Make `EventListenerManager::AddEventListenerInternal()` handle "beforeinput" event with the `switch` r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D131767
This commit is contained in:
Masayuki Nakano 2021-11-26 20:00:42 +00:00
Родитель aa6aecff58
Коммит d5a715a624
1 изменённых файлов: 10 добавлений и 5 удалений

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

@ -396,6 +396,11 @@ void EventListenerManager::AddEventListenerInternal(
mMayHaveInputOrCompositionEventListener = true;
}
break;
case eEditorBeforeInput:
if (nsPIDOMWindowInner* window = GetInnerWindowForTarget()) {
window->SetHasBeforeInputEventListenersForTelemetry();
}
break;
case eSelectionChange:
mMayHaveSelectionChangeEventListener = true;
if (nsPIDOMWindowInner* window = GetInnerWindowForTarget()) {
@ -533,6 +538,10 @@ void EventListenerManager::AddEventListenerInternal(
nsPrintfCString("resolvedEventMessage=%s",
ToChar(resolvedEventMessage))
.get());
NS_ASSERTION(aTypeAtom != nsGkAtoms::onbeforeinput,
nsPrintfCString("resolvedEventMessage=%s",
ToChar(resolvedEventMessage))
.get());
NS_ASSERTION(aTypeAtom != nsGkAtoms::onselectionchange,
nsPrintfCString("resolvedEventMessage=%s",
ToChar(resolvedEventMessage))
@ -553,11 +562,7 @@ void EventListenerManager::AddEventListenerInternal(
nsPrintfCString("resolvedEventMessage=%s",
ToChar(resolvedEventMessage))
.get());
if (aTypeAtom == nsGkAtoms::onbeforeinput) {
if (nsPIDOMWindowInner* window = GetInnerWindowForTarget()) {
window->SetHasBeforeInputEventListenersForTelemetry();
}
} else if (aTypeAtom == nsGkAtoms::onoverflow) {
if (aTypeAtom == nsGkAtoms::onoverflow) {
if (nsPIDOMWindowInner* window = GetInnerWindowForTarget()) {
if (Document* doc = window->GetExtantDoc()) {
doc->SetUseCounter(eUseCounter_custom_onoverflow);