Commit bc65cec8 authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Check multiple possible values for 'image-rendering'

Allow checking for an array of values rather than a single value. This
clears up the situation where different UAs support different (and
disjoint) sets of values for a property. In this case 'image-rendering'.

Also adjust assertPresentationAttributeIsNotSupported(...) such that
the assert description makes more sense by adding a negation.

Bug: 1056055
Change-Id: Ibe5cddb09f242754f02aa96b4bc8571f2aabecf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2082557Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#746056}
parent 581d68b9
This is a testharness.js-based test. This is a testharness.js-based test.
Found 58 tests; 54 PASS, 4 FAIL, 0 TIMEOUT, 0 NOTRUN. Found 58 tests; 55 PASS, 3 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS alignment-baseline presentation attribute supported on an irrelevant element PASS alignment-baseline presentation attribute supported on an irrelevant element
PASS baseline-shift presentation attribute supported on an irrelevant element PASS baseline-shift presentation attribute supported on an irrelevant element
PASS clip-path presentation attribute supported on an irrelevant element PASS clip-path presentation attribute supported on an irrelevant element
...@@ -24,7 +24,7 @@ PASS font-stretch presentation attribute supported on an irrelevant element ...@@ -24,7 +24,7 @@ PASS font-stretch presentation attribute supported on an irrelevant element
PASS font-style presentation attribute supported on an irrelevant element PASS font-style presentation attribute supported on an irrelevant element
PASS font-variant presentation attribute supported on an irrelevant element PASS font-variant presentation attribute supported on an irrelevant element
PASS font-weight presentation attribute supported on an irrelevant element PASS font-weight presentation attribute supported on an irrelevant element
FAIL image-rendering presentation attribute supported on an irrelevant element assert_true: Presentation attribute image-rendering="optimizeSpeed" should be supported on path element expected true got false PASS image-rendering presentation attribute supported on an irrelevant element
PASS letter-spacing presentation attribute supported on an irrelevant element PASS letter-spacing presentation attribute supported on an irrelevant element
PASS lighting-color presentation attribute supported on an irrelevant element PASS lighting-color presentation attribute supported on an irrelevant element
PASS marker-end presentation attribute supported on an irrelevant element PASS marker-end presentation attribute supported on an irrelevant element
......
This is a testharness.js-based test. This is a testharness.js-based test.
Found 69 tests; 65 PASS, 4 FAIL, 0 TIMEOUT, 0 NOTRUN. Found 69 tests; 66 PASS, 3 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS alignment-baseline presentation attribute supported on a relevant element PASS alignment-baseline presentation attribute supported on a relevant element
PASS baseline-shift presentation attribute supported on a relevant element PASS baseline-shift presentation attribute supported on a relevant element
PASS clip-path presentation attribute supported on a relevant element PASS clip-path presentation attribute supported on a relevant element
...@@ -28,7 +28,7 @@ PASS font-style presentation attribute supported on a relevant element ...@@ -28,7 +28,7 @@ PASS font-style presentation attribute supported on a relevant element
PASS font-variant presentation attribute supported on a relevant element PASS font-variant presentation attribute supported on a relevant element
PASS font-weight presentation attribute supported on a relevant element PASS font-weight presentation attribute supported on a relevant element
PASS height presentation attribute supported on a relevant element PASS height presentation attribute supported on a relevant element
FAIL image-rendering presentation attribute supported on a relevant element assert_true: Presentation attribute image-rendering="optimizeSpeed" should be supported on image element expected true got false PASS image-rendering presentation attribute supported on a relevant element
PASS letter-spacing presentation attribute supported on a relevant element PASS letter-spacing presentation attribute supported on a relevant element
PASS lighting-color presentation attribute supported on a relevant element PASS lighting-color presentation attribute supported on a relevant element
PASS marker-end presentation attribute supported on a relevant element PASS marker-end presentation attribute supported on a relevant element
......
...@@ -19,7 +19,7 @@ PASS d presentation attribute not supported on other elements ...@@ -19,7 +19,7 @@ PASS d presentation attribute not supported on other elements
PASS fill presentation attribute not supported on animate PASS fill presentation attribute not supported on animate
PASS fill presentation attribute not supported on animateMotion PASS fill presentation attribute not supported on animateMotion
PASS fill presentation attribute not supported on animateTransform PASS fill presentation attribute not supported on animateTransform
FAIL fill presentation attribute not supported on discard assert_false: Presentation attribute fill="blue" should be supported on discard element expected false got true FAIL fill presentation attribute not supported on discard assert_false: Presentation attribute fill="blue" should not be supported on discard element expected false got true
PASS fill presentation attribute not supported on set PASS fill presentation attribute not supported on set
PASS transform presentation attribute supported on g PASS transform presentation attribute supported on g
PASS patternTransform presentation attribute supported on pattern PASS patternTransform presentation attribute supported on pattern
......
This is a testharness.js-based test. This is a testharness.js-based test.
Found 58 tests; 54 PASS, 4 FAIL, 0 TIMEOUT, 0 NOTRUN. Found 58 tests; 55 PASS, 3 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS alignment-baseline presentation attribute supported on an unknown SVG element PASS alignment-baseline presentation attribute supported on an unknown SVG element
PASS baseline-shift presentation attribute supported on an unknown SVG element PASS baseline-shift presentation attribute supported on an unknown SVG element
PASS clip-path presentation attribute supported on an unknown SVG element PASS clip-path presentation attribute supported on an unknown SVG element
...@@ -24,7 +24,7 @@ PASS font-stretch presentation attribute supported on an unknown SVG element ...@@ -24,7 +24,7 @@ PASS font-stretch presentation attribute supported on an unknown SVG element
PASS font-style presentation attribute supported on an unknown SVG element PASS font-style presentation attribute supported on an unknown SVG element
PASS font-variant presentation attribute supported on an unknown SVG element PASS font-variant presentation attribute supported on an unknown SVG element
PASS font-weight presentation attribute supported on an unknown SVG element PASS font-weight presentation attribute supported on an unknown SVG element
FAIL image-rendering presentation attribute supported on an unknown SVG element assert_true: Presentation attribute image-rendering="optimizeSpeed" should be supported on unknown element expected true got false PASS image-rendering presentation attribute supported on an unknown SVG element
PASS letter-spacing presentation attribute supported on an unknown SVG element PASS letter-spacing presentation attribute supported on an unknown SVG element
PASS lighting-color presentation attribute supported on an unknown SVG element PASS lighting-color presentation attribute supported on an unknown SVG element
PASS marker-end presentation attribute supported on an unknown SVG element PASS marker-end presentation attribute supported on an unknown SVG element
......
...@@ -145,7 +145,7 @@ const PROPERTIES = { ...@@ -145,7 +145,7 @@ const PROPERTIES = {
irrelevantElement: null, irrelevantElement: null,
}, },
"image-rendering": { "image-rendering": {
value: "optimizeSpeed", value: ["optimizeSpeed", "pixelated"],
relevantElement: "image", relevantElement: "image",
irrelevantElement: "path", irrelevantElement: "path",
}, },
...@@ -361,17 +361,25 @@ function presentationAttributeIsSupported(element, attribute, value, property) { ...@@ -361,17 +361,25 @@ function presentationAttributeIsSupported(element, attribute, value, property) {
return propertyValueBefore != propertyValueAfter; return propertyValueBefore != propertyValueAfter;
} }
function assertPresentationAttributeIsSupported(element, attribute, value, property) { function assertPresentationAttributeIsSupported(element, attribute, values, property) {
if (typeof values === 'string')
values = [values];
let supported = values.some(
value => presentationAttributeIsSupported(element, attribute, value, property));
assert_true( assert_true(
presentationAttributeIsSupported(element, attribute, value, property), supported,
`Presentation attribute ${attribute}="${value}" should be supported on ${element} element` `Presentation attribute ${attribute}="${values.join(" | ")}" should be supported on ${element} element`
); );
} }
function assertPresentationAttributeIsNotSupported(element, attribute, value, property) { function assertPresentationAttributeIsNotSupported(element, attribute, values, property) {
if (typeof values === 'string')
values = [values];
let supported = values.some(
value => presentationAttributeIsSupported(element, attribute, value, property));
assert_false( assert_false(
presentationAttributeIsSupported(element, attribute, value, property), supported,
`Presentation attribute ${attribute}="${value}" should be supported on ${element} element` `Presentation attribute ${attribute}="${values.join(" | ")}" should not be supported on ${element} element`
); );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment