1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00

LibWeb/HTML: Correct show_popover() invocations

Corresponds to 47f854c66e
This commit is contained in:
Sam Atkins 2025-05-15 12:44:40 +01:00 committed by Shannon Booth
parent 2efad4c941
commit 08419a6d8f
Notes: github-actions[bot] 2025-05-15 22:22:10 +00:00

View file

@ -225,7 +225,8 @@ void HTMLButtonElement::activation_behavior(DOM::Event const& event)
// 9. If command is in the Hide Popover state:
if (command == "hide-popover") {
// 1. If the result of running check popover validity given target, true, false, and null is true, then run the hide popover algorithm given target, true, true, and false.
// 1. If the result of running check popover validity given target, true, false, and null is true,
// then run the hide popover algorithm given target, true, true, and false.
if (MUST(target->check_popover_validity(ExpectedToBeShowing::Yes, ThrowExceptions::No, nullptr, IgnoreDomState::No))) {
MUST(target->hide_popover(FocusPreviousElement::Yes, FireEvents::Yes, ThrowExceptions::No, IgnoreDomState::No));
}
@ -233,12 +234,14 @@ void HTMLButtonElement::activation_behavior(DOM::Event const& event)
// 10. Otherwise, if command is in the Toggle Popover state:
else if (command == "toggle-popover") {
// 1. If the result of running check popover validity given target, false, false, and null is true, then run the show popover algorithm given target, true, true, and false.
// 1. If the result of running check popover validity given target, false, false, and null is true,
// then run the show popover algorithm given target, false, and this.
if (MUST(target->check_popover_validity(ExpectedToBeShowing::No, ThrowExceptions::No, nullptr, IgnoreDomState::No))) {
MUST(target->show_popover(ThrowExceptions::No, this));
}
// 2. Otheriwse, if the result of running check popover validity given target, true, false, and null is true, then run the hide popover algorithm given target, true, true, and false.
// 2. Otheriwse, if the result of running check popover validity given target, true, false, and null is true,
// then run the hide popover algorithm given target, true, true, and false.
else if (MUST(target->check_popover_validity(ExpectedToBeShowing::Yes, ThrowExceptions::No, nullptr, IgnoreDomState::No))) {
MUST(target->hide_popover(FocusPreviousElement::Yes, FireEvents::Yes, ThrowExceptions::No, IgnoreDomState::No));
}
@ -246,7 +249,8 @@ void HTMLButtonElement::activation_behavior(DOM::Event const& event)
// 11. Otherwise, if command is in the Show Popover state:
else if (command == "show-popover") {
// 1. If the result of running check popover validity given target, false, false, and null is true, then run the show popover algorithm given target, true, true, and false.
// 1. If the result of running check popover validity given target, false, false, and null is true,
// then run the show popover algorithm given target, false, and this.
if (MUST(target->check_popover_validity(ExpectedToBeShowing::No, ThrowExceptions::No, nullptr, IgnoreDomState::No))) {
MUST(target->show_popover(ThrowExceptions::No, this));
}