Bug 525095 - Fix artifacts being left behind when text is resized. r=roc

This commit is contained in:
Robert Longson 2012-01-12 09:59:39 +00:00
parent e15bf8beb7
commit 355e616a78
4 changed files with 32 additions and 21 deletions

View File

@ -0,0 +1,27 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" class="reftest-wait" onload="sample()">
<script>
var curXScale = 3;
function sample() {
var g = document.getElementById("g");
g.setAttribute("transform", "scale(" + curXScale + " 1)");
if (curXScale > 1) {
curXScale -= 0.1;
setTimeout("sample()", 1);
} else {
document.documentElement.removeAttribute('class');
}
}
</script>
<rect width="100%" height="100%" fill="lime"/>
<g font-family="sans-serif" font-weight="bold" font-size="120px" id="g">
<text y="100">A</text>
<text y="250">V</text>
</g>
<rect width="100" height="100%" fill="lime"/>
</svg>

After

Width:  |  Height:  |  Size: 796 B

View File

@ -98,6 +98,7 @@ include svg-integration/reftest.list
== dynamic-text-03.svg dynamic-text-03-ref.svg
fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == dynamic-text-04.svg dynamic-text-04-ref.svg # bug 421587 for WinXP
== dynamic-text-05.svg pass.svg
== dynamic-text-06.svg pass.svg
== dynamic-textPath-01.svg dynamic-textPath-01-ref.svg
== dynamic-use-01.svg pass.svg
== dynamic-use-02.svg pass.svg

View File

@ -464,11 +464,9 @@ nsSVGGlyphFrame::UpdateCoveredRegion()
return NS_OK;
}
mPropagateTransform = false;
CharacterIterator iter(this, true);
iter.SetInitialMatrix(tmpCtx);
AddBoundingBoxesToPath(&iter, tmpCtx);
mPropagateTransform = true;
tmpCtx->IdentityMatrix();
// Be careful when replacing the following logic to get the fill and stroke
@ -1462,23 +1460,10 @@ nsSVGGlyphFrame::NotifyGlyphMetricsChange()
containerFrame->NotifyGlyphMetricsChange();
}
bool
nsSVGGlyphFrame::GetGlobalTransform(gfxMatrix *aMatrix)
{
if (!mPropagateTransform) {
aMatrix->Reset();
return true;
}
*aMatrix = GetCanvasTM();
return !aMatrix->IsSingular();
}
void
nsSVGGlyphFrame::SetupGlobalTransform(gfxContext *aContext)
{
gfxMatrix matrix;
GetGlobalTransform(&matrix);
gfxMatrix matrix = GetCanvasTM();
if (!matrix.IsSingular()) {
aContext->Multiply(matrix);
}
@ -1557,7 +1542,8 @@ nsSVGGlyphFrame::EnsureTextRun(float *aDrawScale, float *aMetricsScale,
gfxMatrix m;
if (aForceGlobalTransform ||
!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
if (!GetGlobalTransform(&m))
m = GetCanvasTM();
if (m.IsSingular())
return false;
}

View File

@ -68,8 +68,7 @@ protected:
mStartIndex(0),
mCompressWhitespace(true),
mTrimLeadingWhitespace(false),
mTrimTrailingWhitespace(false),
mPropagateTransform(true)
mTrimTrailingWhitespace(false)
{}
~nsSVGGlyphFrame()
{
@ -232,7 +231,6 @@ protected:
gfxContext *aContext);
void NotifyGlyphMetricsChange();
bool GetGlobalTransform(gfxMatrix *aMatrix);
void SetupGlobalTransform(gfxContext *aContext);
nsresult GetHighlight(PRUint32 *charnum, PRUint32 *nchars,
nscolor *foreground, nscolor *background);
@ -255,7 +253,6 @@ protected:
bool mCompressWhitespace;
bool mTrimLeadingWhitespace;
bool mTrimTrailingWhitespace;
bool mPropagateTransform;
};
#endif