Bug 1417841 - Don't reset <textPath> first character coordinate to 0 when an ancestor text content element specifies an explicit position coordinate. r=longsonr

MozReview-Commit-ID: KpJCuYwXxXC
This commit is contained in:
Cameron McCormack
2017-11-16 13:19:11 +08:00
parent 4150f9115e
commit a9d7325bcf
7 changed files with 53 additions and 4 deletions

View File

@@ -4581,15 +4581,22 @@ SVGTextFrame::ResolvePositionsForNode(nsIContent* aContent,
}
if (aContent->IsSVGElement(nsGkAtoms::textPath)) {
// <textPath> elements are as if they are specified with x="0" y="0", but
// only if they actually have some text content.
// <textPath> elements behave as if they have x="0" y="0" on them, but only
// if there is not a value for the coordinates that got inherited from a
// parent. We skip this if there is no text content, so that empty
// <textPath>s don't interrupt the layout of text in the parent element.
if (HasTextContent(aContent)) {
if (MOZ_UNLIKELY(aIndex >= mPositions.Length())) {
MOZ_ASSERT_UNREACHABLE("length of mPositions does not match characters "
"found by iterating content");
return false;
}
mPositions[aIndex].mPosition = gfxPoint();
if (!mPositions[aIndex].IsXSpecified()) {
mPositions[aIndex].mPosition.x = 0.0;
}
if (!mPositions[aIndex].IsYSpecified()) {
mPositions[aIndex].mPosition.y = 0.0;
}
mPositions[aIndex].mStartOfChunk = true;
}
} else if (!aContent->IsSVGElement(nsGkAtoms::a)) {