Bug 1551137 - <svg:mpath> should work in Shadow DOM. r=longsonr

Differential Revision: https://phabricator.services.mozilla.com/D30894

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-05-13 17:28:59 +00:00
Родитель 4e4121ea80
Коммит ab3478ba32
3 изменённых файлов: 37 добавлений и 2 удалений

Просмотреть файл

@ -77,7 +77,7 @@ nsresult SVGMPathElement::BindToTree(Document* aDocument, nsIContent* aParent,
SVGMPathElementBase::BindToTree(aDocument, aParent, aBindingParent);
NS_ENSURE_SUCCESS(rv, rv);
if (aDocument) {
if (IsInComposedDoc()) {
const nsAttrValue* hrefAttrValue =
HasAttr(kNameSpaceID_None, nsGkAtoms::href)
? mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_None)
@ -103,7 +103,7 @@ bool SVGMPathElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
aNamespaceID, aAttribute, aValue, aMaybeScriptedPrincipal, aResult);
if ((aNamespaceID == kNameSpaceID_XLink ||
aNamespaceID == kNameSpaceID_None) &&
aAttribute == nsGkAtoms::href && IsInUncomposedDoc()) {
aAttribute == nsGkAtoms::href && IsInComposedDoc()) {
// Note: If we fail the IsInDoc call, it's ok -- we'll update the target
// on next BindToTree call.

Просмотреть файл

@ -0,0 +1,34 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" class="reftest-wait">
<title>Test that pathLength works inside a shadow tree</title>
<defs>
<path id="path" pathLength="100" d="M0,0 h400" />
<g id="content">
<rect width="100%" height="100%" fill="lime"/>
<!-- calcMode="linear" -->
<rect x="10" y="10" width="100" height="100" fill="red"/>
<rect x="-190" y="10" width="100" height="100" fill="lime">
<animateMotion begin="100s" dur="1s" keyPoints="0;1" keyTimes="0;1" calcMode="linear">
<mpath xlink:href="#path" />
</animateMotion>
</rect>
<!-- calcMode="paced" -->
<rect x="10" y="110" width="100" height="100" fill="red"/>
<rect x="-190" y="110" width="100" height="100" fill="lime">
<animateMotion begin="100s" dur="1s">
<mpath xlink:href="#path" />
</animateMotion>
</rect>
</g>
</defs>
<script xlink:href="../smil-util.js" type="text/javascript"/>
<script type="text/javascript">
function doTest() {
setTimeAndSnapshot(100.5, true);
}
window.addEventListener("MozReftestInvalidate", doTest, false);
</script>
<use xlink:href="#content"></use>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Просмотреть файл

@ -19,3 +19,4 @@ fuzzy-if(skiaContent,0-1,0-30) == animateMotion-values-paced-1b.svg animateMotio
== animateMotion-mpath-pathLength-1.svg lime.svg
== animateMotion-mpath-targetChange-1.svg lime.svg
== animateMotion-mpath-target-transform-1.svg lime.svg
== animateMotion-mpath-shadow.svg lime.svg