Bug 520506 - Incorrect text getBBox in SVG. r=jwatt

This commit is contained in:
Robert Longson 2009-11-18 20:59:24 +00:00
parent 65e9728bf5
commit 3813a31710
3 changed files with 17 additions and 5 deletions

View File

@ -3,4 +3,7 @@
<g transform="scale(0.5)">
<foreignObject id="f" width="100" height="100"/>
</g>
<text id="b" x="20" y="20">b</text>
<text id="a" x="20" y="30">a</text>
<text id="y" x="20" y="40">y</text>
</svg>

Before

Width:  |  Height:  |  Size: 159 B

After

Width:  |  Height:  |  Size: 273 B

View File

@ -23,18 +23,27 @@ SimpleTest.waitForExplicitFinish();
function run()
{
var doc = $("svg").contentDocument;
function getBBox(id) {
return doc.getElementById(id).getBBox();
}
function checkBBox(id, x, y, width, height) {
var e = doc.getElementById(id);
var bbox = e.getBBox();
var bbox = getBBox(id);
is(bbox.x, x, id + ".getBBox().x");
is(bbox.y, y, id + ".getBBox().y");
is(bbox.width, width, id + ".getBBox().width");
is(bbox.height, height, id + ".getBBox().height");
}
function checkBBoxHeight(id1, id2) {
var bbox1 = getBBox(id1);
var bbox2 = getBBox(id2);
is(bbox1.height, bbox2.height, id1 + ".getBBox().height");
}
checkBBox("f", 0, 0, 100, 100);
checkBBoxHeight("a", "b");
checkBBoxHeight("a", "y");
SimpleTest.finish();
}

View File

@ -609,7 +609,7 @@ nsSVGGlyphFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace)
SetupGlobalTransform(tmpCtx);
CharacterIterator iter(this, PR_TRUE);
iter.SetInitialMatrix(tmpCtx);
AddCharactersToPath(&iter, tmpCtx);
AddBoundingBoxesToPath(&iter, tmpCtx);
tmpCtx->IdentityMatrix();
mOverrideCanvasTM = nsnull;