Skip to content
Snippets Groups Projects
Commit f1854f24 authored by Markus Stange's avatar Markus Stange
Browse files

Bug 1704682 - Call OnMenuOpened before dispatching the popupshown event. r=harry

This will cause nsXULPopupManager to change the state to "open" before the
popupshown event fires. This is consistent with non-native menus.

This was caught by dom/html/test/browser_content_contextmenu_userinput.js.

Differential Revision: https://phabricator.services.mozilla.com/D111766
parent 7949bc6a
No related branches found
No related tags found
No related merge requests found
...@@ -411,17 +411,17 @@ void nsMenuX::MenuOpenedAsync() { ...@@ -411,17 +411,17 @@ void nsMenuX::MenuOpenedAsync() {
mContent->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::open, u"true"_ns, true); mContent->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::open, u"true"_ns, true);
} }
// Notify our observer.
if (mObserver) {
mObserver->OnMenuOpened();
}
// Fire popupshown. // Fire popupshown.
nsEventStatus status = nsEventStatus_eIgnore; nsEventStatus status = nsEventStatus_eIgnore;
WidgetMouseEvent event(true, eXULPopupShown, nullptr, WidgetMouseEvent::eReal); WidgetMouseEvent event(true, eXULPopupShown, nullptr, WidgetMouseEvent::eReal);
nsCOMPtr<nsIContent> popupContent = GetMenuPopupContent(); nsCOMPtr<nsIContent> popupContent = GetMenuPopupContent();
nsIContent* dispatchTo = popupContent ? popupContent : mContent; nsIContent* dispatchTo = popupContent ? popupContent : mContent;
EventDispatcher::Dispatch(dispatchTo, nullptr, &event, nullptr, &status); EventDispatcher::Dispatch(dispatchTo, nullptr, &event, nullptr, &status);
// Notify our observer.
if (mObserver) {
mObserver->OnMenuOpened();
}
} }
void nsMenuX::MenuClosed() { void nsMenuX::MenuClosed() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment