From b4caa69a9ce7c491f96c4257204e288d2c8ea906 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 12 Jun 2024 19:42:16 +0200 Subject: [PATCH] [toolkit] Close autocomplete popup when window is resized. --- toolkit/components/satchel/nsFormFillController.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/toolkit/components/satchel/nsFormFillController.cpp b/toolkit/components/satchel/nsFormFillController.cpp index aac1870490..801af3287e 100644 --- a/toolkit/components/satchel/nsFormFillController.cpp +++ b/toolkit/components/satchel/nsFormFillController.cpp @@ -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 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