diff options
author | Cameron McCormack <cam@mcc.id.au> | 2017-10-17 15:08:52 +0800 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-10-17 14:43:00 +0200 |
commit | 893415c85a8ed475a06f7b92f49f4d5eb30311a0 (patch) | |
tree | ec544c1ad4e24993cb4f9f861188c9e6cd3d7489 | |
parent | ac74cd57a257fc95e0513524e196c91807c18bba (diff) | |
download | servo-893415c85a8ed475a06f7b92f49f4d5eb30311a0.tar.gz servo-893415c85a8ed475a06f7b92f49f4d5eb30311a0.zip |
style: Add some more tests for disallowed rootMargin values.
-rw-r--r-- | components/style/values/specified/gecko.rs | 5 | ||||
-rw-r--r-- | tests/wpt/metadata/MANIFEST.json | 2 | ||||
-rw-r--r-- | tests/wpt/web-platform-tests/intersection-observer/observer-exceptions.html | 14 |
3 files changed, 19 insertions, 2 deletions
diff --git a/components/style/values/specified/gecko.rs b/components/style/values/specified/gecko.rs index b36cd582aed..486a33eaf1e 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<PixelOrPercentage>); impl Parse for IntersectionObserverRootMargin { diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json index b06f515f028..7d35c458490 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 b44b7bd0cc1..d4f178be51c 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 @@ test(function () { 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() { |