Backed out changeset 241b4b54e654 (bug 1824374) for causing failures at popover-invoking-attribute.html.

This commit is contained in:
Butkovits Atila
2023-04-17 23:44:22 +03:00
parent b8266c0e4e
commit 45f9b533bd
4 changed files with 5 additions and 18 deletions

View File

@@ -3202,11 +3202,12 @@ Element* nsINode::GetNearestInclusiveTargetPopoverForInvoker() const {
nsGenericHTMLElement* nsINode::GetEffectivePopoverTargetElement() const { nsGenericHTMLElement* nsINode::GetEffectivePopoverTargetElement() const {
const auto* formControl = const auto* formControl =
nsGenericHTMLFormControlElementWithState::FromNode(this); nsGenericHTMLFormControlElementWithState::FromNode(this);
if (!formControl || formControl->IsDisabled() || if (!formControl || !formControl->IsConceptButton() ||
!formControl->IsButtonControl()) { formControl->IsDisabled() ||
(formControl->GetForm() && formControl->IsSubmitControl())) {
return nullptr; return nullptr;
} }
if (auto* popover = nsGenericHTMLElement::FromNodeOrNull( if (auto* popover = nsGenericHTMLElement::FromNode(
formControl->GetPopoverTargetElement())) { formControl->GetPopoverTargetElement())) {
if (popover->GetPopoverState() != PopoverState::None) { if (popover->GetPopoverState() != PopoverState::None) {
return popover; return popover;

View File

@@ -253,7 +253,6 @@ nsresult HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
// NS_FORM_BUTTON_BUTTON do nothing. // NS_FORM_BUTTON_BUTTON do nothing.
return rv; return rv;
} }
HandlePopoverTargetAction();
} }
} }

View File

@@ -4083,10 +4083,7 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
default: default:
break; break;
} // switch } // switch
if (IsButtonControl()) { } // click or outer activate event
HandlePopoverTargetAction();
}
} // click or outer activate event
} else if ((aVisitor.mItemFlags & NS_IN_SUBMIT_CLICK) && } else if ((aVisitor.mItemFlags & NS_IN_SUBMIT_CLICK) &&
(oldType == FormControlType::InputSubmit || (oldType == FormControlType::InputSubmit ||
oldType == FormControlType::InputImage)) { oldType == FormControlType::InputImage)) {

View File

@@ -181,12 +181,6 @@ class nsIFormControl : public nsISupports {
*/ */
inline bool IsConceptButton() const; inline bool IsConceptButton() const;
/**
* Returns whether this is an ordinal button or a concept button that has no
* form associated.
*/
inline bool IsButtonControl() const;
/** /**
* Returns whether this form control can have draggable children. * Returns whether this form control can have draggable children.
* @return whether this form control can have draggable children. * @return whether this form control can have draggable children.
@@ -273,10 +267,6 @@ bool nsIFormControl::IsConceptButton() const {
return IsSubmitControl() || IsButtonElement(ControlType()); return IsSubmitControl() || IsButtonElement(ControlType());
} }
bool nsIFormControl::IsButtonControl() const {
return IsConceptButton() && (!GetForm() || !IsSubmitControl());
}
bool nsIFormControl::AllowDraggableChildren() const { bool nsIFormControl::AllowDraggableChildren() const {
auto type = ControlType(); auto type = ControlType();
return type == FormControlType::Object || type == FormControlType::Fieldset || return type == FormControlType::Object || type == FormControlType::Fieldset ||