Bug 1967479 - Clear vertices if GetOrBuildPathForMeasuring() fails. r=longsonr
It's failing here: https://searchfox.org/mozilla-central/rev/02d33f4bf984f65bd394bfd2d19d66569ae2cfe1/dom/svg/SVGEllipseElement.cpp#157-159 Which makes sense I think, because off the zero radii. Keep the state consistent in that case. Differential Revision: https://phabricator.services.mozilla.com/D250624
This commit is contained in:
committed by
ealvarez@mozilla.com
parent
e320401632
commit
ff05cd51eb
@@ -208,17 +208,21 @@ void SVGMotionSMILAnimationFunction::RebuildPathAndVerticesFromMpathElem(
|
|||||||
mPathSourceType = ePathSourceType_Mpath;
|
mPathSourceType = ePathSourceType_Mpath;
|
||||||
|
|
||||||
// Use the shape that's the target of our chosen <mpath> child.
|
// Use the shape that's the target of our chosen <mpath> child.
|
||||||
SVGGeometryElement* shapeElem = aMpathElem->GetReferencedPath();
|
SVGGeometryElement* shape = aMpathElem->GetReferencedPath();
|
||||||
if (shapeElem && shapeElem->HasValidDimensions()) {
|
if (!shape || !shape->HasValidDimensions()) {
|
||||||
bool ok = shapeElem->GetDistancesFromOriginToEndsOfVisibleSegments(
|
return;
|
||||||
&mPathVertices);
|
}
|
||||||
if (!ok) {
|
if (!shape->GetDistancesFromOriginToEndsOfVisibleSegments(&mPathVertices)) {
|
||||||
mPathVertices.Clear();
|
mPathVertices.Clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mPathVertices.Length()) {
|
if (mPathVertices.IsEmpty()) {
|
||||||
mPath = shapeElem->GetOrBuildPathForMeasuring();
|
return;
|
||||||
}
|
}
|
||||||
|
mPath = shape->GetOrBuildPathForMeasuring();
|
||||||
|
if (!mPath) {
|
||||||
|
mPathVertices.Clear();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +241,7 @@ void SVGMotionSMILAnimationFunction::RebuildPathAndVerticesFromPathAttr() {
|
|||||||
|
|
||||||
mPath = path.BuildPathForMeasuring(1.0f);
|
mPath = path.BuildPathForMeasuring(1.0f);
|
||||||
bool ok = path.GetDistancesFromOriginToEndsOfVisibleSegments(&mPathVertices);
|
bool ok = path.GetDistancesFromOriginToEndsOfVisibleSegments(&mPathVertices);
|
||||||
if (!ok || !mPathVertices.Length()) {
|
if (!ok || mPathVertices.IsEmpty() || !mPath) {
|
||||||
mPath = nullptr;
|
mPath = nullptr;
|
||||||
mPathVertices.Clear();
|
mPathVertices.Clear();
|
||||||
}
|
}
|
||||||
@@ -265,7 +269,6 @@ void SVGMotionSMILAnimationFunction::RebuildPathAndVertices(
|
|||||||
mValueNeedsReparsingEverySample = false;
|
mValueNeedsReparsingEverySample = false;
|
||||||
} else {
|
} else {
|
||||||
// Get path & vertices from basic SMIL attrs: from/by/to/values
|
// Get path & vertices from basic SMIL attrs: from/by/to/values
|
||||||
|
|
||||||
RebuildPathAndVerticesFromBasicAttrs(aTargetElement);
|
RebuildPathAndVerticesFromBasicAttrs(aTargetElement);
|
||||||
mValueNeedsReparsingEverySample = true;
|
mValueNeedsReparsingEverySample = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", async () => {
|
||||||
|
const frame = document.createElementNS("http://www.w3.org/1999/xhtml", "frame")
|
||||||
|
document.documentElement.appendChild(frame)
|
||||||
|
frame.src = `data:text/html,` + encodeURIComponent(`<!doctype html>
|
||||||
|
<svg>
|
||||||
|
<ellipse id="id_8" ry="100pt"></ellipse>
|
||||||
|
<animateMotion>
|
||||||
|
<desc></desc>
|
||||||
|
<mpath xlink:href="#id_8"></mpath>
|
||||||
|
</animateMotion>
|
||||||
|
</svg>`);
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user