Bug 1837360 - Popover: Align to the update of specification regarding nested popover, r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D181121
This commit is contained in:
@@ -3381,6 +3381,14 @@ void nsGenericHTMLElement::ShowPopoverInternal(
|
||||
RefPtr<Document> document = OwnerDoc();
|
||||
MOZ_ASSERT(!OwnerDoc()->TopLayerContains(*this));
|
||||
|
||||
bool wasShowingOrHiding = GetPopoverData()->IsShowingOrHiding();
|
||||
GetPopoverData()->SetIsShowingOrHiding(true);
|
||||
auto cleanupShowingFlag = MakeScopeExit([&]() {
|
||||
if (auto* popoverData = GetPopoverData()) {
|
||||
popoverData->SetIsShowingOrHiding(wasShowingOrHiding);
|
||||
}
|
||||
});
|
||||
|
||||
// Fire beforetoggle event and re-check popover validity.
|
||||
if (FireToggleEvent(PopoverVisibilityState::Hidden,
|
||||
PopoverVisibilityState::Showing, u"beforetoggle"_ns)) {
|
||||
@@ -3397,7 +3405,8 @@ void nsGenericHTMLElement::ShowPopoverInternal(
|
||||
if (!ancestor) {
|
||||
ancestor = document;
|
||||
}
|
||||
document->HideAllPopoversUntil(*ancestor, false, true);
|
||||
document->HideAllPopoversUntil(*ancestor, false,
|
||||
/* aFireEvents = */ !wasShowingOrHiding);
|
||||
|
||||
// TODO: Handle if document changes, see
|
||||
// https://github.com/whatwg/html/issues/9177
|
||||
|
||||
Reference in New Issue
Block a user