Backed out changeset 4cce744a9cbb (bug 1860457) for causing wpt failures. CLOSED TREE

This commit is contained in:
Sandor Molnar
2024-05-24 07:07:16 +03:00
parent ca1c9f6bb6
commit a9eee12a7d
8 changed files with 49 additions and 104 deletions

View File

@@ -2988,48 +2988,7 @@ void nsGenericHTMLFormControlElementWithState::HandleInvokeTargetAction() {
return;
}
invokee->HandleInvokeInternal(this, action, IgnoreErrors());
}
bool nsGenericHTMLElement::IsValidInvokeAction(InvokeAction aAction) const {
return Element::IsValidInvokeAction(aAction) ||
aAction == InvokeAction::ShowPopover ||
aAction == InvokeAction::TogglePopover ||
aAction == InvokeAction::HidePopover;
}
MOZ_CAN_RUN_SCRIPT bool nsGenericHTMLElement::HandleInvokeInternal(
Element* aInvoker, InvokeAction aAction, ErrorResult& aRv) {
if (Element::HandleInvokeInternal(aInvoker, aAction, aRv)) {
return true;
}
// If the element is a `popover` then we may want to handle the
// invokeaction...
auto popoverState = GetPopoverAttributeState();
if (popoverState == PopoverAttributeState::None) {
return false;
}
const bool canShow = aAction == InvokeAction::Auto ||
aAction == InvokeAction::TogglePopover ||
aAction == InvokeAction::ShowPopover;
const bool canHide = aAction == InvokeAction::Auto ||
aAction == InvokeAction::TogglePopover ||
aAction == InvokeAction::HidePopover;
if (canShow && !IsPopoverOpen()) {
ShowPopoverInternal(aInvoker, aRv);
return true;
}
if (canHide && IsPopoverOpen()) {
HidePopoverInternal(/* aFocusPreviousElement = */ true,
/* aFireEvents = */ true, IgnoreErrors());
return true;
}
return false;
invokee->HandleInvokeInternal(action, IgnoreErrors());
}
void nsGenericHTMLFormControlElementWithState::GenerateStateKey() {