Bug 952270 - Null check result of GetPathForLengthOrPositionMeasuring in nsSVGTextFrame2::GetTextPath. r=longsonr

This commit is contained in:
Cameron McCormack 2013-12-20 15:26:28 +11:00
parent 9a7416c000
commit de5393c04d
3 changed files with 29 additions and 15 deletions

View File

@ -0,0 +1,9 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path id="path" transform="scale(2,1)" />
<text>
<textPath xlink:href="#path">F</textPath>
</text>
</svg>

After

Width:  |  Height:  |  Size: 213 B

View File

@ -177,3 +177,4 @@ load 897342-1.svg
load 898909-1.svg
load 898951-1.svg
load 919371-1.xhtml
load 952270-1.svg

View File

@ -4719,22 +4719,26 @@ nsSVGTextFrame2::GetTextPath(nsIFrame* aTextPathFrame)
{
nsIFrame *pathFrame = GetTextPathPathFrame(aTextPathFrame);
if (pathFrame) {
nsSVGPathGeometryElement *element =
static_cast<nsSVGPathGeometryElement*>(pathFrame->GetContent());
RefPtr<Path> path = element->GetPathForLengthOrPositionMeasuring();
gfxMatrix matrix = element->PrependLocalTransformsTo(gfxMatrix());
if (!matrix.IsIdentity()) {
RefPtr<PathBuilder> builder =
path->TransformedCopyToBuilder(ToMatrix(matrix));
path = builder->Finish();
}
return path.forget();
if (!pathFrame) {
return nullptr;
}
return nullptr;
nsSVGPathGeometryElement *element =
static_cast<nsSVGPathGeometryElement*>(pathFrame->GetContent());
RefPtr<Path> path = element->GetPathForLengthOrPositionMeasuring();
if (!path) {
return nullptr;
}
gfxMatrix matrix = element->PrependLocalTransformsTo(gfxMatrix());
if (!matrix.IsIdentity()) {
RefPtr<PathBuilder> builder =
path->TransformedCopyToBuilder(ToMatrix(matrix));
path = builder->Finish();
}
return path.forget();
}
gfxFloat