mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 09:18:42 +09:00
Issue #2472 - Part 6: Fire cancel event and close modal <dialog> on [ESC]
This implementation is different than Mozilla, not indirectly queueing cancel tasks to be arbitrarily ordered, but rather synchronously close in reverse top layer order.
This commit is contained in:
parent
7d34b285e0
commit
87a7cf7332
6 changed files with 49 additions and 0 deletions
|
|
@ -159,6 +159,7 @@
|
|||
#include "nsEscape.h"
|
||||
#include "nsObjectLoadingContent.h"
|
||||
#include "nsHtml5TreeOpExecutor.h"
|
||||
#include "mozilla/dom/HTMLDialogElement.h"
|
||||
#include "mozilla/dom/HTMLLinkElement.h"
|
||||
#include "mozilla/dom/HTMLMediaElement.h"
|
||||
#include "mozilla/dom/HTMLIFrameElement.h"
|
||||
|
|
@ -10138,6 +10139,18 @@ nsDocument::MozCancelFullScreen()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsDocument::TryCancelDialog() {
|
||||
// Check if the document is blocked by modal dialog
|
||||
for (const nsWeakPtr& weakPtr : Reversed(mTopLayer)) {
|
||||
nsCOMPtr<Element> element(do_QueryReferent(weakPtr));
|
||||
if (HTMLDialogElement* dialog =
|
||||
HTMLDialogElement::FromContentOrNull(element)) {
|
||||
dialog->CancelDialog();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::ExitFullscreen()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue