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

Expose support for (X)HTML in requiredExtensions

Gecko allow this in requiredExtensions as well, so it makes sense to
align.
Also fix the case where the attribute is present but empty, in which
case the spec says that the test should evaluate to false.

Fixed: 662373
Change-Id: I750a29d2c014562878e2ddd7492f529a7d8ef011
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1953728Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#722934}
parent f8ff9b3e
...@@ -91,9 +91,17 @@ bool SVGTests::IsValid() const { ...@@ -91,9 +91,17 @@ bool SVGTests::IsValid() const {
return false; return false;
} }
if (!required_extensions_->Value()->Values().IsEmpty()) if (required_extensions_->IsSpecified()) {
return false; const Vector<String>& extensions = required_extensions_->Value()->Values();
// 'If a null string or empty string value is given to attribute
// 'requiredExtensions', the attribute evaluates to "false".'
if (extensions.IsEmpty())
return false;
for (const auto& extension : extensions) {
if (extension != html_names::xhtmlNamespaceURI)
return false;
}
}
return true; return true;
} }
......
<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml">
<title>requiredExtensions: present but empty attribute evaluates to false</title>
<h:link rel="help" href="https://svgwg.org/svg2-draft/struct.html#RequiredExtensionsAttribute"/>
<h:link rel="match" href="../scripted/blank.svg"/>
<rect width="100" height="100" fill="red" requiredExtensions=""/>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml">
<title>requiredExtensions: support for HTML/XHTML (non-normative)</title>
<h:link rel="match" href="reference/green-100x100.svg"/>
<switch>
<foreignObject width="100" height="100" requiredExtensions="http://www.w3.org/1999/xhtml">
<body xmlns="http://www.w3.org/1999/xhtml" style="margin: 0">
<div style="width: 100px; height: 100px; background-color: green"></div>
</body>
</foreignObject>
<rect width="100" height="100" fill="red"/>
</switch>
</svg>
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