From fdef98b00ca31cd0bd03aeaebdbc52b4b4bee518 Mon Sep 17 00:00:00 2001 From: Butkovits Atila Date: Mon, 17 Apr 2023 23:44:22 +0300 Subject: [PATCH] Backed out changeset 241b4b54e654 (bug 1824374) for causing failures at popover-invoking-attribute.html. --- dom/base/nsINode.cpp | 7 ++++--- dom/html/HTMLButtonElement.cpp | 1 - dom/html/HTMLInputElement.cpp | 5 +---- dom/html/nsIFormControl.h | 10 ---------- 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp index 8ccafa899abd..946120e4da52 100644 --- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -3202,11 +3202,12 @@ Element* nsINode::GetNearestInclusiveTargetPopoverForInvoker() const { nsGenericHTMLElement* nsINode::GetEffectivePopoverTargetElement() const { const auto* formControl = nsGenericHTMLFormControlElementWithState::FromNode(this); - if (!formControl || formControl->IsDisabled() || - !formControl->IsButtonControl()) { + if (!formControl || !formControl->IsConceptButton() || + formControl->IsDisabled() || + (formControl->GetForm() && formControl->IsSubmitControl())) { return nullptr; } - if (auto* popover = nsGenericHTMLElement::FromNodeOrNull( + if (auto* popover = nsGenericHTMLElement::FromNode( formControl->GetPopoverTargetElement())) { if (popover->GetPopoverState() != PopoverState::None) { return popover; diff --git a/dom/html/HTMLButtonElement.cpp b/dom/html/HTMLButtonElement.cpp index 4465a7be8be2..20c3d5f129c1 100644 --- a/dom/html/HTMLButtonElement.cpp +++ b/dom/html/HTMLButtonElement.cpp @@ -253,7 +253,6 @@ nsresult HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor) { // NS_FORM_BUTTON_BUTTON do nothing. return rv; } - HandlePopoverTargetAction(); } } diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index bc77cf7a4788..a31b6e98fd43 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -4083,10 +4083,7 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) { default: break; } // switch - if (IsButtonControl()) { - HandlePopoverTargetAction(); - } - } // click or outer activate event + } // click or outer activate event } else if ((aVisitor.mItemFlags & NS_IN_SUBMIT_CLICK) && (oldType == FormControlType::InputSubmit || oldType == FormControlType::InputImage)) { diff --git a/dom/html/nsIFormControl.h b/dom/html/nsIFormControl.h index 4e16bf4e0f3b..534df5ddd106 100644 --- a/dom/html/nsIFormControl.h +++ b/dom/html/nsIFormControl.h @@ -181,12 +181,6 @@ class nsIFormControl : public nsISupports { */ 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. * @return whether this form control can have draggable children. @@ -273,10 +267,6 @@ bool nsIFormControl::IsConceptButton() const { return IsSubmitControl() || IsButtonElement(ControlType()); } -bool nsIFormControl::IsButtonControl() const { - return IsConceptButton() && (!GetForm() || !IsSubmitControl()); -} - bool nsIFormControl::AllowDraggableChildren() const { auto type = ControlType(); return type == FormControlType::Object || type == FormControlType::Fieldset ||