diff --git a/dom/events/EventNameList.h b/dom/events/EventNameList.h index 391bf6e97511..593b6917b035 100644 --- a/dom/events/EventNameList.h +++ b/dom/events/EventNameList.h @@ -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() diff --git a/dom/tests/mochitest/general/test_interfaces.js b/dom/tests/mochitest/general/test_interfaces.js index 10b8bc2ed317..b7d7042a00b0 100644 --- a/dom/tests/mochitest/general/test_interfaces.js +++ b/dom/tests/mochitest/general/test_interfaces.js @@ -1679,6 +1679,8 @@ let interfaceNamesInGlobalScope = [ // IMPORTANT: Do not change this list without review from a DOM peer! { name: "onclose", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! + { name: "oncontentvisibilityautostatechange", insecureContext: true }, + // IMPORTANT: Do not change this list without review from a DOM peer! { name: "oncontextlost", insecureContext: true }, // IMPORTANT: Do not change this list without review from a DOM peer! { name: "oncontextmenu", insecureContext: true }, diff --git a/dom/webidl/EventHandler.webidl b/dom/webidl/EventHandler.webidl index c88e4f0422ce..fb949f5cf2e4 100644 --- a/dom/webidl/EventHandler.webidl +++ b/dom/webidl/EventHandler.webidl @@ -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; diff --git a/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-auto-state-changed.html.ini b/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-auto-state-changed.html.ini deleted file mode 100644 index 3ae60affb114..000000000000 --- a/testing/web-platform/meta/css/css-contain/content-visibility/content-visibility-auto-state-changed.html.ini +++ /dev/null @@ -1,16 +0,0 @@ -[content-visibility-auto-state-changed.html] - expected: TIMEOUT - [ContentVisibilityAutoStateChange fires when relevant element gains `content-visibility:auto` (oncontentvisibilityautostatechange syntax)] - expected: TIMEOUT - - [ContentVisibilityAutoStateChange fires when not relevant element gains `content-visibility:auto`] - expected: NOTRUN - - [ContentVisibilityAutoStateChange content attribute test] - expected: NOTRUN - - [ContentVisibilityAutoStateChange fires when skipped] - expected: NOTRUN - - [ContentVisibilityAutoStateChange fires when not skipped] - expected: NOTRUN diff --git a/testing/web-platform/meta/trusted-types/trusted-types-event-handlers.html.ini b/testing/web-platform/meta/trusted-types/trusted-types-event-handlers.html.ini index 2a861396470e..f534e335212c 100644 --- a/testing/web-platform/meta/trusted-types/trusted-types-event-handlers.html.ini +++ b/testing/web-platform/meta/trusted-types/trusted-types-event-handlers.html.ini @@ -50,6 +50,9 @@ [Event handler div.onclose should be blocked.] expected: FAIL + [Event handler div.oncontentvisibilityautostatechange should be blocked.] + expected: FAIL + [Event handler div.oncontextmenu should be blocked.] expected: FAIL diff --git a/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-auto-state-changed.html b/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-auto-state-changed.html index 0333c052e4a2..6a14470c0f4b 100644 --- a/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-auto-state-changed.html +++ b/testing/web-platform/tests/css/css-contain/content-visibility/content-visibility-auto-state-changed.html @@ -24,16 +24,22 @@
+
@@ -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)); diff --git a/widget/EventMessageList.h b/widget/EventMessageList.h index 857c412bc8b3..94677ecc3919 100644 --- a/widget/EventMessageList.h +++ b/widget/EventMessageList.h @@ -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) diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py index 82c9e3ca64bf..51c68a4d1a36 100644 --- a/xpcom/ds/StaticAtoms.py +++ b/xpcom/ds/StaticAtoms.py @@ -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"),