From c7ff7499465166d91e7de0795a132e34b477fc06 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Sun, 16 Jul 2023 01:29:06 +0000 Subject: [PATCH] Bug 1841505: postpone setting the popover invoker in the "show popover" algo. r=emilio See . Differential Revision: https://phabricator.services.mozilla.com/D182709 UltraBlame original commit: 0b5333b2ef93c5e4153ac198b577c6f54c5ad538 --- dom/base/Element.cpp | 24 +++---------- dom/base/Element.h | 10 +++--- dom/html/nsGenericHTMLElement.cpp | 58 ++++++++++++++++++++----------- dom/html/nsGenericHTMLElement.h | 2 +- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 44809de6e8643..6627559e7ee60 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -22514,6 +22514,10 @@ Element : GetTopmostPopoverAncestor ( +const +Element +* +aInvoker ) const { @@ -22682,27 +22686,9 @@ GetFlattenedTreeParentElement ) ) ; -RefPtr -< -Element -> -invoker -= -newPopover -- -> -GetPopoverData -( -) -- -> -GetInvoker -( -) -; checkAncestor ( -invoker +aInvoker ) ; return diff --git a/dom/base/Element.h b/dom/base/Element.h index 10d2630e56a02..f5ebab369427e 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -1805,16 +1805,14 @@ IsPopoverOpen ) const ; -mozilla -: -: -dom -: -: Element * GetTopmostPopoverAncestor ( +const +Element +* +aInvoker ) const ; diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index bf2572ab82a4e..d1a72fe7535bd 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -17183,7 +17183,7 @@ nsGenericHTMLElement : ShowPopoverInternal ( -nsGenericHTMLFormControlElementWithState +Element * aInvoker ErrorResult @@ -17193,26 +17193,6 @@ aRv { if ( -PopoverData -* -data -= -GetPopoverData -( -) -) -{ -data -- -> -SetInvoker -( -aInvoker -) -; -} -if -( ! CheckPopoverValidity ( @@ -17241,6 +17221,25 @@ OwnerDoc MOZ_ASSERT ( ! +GetPopoverData +( +) +| +| +! +GetPopoverData +( +) +- +> +GetInvoker +( +) +) +; +MOZ_ASSERT +( +! OwnerDoc ( ) @@ -17379,6 +17378,7 @@ ancestor = GetTopmostPopoverAncestor ( +aInvoker ) ; if @@ -17516,9 +17516,16 @@ true true ) ; +{ +auto +* +popoverData += GetPopoverData ( ) +; +popoverData - > SetPopoverVisibilityState @@ -17529,6 +17536,15 @@ PopoverVisibilityState Showing ) ; +popoverData +- +> +SetInvoker +( +aInvoker +) +; +} FocusPopover ( ) diff --git a/dom/html/nsGenericHTMLElement.h b/dom/html/nsGenericHTMLElement.h index 56aae5b0981a2..88137d5fcdce8 100644 --- a/dom/html/nsGenericHTMLElement.h +++ b/dom/html/nsGenericHTMLElement.h @@ -1070,7 +1070,7 @@ MOZ_CAN_RUN_SCRIPT void ShowPopoverInternal ( -nsGenericHTMLFormControlElementWithState +Element * aInvoker ErrorResult