Bug 537623 - Part 1. Remove extra translation for <use> element in nsSVGUtils.

For nsSVGUtils::FrameSpaceInCSSPxToUserSpace:
If we give a nsSVGUseFrame to this function, it will return <use>'s x/y as
translation vector, which is not necessary. A point (a, b) in frame's
coordinate space should keep (a, b) in <use>'s coordinate space with no change.

Since we remove extra translation in nsSVGUtils::FrameSpaceInCSSPxToUserSpace,
aslo update nsSVGUtils::GetBBox accordingly.

MozReview-Commit-ID: BMjSonjoWd2

--HG--
extra : rebase_source : da629ba4464534a89718db1cd5b9705261ae4a4d
This commit is contained in:
cku 2017-01-17 17:06:16 +08:00
Родитель 555bd2c419
Коммит 47cf7545f7
1 изменённых файлов: 2 добавлений и 4 удалений

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

@ -1126,8 +1126,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags)
}
gfxMatrix matrix;
if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame ||
aFrame->GetType() == nsGkAtoms::svgUseFrame) {
if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame) {
// The spec says getBBox "Returns the tight bounding box in *current user
// space*". So we should really be doing this for all elements, but that
// needs investigation to check that we won't break too much content.
@ -1219,8 +1218,7 @@ nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(nsIFrame *aFrame)
// For foreignObject frames, nsSVGUtils::GetBBox applies their local
// transform, so we need to do the same here.
if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame ||
aFrame->GetType() == nsGkAtoms::svgUseFrame) {
if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame) {
gfxMatrix transform = static_cast<nsSVGElement*>(aFrame->GetContent())->
PrependLocalTransformsTo(gfxMatrix(), eChildToUserSpace);
NS_ASSERTION(!transform.HasNonTranslation(), "we're relying on this being an offset-only transform");