Skip to content

Commit f982fc0

Browse files
committed
Bug 1791079 - Implement User Activation API r=dom-core,webidl,saschanaz,edgar
Rewrote internal user activation tree (spreading state to other elements) logic to match HTML spec: https://html.spec.whatwg.org/multipage/interaction.html#user-activation-processing-model Added navigator.userActivation API to expose internal user activation. Also fixed a WPT test to conform to spec (siblings are not activated), see also spec issue: whatwg/html#9831 Co-authored-by: Tom Schuster <evilpiesgmail.com> Differential Revision: https://phabricator.services.mozilla.com/D185348 UltraBlame original commit: 7c84c5fc7d0002a8bee64ebc66899437638331c6
1 parent 7210148 commit f982fc0

24 files changed

+1017
-639
lines changed

dom/base/Document.cpp

+210-104
Original file line numberDiff line numberDiff line change
@@ -104585,186 +104585,292 @@ NotifyUserGestureActivation
104585104585
(
104586104586
)
104587104587
{
104588-
if
104589-
(
104588+
/
104589+
/
104590+
https
104591+
:
104592+
/
104593+
/
104594+
html
104595+
.
104596+
spec
104597+
.
104598+
whatwg
104599+
.
104600+
org
104601+
/
104602+
multipage
104603+
/
104604+
interaction
104605+
.
104606+
html
104607+
#
104608+
activation
104609+
-
104610+
notification
104611+
/
104612+
/
104613+
1
104614+
.
104615+
"
104616+
Assert
104617+
:
104618+
document
104619+
is
104620+
fully
104621+
active
104622+
.
104623+
"
104590104624
RefPtr
104591104625
<
104592104626
BrowsingContext
104593104627
>
104594-
bc
104628+
currentBC
104595104629
=
104596104630
GetBrowsingContext
104597104631
(
104598104632
)
104599-
)
104600-
{
104601-
bc
104602-
-
104603-
>
104604-
PreOrderWalk
104605-
(
104606-
[
104607-
&
104608-
]
104609-
(
104610-
BrowsingContext
104611-
*
104612-
aBC
104613-
)
104614-
{
104615-
WindowContext
104616-
*
104617-
windowContext
104618-
=
104619-
aBC
104620-
-
104621-
>
104622-
GetCurrentWindowContext
104623-
(
104624-
)
104625104633
;
104626104634
if
104627104635
(
104628104636
!
104629-
windowContext
104637+
currentBC
104630104638
)
104631104639
{
104632104640
return
104633104641
;
104634104642
}
104635-
nsIDocShell
104636-
*
104637-
docShell
104638-
=
104639-
aBC
104640-
-
104643+
RefPtr
104644+
<
104645+
WindowContext
104641104646
>
104642-
GetDocShell
104643-
(
104644-
)
104645-
;
104646-
if
104647-
(
104648-
!
104649-
docShell
104650-
)
104651-
{
104652-
return
104653-
;
104654-
}
104655-
Document
104656-
*
104657-
document
104647+
currentWC
104658104648
=
104659-
docShell
104660-
-
104661-
>
104662-
GetDocument
104649+
GetWindowContext
104663104650
(
104664104651
)
104665104652
;
104666-
if
104667-
(
104668-
!
104653+
/
104654+
/
104655+
2
104656+
.
104657+
"
104658+
Let
104659+
windows
104660+
be
104669104661
document
104670-
)
104671-
{
104672-
return
104673-
;
104674-
}
104662+
'
104663+
s
104664+
relevant
104665+
global
104666+
object
104667+
"
104675104668
/
104676104669
/
104677-
XXXedgar
104670+
Instead
104671+
of
104672+
assembling
104673+
a
104674+
list
104678104675
we
104679-
probably
104680-
could
104681104676
just
104682-
check
104683-
IsInProcess
104684-
(
104685-
)
104686-
after
104687-
fission
104677+
call
104678+
notify
104679+
for
104680+
wanted
104681+
windows
104682+
as
104683+
we
104688104684
/
104689104685
/
104690-
enable
104691-
.
104692-
if
104693-
(
104694-
NodePrincipal
104695-
(
104696-
)
104686+
find
104687+
them
104688+
currentWC
104697104689
-
104698104690
>
104699-
Equals
104691+
NotifyUserGestureActivation
104700104692
(
104693+
)
104694+
;
104695+
/
104696+
/
104697+
3
104698+
.
104699+
"
104700+
.
104701+
.
104702+
.
104703+
windows
104704+
with
104705+
the
104706+
active
104707+
window
104708+
of
104709+
each
104710+
of
104701104711
document
104712+
'
104713+
s
104714+
ancestor
104715+
/
104716+
/
104717+
navigables
104718+
.
104719+
"
104720+
for
104721+
(
104722+
WindowContext
104723+
*
104724+
wc
104725+
=
104726+
currentWC
104727+
;
104728+
wc
104729+
;
104730+
wc
104731+
=
104732+
wc
104702104733
-
104703104734
>
104704-
NodePrincipal
104735+
GetParentWindowContext
104705104736
(
104706104737
)
104707104738
)
104708-
)
104709104739
{
104710-
windowContext
104740+
wc
104711104741
-
104712104742
>
104713104743
NotifyUserGestureActivation
104714104744
(
104715104745
)
104716104746
;
104717104747
}
104718-
}
104719-
)
104720-
;
104721-
for
104748+
/
104749+
/
104750+
4
104751+
.
104752+
"
104753+
windows
104754+
with
104755+
the
104756+
active
104757+
window
104758+
of
104759+
each
104760+
of
104761+
document
104762+
'
104763+
s
104764+
descendant
104765+
/
104766+
/
104767+
navigables
104768+
filtered
104769+
to
104770+
include
104771+
only
104772+
those
104773+
navigables
104774+
whose
104775+
active
104776+
/
104777+
/
104778+
document
104779+
'
104780+
s
104781+
origin
104782+
is
104783+
same
104784+
origin
104785+
with
104786+
document
104787+
'
104788+
s
104789+
origin
104790+
"
104791+
currentBC
104792+
-
104793+
>
104794+
PreOrderWalk
104795+
(
104796+
[
104797+
&
104798+
]
104722104799
(
104800+
BrowsingContext
104801+
*
104723104802
bc
104803+
)
104804+
{
104805+
WindowContext
104806+
*
104807+
wc
104724104808
=
104725104809
bc
104726104810
-
104727104811
>
104728-
GetParent
104812+
GetCurrentWindowContext
104729104813
(
104730104814
)
104731104815
;
104732-
bc
104816+
if
104817+
(
104818+
!
104819+
wc
104820+
)
104821+
{
104822+
return
104733104823
;
104734-
bc
104824+
}
104825+
/
104826+
/
104827+
Check
104828+
same
104829+
-
104830+
origin
104831+
as
104832+
current
104833+
document
104834+
WindowGlobalChild
104835+
*
104836+
wgc
104735104837
=
104736-
bc
104838+
wc
104737104839
-
104738104840
>
104739-
GetParent
104841+
GetWindowGlobalChild
104740104842
(
104741104843
)
104742-
)
104743-
{
104844+
;
104744104845
if
104745104846
(
104746-
WindowContext
104747-
*
104748-
windowContext
104749-
=
104750-
bc
104847+
!
104848+
wgc
104849+
|
104850+
|
104851+
!
104852+
wgc
104751104853
-
104752104854
>
104753-
GetCurrentWindowContext
104855+
IsSameOriginWith
104754104856
(
104857+
currentWC
104755104858
)
104756104859
)
104757104860
{
104758-
windowContext
104861+
return
104862+
;
104863+
}
104864+
wc
104759104865
-
104760104866
>
104761104867
NotifyUserGestureActivation
104762104868
(
104763104869
)
104764104870
;
104765104871
}
104766-
}
104767-
}
104872+
)
104873+
;
104768104874
}
104769104875
bool
104770104876
Document

0 commit comments

Comments
 (0)