[toolkit] Close autocomplete popup when window is resized.

This commit is contained in:
Moonchild 2024-06-12 19:42:16 +02:00 committed by roytam1
commit b4caa69a9c

View file

@ -919,6 +919,11 @@ nsFormFillController::HandleEvent(nsIDOMEvent* aEvent)
mFocusedPopup->ClosePopup();
return NS_OK;
}
if (type.EqualsLiteral("resize")) {
if (mFocusedPopup)
mFocusedPopup->ClosePopup();
return NS_OK;
}
if (type.EqualsLiteral("pagehide")) {
nsCOMPtr<nsIDocument> doc = do_QueryInterface(
@ -1213,6 +1218,8 @@ nsFormFillController::AddWindowListeners(nsPIDOMWindowOuter* aWindow)
TrustedEventsAtCapture());
elm->AddEventListenerByType(this, NS_LITERAL_STRING("contextmenu"),
TrustedEventsAtCapture());
elm->AddEventListenerByType(this, NS_LITERAL_STRING("resize"),
TrustedEventsAtCapture());
// Note that any additional listeners added should ensure that they ignore
// untrusted events, which might be sent by content that's up to no good.
@ -1257,6 +1264,8 @@ nsFormFillController::RemoveWindowListeners(nsPIDOMWindowOuter* aWindow)
TrustedEventsAtCapture());
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("contextmenu"),
TrustedEventsAtCapture());
elm->RemoveEventListenerByType(this, NS_LITERAL_STRING("resize"),
TrustedEventsAtCapture());
}
void