Skip to content

Commit

Permalink
Bug 1898833 - Support oncontentvisibilityautostatechange event handle…
Browse files Browse the repository at this point in the history
…r r=emilio,smaug

Spec PR: whatwg/html#10364

Differential Revision: https://phabricator.services.mozilla.com/D217187
  • Loading branch information
gregorypappas committed Jul 20, 2024
1 parent 8c5cfd2 commit 9cee340
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
2 changes: 2 additions & 0 deletions dom/events/EventNameList.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ EVENT(click, ePointerClick, EventNameType_All,
? ePointerEventClass
: eMouseEventClass)
EVENT(close, eClose, EventNameType_HTMLXUL, eBasicEventClass)
EVENT(contentvisibilityautostatechange, eContentVisibilityAutoStateChange,
EventNameType_All, eBasicEventClass)
EVENT(contextmenu, eContextMenu,
EventNameType_HTMLXUL | EventNameType_SVGGraphic,
StaticPrefs::dom_w3c_pointer_events_dispatch_click_as_pointer_event()
Expand Down
1 change: 1 addition & 0 deletions dom/webidl/EventHandler.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ interface mixin GlobalEventHandlers {
attribute EventHandler onchange;
attribute EventHandler onclick;
attribute EventHandler onclose;
attribute EventHandler oncontentvisibilityautostatechange;
attribute EventHandler oncontextlost;
attribute EventHandler oncontextmenu;
attribute EventHandler oncontextrestored;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,22 @@

<script>
let contentattrfired = false;
let contentattrfiredonsvg = false;

function contentattrDidFire() {
contentattrfired = true;
}

function contentattrDidFireOnSvg() {
contentattrfiredonsvg = true;
}

</script>

<div id=upper></div>
<div id=attrtest></div>
<div id=contentattrtest oncontentvisibilityautostatechange="contentattrDidFire()" class=auto></div>
<svg id="svgcontentattrtest" oncontentvisibilityautostatechange="contentattrDidFireOnSvg()" class="auto"></svg>
<div class=spacer></div>
<div id=middle></div>
<div class=spacer></div>
Expand Down Expand Up @@ -83,6 +89,12 @@
assert_true(contentattrfired, "contentattrfired");
}, "ContentVisibilityAutoStateChange content attribute test");


promise_test(async t => {
await waitForAtLeastOneFrame();
assert_true(contentattrfiredonsvg, "contentattrfiredonsvg");
}, "ContentVisibilityAutoStateChange content attribute test on svg");

promise_test(t => new Promise(async (resolve, reject) => {
await new Promise((waited, _) => {
requestAnimationFrame(() => requestAnimationFrame(waited));
Expand Down
3 changes: 3 additions & 0 deletions widget/EventMessageList.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ NS_EVENT_MESSAGE(ePageHide)
NS_EVENT_MESSAGE(eContextLost)
NS_EVENT_MESSAGE(eContextRestored)

// content-visibility events
NS_EVENT_MESSAGE(eContentVisibilityAutoStateChange)

// SVG events
NS_EVENT_MESSAGE(eSVGLoad)
NS_EVENT_MESSAGE(eSVGScroll)
Expand Down
1 change: 1 addition & 0 deletions xpcom/ds/StaticAtoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@
Atom("onCheckKeyPressEventModel", "onCheckKeyPressEventModel"),
Atom("onclick", "onclick"),
Atom("onclose", "onclose"),
Atom("oncontentvisibilityautostatechange", "oncontentvisibilityautostatechange"),
Atom("oncommand", "oncommand"),
Atom("oncommandupdate", "oncommandupdate"),
Atom("oncomplete", "oncomplete"),
Expand Down

0 comments on commit 9cee340

Please sign in to comment.