Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Unified Diff: LayoutTests/svg/custom/disallow-non-lengths-in-attrs.html

Issue 262093007: Tighten error checking from SVGLength parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update expected file Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/svg/custom/disallow-non-lengths-in-attrs-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/svg/custom/disallow-non-lengths-in-attrs.html
diff --git a/LayoutTests/svg/custom/disallow-non-lengths-in-attrs.html b/LayoutTests/svg/custom/disallow-non-lengths-in-attrs.html
new file mode 100644
index 0000000000000000000000000000000000000000..e6aaff5b28a39e9600e01bbcc44d3befc9343136
--- /dev/null
+++ b/LayoutTests/svg/custom/disallow-non-lengths-in-attrs.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<!-- Simple test for
+
+ https://svgwg.org/svg2-draft/styling.html#WidthProperty
+ https://svgwg.org/svg2-draft/styling.html#HeightProperty
+
+ "For backwards compatibility, when the ‘width’ or ‘height’
+ properties are specified as a presentation attributes, only the
+ values that match the <length> production shall be mapped to
+ CSS. Any other value must be treated as invalid." -->
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<span style="width:200px">
+ <svg id="svg"></svg>
+ <svg width="400">
+ <foreignObject id="fO">
+ </foreignObject>
+ </svg>
+</span>
+<script>
+ function setWidth(selector, width) {
+ try { document.querySelector(selector).setAttribute('width', width); } catch (err) {}
+ }
+ function getWidth(selector) {
+ return document.querySelector(selector).getBoundingClientRect().width;
+ }
+ var invalid_widths = [ 'auto', 'initial', 'inherit', 'foo' ];
+ invalid_widths.forEach(function(invalid_width) {
+ setWidth('#svg', invalid_width);
+ test(function() {
+ assert_equals(getWidth('#svg'), 0);
+ }, "Test width '" + invalid_width + "' on SVGSVGElement");
+
+ setWidth('#fO', invalid_width);
+ test(function() {
+ assert_equals(getWidth('#fO'), 0);
+ }, "Test width '" + invalid_width + "' on SVGForeignObject");
+ });
+</script>
« no previous file with comments | « no previous file | LayoutTests/svg/custom/disallow-non-lengths-in-attrs-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698