diff --git a/components/style/values/specified/gecko.rs b/components/style/values/specified/gecko.rs index b36cd582aed0..486a33eaf1ea 100644 --- a/components/style/values/specified/gecko.rs +++ b/components/style/values/specified/gecko.rs @@ -81,6 +81,11 @@ impl ToNsCssValue for PixelOrPercentage { } /// The value of an IntersectionObserver's rootMargin property. +/// +/// Only bare px or percentage values are allowed. Other length units and +/// calc() values are not allowed. +/// +/// https://w3c.github.io/IntersectionObserver/#parse-a-root-margin pub struct IntersectionObserverRootMargin(pub Rect); impl Parse for IntersectionObserverRootMargin { diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index b06f515f028d..7d35c4584904 100644 --- a/tests/wpt/metadata/MANIFEST.json +++ b/tests/wpt/metadata/MANIFEST.json @@ -557079,7 +557079,7 @@ "testharness" ], "intersection-observer/observer-exceptions.html": [ - "28ccc6905713894b43033e30949170439215bf2e", + "85d5416475091c1020e0ff92b15f841bf58c606e", "testharness" ], "intersection-observer/observer-in-iframe.html": [ diff --git a/tests/wpt/web-platform-tests/intersection-observer/observer-exceptions.html b/tests/wpt/web-platform-tests/intersection-observer/observer-exceptions.html index b44b7bd0cc13..d4f178be51c3 100644 --- a/tests/wpt/web-platform-tests/intersection-observer/observer-exceptions.html +++ b/tests/wpt/web-platform-tests/intersection-observer/observer-exceptions.html @@ -31,7 +31,19 @@ assert_throws("SYNTAX_ERR", function() { new IntersectionObserver(e => {}, {rootMargin: "auto"}) }) -}, 'IntersectionObserver constructor width { rootMargin: "auto" }'); +}, 'IntersectionObserver constructor with { rootMargin: "auto" }'); + +test(function () { + assert_throws("SYNTAX_ERR", function() { + new IntersectionObserver(e => {}, {rootMargin: "calc(1px + 2px)"}) + }) +}, 'IntersectionObserver constructor with { rootMargin: "calc(1px + 2px)" }'); + +test(function () { + assert_throws("SYNTAX_ERR", function() { + new IntersectionObserver(e => {}, {rootMargin: "1px !important"}) + }) +}, 'IntersectionObserver constructor with { rootMargin: "1px !important" }'); test(function () { assert_throws("SYNTAX_ERR", function() {