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: 1e825b150a60ac26b0f652679eca1b223354fb64
  • Loading branch information
marco-c committed Jun 1, 2023
1 parent 4b063b2 commit cc106fa
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 157 deletions.
31 changes: 27 additions & 4 deletions dom/base/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93952,11 +93952,34 @@ list
;
}
}
aPopover
.
SetHasPopoverInvoker
auto
*
data
=
popoverHTMLEl
-
>
GetPopoverData
(
false
)
;
MOZ_ASSERT
(
data
"
Should
have
popover
data
"
)
;
data
-
>
SetInvoker
(
nullptr
)
;
/
Expand Down
108 changes: 23 additions & 85 deletions dom/base/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28142,82 +28142,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 @@ -28465,15 +28389,6 @@ GetFlattenedTreeParentElement
;
/
/
TODO
:
To
handle
the
button
invokers
/
/
https
:
/
Expand All @@ -28489,6 +28404,29 @@ html
issues
/
9160
RefPtr
<
Element
>
invoker
=
newPopover
-
>
GetPopoverData
(
)
-
>
GetInvoker
(
)
;
checkAncestor
(
invoker
)
;
return
topmostPopoverAncestor
;
Expand Down
35 changes: 0 additions & 35 deletions dom/base/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -3123,41 +3123,6 @@ CreatePopoverData
)
;
}
/
/
https
:
/
/
html
.
spec
.
whatwg
.
org
/
multipage
/
popover
.
html
#
popover
-
invoker
bool
HasPopoverInvoker
(
)
const
;
void
SetHasPopoverInvoker
(
bool
)
;
bool
IsAutoPopover
(
Expand Down
122 changes: 91 additions & 31 deletions dom/base/PopoverData.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,21 @@ mozilla_dom_PopoverData_h
#
include
"
nsStringFwd
Element
.
h
"
#
include
"
nsIRunnable
nsINode
.
h
"
#
include
"
nsThreadUtils
nsIRunnable
.
h
"
Expand All @@ -148,6 +148,20 @@ nsIWeakReferenceUtils
.
h
"
#
include
"
nsStringFwd
.
h
"
#
include
"
nsThreadUtils
.
h
"
namespace
mozilla
:
Expand Down Expand Up @@ -386,26 +400,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 @@ -542,39 +573,68 @@ whatwg
.
org
/
multipage
/
popover
.
html
#
popover
-
invoker
also
/
/
see
https
:
Since
having
a
popover
invoker
only
makes
a
difference
if
the
invoker
/
/
github
.
com
is
in
the
document
(
in
another
open
popover
to
be
precise
)
we
can
make
/
whatwg
/
html
this
a
weak
reference
as
if
the
element
goes
away
it
'
s
necessarily
not
/
issues
/
9168
connected
to
our
document
.
bool
mHasPopoverInvoker
=
false
nsWeakPtr
mInvokerElement
;
bool
mIsHiding
Expand Down
Loading

0 comments on commit cc106fa

Please sign in to comment.