Skip to content

Commit

Permalink
Bug 1833570 - Change popover invoker type from boolean to Element. r=…
Browse files Browse the repository at this point in the history
…emilio

The invoker type is currently implemented as boolean as suggested at
whatwg/html#9168. This issue is now closed and
has been fixed at whatwg/html#9171.

This patch is to be follow above discussions and implement popover invoker
type as element.

Differential Revision: https://phabricator.services.mozilla.com/D178287

UltraBlame original commit: 31915ad324761c4fe80dac65ca36f070ab2102a2
  • Loading branch information
marco-c committed May 31, 2023
1 parent c0c5267 commit 57c0518
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 106 deletions.
31 changes: 27 additions & 4 deletions dom/base/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71509,11 +71509,34 @@ list
;
}
}
aPopover
.
SetHasPopoverInvoker
auto
*
data
=
popoverHTMLEl
-
>
GetPopoverData
(
false
)
;
MOZ_ASSERT
(
data
"
Should
have
popover
data
"
)
;
data
-
>
SetInvoker
(
nullptr
)
;
if
Expand Down
99 changes: 23 additions & 76 deletions dom/base/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22284,82 +22284,6 @@ bool
Element
:
:
HasPopoverInvoker
(
)
const
{
auto
*
popoverData
=
GetPopoverData
(
)
;
return
popoverData
&
&
popoverData
-
>
HasPopoverInvoker
(
)
;
}
void
Element
:
:
SetHasPopoverInvoker
(
bool
aHasInvoker
)
{
if
(
aHasInvoker
)
{
EnsurePopoverData
(
)
.
SetHasPopoverInvoker
(
true
)
;
}
else
if
(
auto
*
popoverData
=
GetPopoverData
(
)
)
{
popoverData
-
>
SetHasPopoverInvoker
(
false
)
;
}
}
bool
Element
:
:
IsAutoPopover
(
)
Expand Down Expand Up @@ -22605,6 +22529,29 @@ GetFlattenedTreeParentElement
)
)
;
RefPtr
<
Element
>
invoker
=
newPopover
-
>
GetPopoverData
(
)
-
>
GetInvoker
(
)
;
checkAncestor
(
invoker
)
;
return
topmostPopoverAncestor
;
Expand Down
12 changes: 0 additions & 12 deletions dom/base/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -1722,18 +1722,6 @@ CreatePopoverData
;
}
bool
HasPopoverInvoker
(
)
const
;
void
SetHasPopoverInvoker
(
bool
)
;
bool
IsAutoPopover
(
)
Expand Down
39 changes: 27 additions & 12 deletions dom/base/PopoverData.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,26 +187,43 @@ mPreviouslyFocusedElement
aPreviouslyFocusedElement
;
}
bool
HasPopoverInvoker
RefPtr
<
Element
>
GetInvoker
(
)
const
{
return
mHasPopoverInvoker
do_QueryReferent
(
mInvokerElement
)
;
}
void
SetHasPopoverInvoker
SetInvoker
(
bool
aHasPopoverInvoker
Element
*
aInvokerElement
)
{
mHasPopoverInvoker
mInvokerElement
=
aHasPopoverInvoker
do_GetWeakReference
(
static_cast
<
nsINode
*
>
(
aInvokerElement
)
)
;
}
PopoverToggleEventTask
Expand Down Expand Up @@ -288,10 +305,8 @@ mPreviouslyFocusedElement
=
nullptr
;
bool
mHasPopoverInvoker
=
false
nsWeakPtr
mInvokerElement
;
bool
mIsHiding
Expand Down
9 changes: 7 additions & 2 deletions dom/html/nsGenericHTMLElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15088,9 +15088,14 @@ IsPopoverOpen
target
-
>
SetHasPopoverInvoker
GetPopoverData
(
true
)
-
>
SetInvoker
(
this
)
;
target
Expand Down

0 comments on commit 57c0518

Please sign in to comment.