Bug 1838752: Handle other event types in DropMutationEvent,r=eeejay

This revision updates DropMutationEvent such that it handles other event
types besides REORDER, HIDE, and SHOW. If we somehow put a different event
type through this function (particularly an inner reorder, which indicates
a reorder event that's already been dropped), we should (and now do) handle
it more gracefully.

Differential Revision: https://phabricator.services.mozilla.com/D182218
This commit is contained in:
Nathan LaPre
2023-06-28 19:14:55 +00:00
parent 764bbf43f5
commit 58e974f65a

View File

@@ -297,7 +297,10 @@ bool NotificationController::QueueMutationEvent(AccTreeMutationEvent* aEvent) {
}
void NotificationController::DropMutationEvent(AccTreeMutationEvent* aEvent) {
if (aEvent->GetEventType() == nsIAccessibleEvent::EVENT_REORDER) {
const uint32_t eventType = aEvent->GetEventType();
MOZ_ASSERT(eventType != nsIAccessibleEvent::EVENT_INNER_REORDER,
"Inner reorder has already been dropped, cannot drop again");
if (eventType == nsIAccessibleEvent::EVENT_REORDER) {
// We don't fully drop reorder events, we just change them to inner reorder
// events.
AccReorderEvent* reorderEvent = downcast_accEvent(aEvent);
@@ -305,10 +308,11 @@ void NotificationController::DropMutationEvent(AccTreeMutationEvent* aEvent) {
MOZ_ASSERT(reorderEvent);
reorderEvent->SetInner();
return;
} else if (aEvent->GetEventType() == nsIAccessibleEvent::EVENT_SHOW) {
}
if (eventType == nsIAccessibleEvent::EVENT_SHOW) {
// unset the event bits since the event isn't being fired any more.
aEvent->GetAccessible()->SetShowEventTarget(false);
} else {
} else if (eventType == nsIAccessibleEvent::EVENT_HIDE) {
// unset the event bits since the event isn't being fired any more.
aEvent->GetAccessible()->SetHideEventTarget(false);
@@ -318,6 +322,8 @@ void NotificationController::DropMutationEvent(AccTreeMutationEvent* aEvent) {
if (hideEvent->NeedsShutdown()) {
mDocument->ShutdownChildrenInSubtree(aEvent->GetAccessible());
}
} else {
MOZ_ASSERT_UNREACHABLE("Mutation event has non-mutation event type");
}
// Do the work to splice the event out of the list.