Bug 1835464 - Check dialog is modal flag instead of open attribute in 'check popover validity' algorithm. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D181089
This commit is contained in:
Ziran Sun 2023-06-20 08:49:32 +00:00
Родитель e6d575b5d9
Коммит 96a16d3cad
3 изменённых файлов: 5 добавлений и 20 удалений

Просмотреть файл

@ -78,11 +78,6 @@ void HTMLDialogElement::Show(ErrorResult& aError) {
"Cannot call show() on an open modal dialog.");
}
if (IsPopoverOpen()) {
return aError.ThrowInvalidStateError(
"Dialog element is already an open popover.");
}
SetOpen(true, IgnoreErrors());
StorePreviouslyFocusedElement();

Просмотреть файл

@ -3276,10 +3276,12 @@ bool nsGenericHTMLElement::CheckPopoverValidity(
return false;
}
if (IsHTMLElement(nsGkAtoms::dialog) && HasAttr(nsGkAtoms::open)) {
aRv.ThrowInvalidStateError("Element is an open <dialog> element");
if (auto* dialog = HTMLDialogElement::FromNode(this)) {
if (dialog->IsInTopLayer()) {
aRv.ThrowInvalidStateError("Element is a modal <dialog> element");
return false;
}
}
if (State().HasState(ElementState::FULLSCREEN)) {
aRv.ThrowInvalidStateError("Element is fullscreen");

Просмотреть файл

@ -1,16 +1,4 @@
[popover-top-layer-combinations.html]
[Popover combination: Popover Dialog]
expected: FAIL
[Popover combination: Open Non-modal Popover Dialog]
expected: FAIL
[Popover combination: Fullscreen Popover]
expected:
if os == "linux": FAIL
[Popover combination: Fullscreen Popover Dialog]
expected: FAIL
[Popover combination: Fullscreen Open Non-modal Popover Dialog]
expected: FAIL