8000 LibWeb: Move popover invoker reset later · Gingeh/ladybird@c6b2aeb · GitHub
[go: up one dir, main page]

Skip to content

Commit c6b2aeb

Browse files
committed
LibWeb: Move popover invoker reset later
See whatwg/html#11304
1 parent 9ae85e5 commit c6b2aeb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Libraries/LibWeb/HTML/HTMLElement.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,30 +1425,27 @@ WebIDL::ExceptionOr<void> HTMLElement::hide_popover(FocusPreviousElement focus_p
14251425
auto const& showing_popovers = document.showing_auto_popover_list();
14261426
bool auto_popover_list_contains_element = !showing_popovers.is_empty() && showing_popovers.last() == this;
14271427

1428-
// 9. Set element's popover invoker to null.
1429-
m_popover_invoker = nullptr;
1430-
1431-
// 10. If fireEvents is true:
1428+
// 9. If fireEvents is true:
14321429
if (fire_events == FireEvents::Yes) {
1433-
// 10.1. Fire an event named beforetoggle, using ToggleEvent, with the oldState attribute initialized to "open" and the newState attribute initialized to "closed" at element.
1430+
// 9.1. Fire an event named beforetoggle, using ToggleEvent, with the oldState attribute initialized to "open" and the newState attribute initialized to "closed" at element.
14341431
ToggleEventInit event_init {};
14351432
event_init.old_state = "open"_string;
14361433
event_init.new_state = "closed"_string;
14371434
dispatch_event(ToggleEvent::create(realm(), HTML::EventNames::beforetoggle, move(event_init)));
14381435

1439-
// 10.2. If autoPopoverListContainsElement is true and document's showing auto popover list's last item is not element, then run hide all popovers until given element, focusPreviousElement, and false.
1436+
// 9.2. If autoPopoverListContainsElement is true and document's showing auto popover list's last item is not element, then run hide all popovers until given element, focusPreviousElement, and false.
14401437
if (auto_popover_list_contains_element && (showing_popovers.is_empty() || showing_popovers.last() != this))
14411438
hide_all_popovers_until(GC::Ptr(this), focus_previous_element, FireEvents::No);
14421439

1443-
// 10.3. If the result of running check popover validity given element, true, throwExceptions, null, and ignoreDomState is false, then run cleanupSteps and return.
1440+
// 9.3. If the result of running check popover validity given element, true, throwExceptions, null, and ignoreDomState is false, then run cleanupSteps and return.
14441441
if (!TRY(check_popover_validity(ExpectedToBeShowing::Yes, throw_exceptions, nullptr, ignore_dom_state))) {
14451442
cleanup_steps();
14461443
return {};
14471444
}
1448-
// 10.4. Request an element to be removed from the top layer given element.
1445+
// 9.4. Request an element to be removed from the top layer given element.
14491446
document.request_an_element_to_be_remove_from_the_top_layer(*this);
14501447
} else {
1451-
// 11. Otherwise, remove an element from the top layer immediately given element.
1448+
// 10. Otherwise, remove an element from the top layer immediately given element.
14521449
document.remove_an_element_from_the_top_layer_immediately(*this);
14531450
}
14541451

@@ -1477,6 +1474,9 @@ WebIDL::ExceptionOr<void> HTMLElement::hide_popover(FocusPreviousElement focus_p
14771474
}
14781475
}
14791476

1477+
// 11. Set element's popover invoker to null.
1478+
m_popover_invoker = nullptr;
1479+
14801480
// 12. Set element's opened in popover mode to null.
14811481
m_opened_in_popover_mode = {};
14821482

0 commit comments

Comments
 (0)
0