mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 15:26:07 +00:00
Bug 1815061 - Fix handling of startOffset and stroke-dasharray when the pathLength attribute is zero r=emilio
See https://github.com/w3c/svgwg/issues/81 Differential Revision: https://phabricator.services.mozilla.com/D168899
This commit is contained in:
parent
191b58a8a0
commit
350f9b6199
@ -184,7 +184,7 @@ static DashState GetStrokeDashData(
|
||||
pathScale =
|
||||
static_cast<SVGGeometryElement*>(aElement)->GetPathLengthScale(
|
||||
SVGGeometryElement::eForStroking);
|
||||
if (pathScale <= 0) {
|
||||
if (pathScale <= 0 || !IsFinite(pathScale)) {
|
||||
return eContinuousStroke;
|
||||
}
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ float SVGGeometryElement::GetPathLengthScale(PathLengthScaleForType aFor) {
|
||||
MOZ_ASSERT(aFor == eForTextPath || aFor == eForStroking, "Unknown enum");
|
||||
if (mPathLength.IsExplicitlySet()) {
|
||||
float authorsPathLengthEstimate = mPathLength.GetAnimValue();
|
||||
if (authorsPathLengthEstimate > 0) {
|
||||
if (authorsPathLengthEstimate >= 0) {
|
||||
RefPtr<Path> path = GetOrBuildPathForMeasuring();
|
||||
if (!path) {
|
||||
// The path is empty or invalid so its length must be zero and
|
||||
|
@ -4605,12 +4605,18 @@ gfxFloat SVGTextFrame::GetStartOffset(nsIFrame* aTextPathFrame) {
|
||||
&tp->mLengthAttributes[SVGTextPathElement::STARTOFFSET];
|
||||
|
||||
if (length->IsPercentage()) {
|
||||
if (!IsFinite(GetOffsetScale(aTextPathFrame))) {
|
||||
// Either pathLength="0" for this path or the path has 0 length.
|
||||
return 0.0;
|
||||
}
|
||||
RefPtr<Path> data = GetTextPath(aTextPathFrame);
|
||||
return data ? length->GetAnimValInSpecifiedUnits() * data->ComputeLength() /
|
||||
100.0
|
||||
: 0.0;
|
||||
}
|
||||
return length->GetAnimValue(tp) * GetOffsetScale(aTextPathFrame);
|
||||
float lengthValue = length->GetAnimValue(tp);
|
||||
// If offsetScale is infinity we want to return 0 not NaN
|
||||
return lengthValue == 0 ? 0.0 : lengthValue * GetOffsetScale(aTextPathFrame);
|
||||
}
|
||||
|
||||
void SVGTextFrame::DoTextPathLayout() {
|
||||
|
@ -1,3 +0,0 @@
|
||||
[pathLength-zero-percentage.svg]
|
||||
expected:
|
||||
FAIL
|
@ -1,3 +0,0 @@
|
||||
[pathLength-zero.svg]
|
||||
expected:
|
||||
FAIL
|
@ -1,2 +0,0 @@
|
||||
[pathlength-path-zero.svg]
|
||||
expected: FAIL
|
Loading…
x
Reference in New Issue
Block a user