Bug 876450 - non-scaling-stroke doesn't work with svg.text.css-frames.enabled. r=heycam

--HG--
rename : layout/reftests/svg/non-scaling-stroke-03-ref.svg => layout/reftests/svg/text/dynamic-non-scaling-stroke-ref.svg
rename : layout/reftests/svg/non-scaling-stroke-03.svg => layout/reftests/svg/text/dynamic-non-scaling-stroke.svg
This commit is contained in:
Robert Longson 2013-06-16 12:05:39 +01:00
parent afb21c2442
commit 9002dd84b5
6 changed files with 56 additions and 10 deletions

View File

@ -0,0 +1,11 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" style="font: 32px sans-serif; text-rendering: geometricPrecision">
<text x="100" y="100" stroke="blue" stroke-width="5"><tspan>hello</tspan> there</text>
<text x="100" y="160" stroke="blue" stroke-width="5"><tspan>hello</tspan> there</text>
<text x="100" y="220" stroke="blue" stroke-width="5"><tspan>hello</tspan> there</text>
</svg>

After

Width:  |  Height:  |  Size: 501 B

View File

@ -0,0 +1,31 @@
<!--
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">
<title>Test non-scaling-stroke repainting when ancestor transforms change</title>
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=875069 -->
<style>
.noscale {
vector-effect: non-scaling-stroke;
}
</style>
<script>
function doTest() {
document.getElementById("g").setAttribute("transform", "scale(2)");
document.documentElement.removeAttribute('class');
}
document.addEventListener("MozReftestInvalidate", doTest, false);
setTimeout(doTest, 4000); // fallback for running outside reftest
</script>
<g id="g" style="font: 16px sans-serif; text-rendering: geometricPrecision">
<text x="50" y="50" stroke="blue" stroke-width="5" class="noscale"><tspan class="noscale">hello</tspan> there</text>
<text x="50" y="80" stroke="blue" stroke-width="2.5"><tspan class="noscale" stroke-width="5">hello</tspan> there</text>
<text x="50" y="110" stroke="blue" stroke-width="5" class="noscale"><tspan stroke-width="2.5">hello</tspan> there</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -157,6 +157,7 @@ HTTP(../..) == simple-transform-rotate.svg simple-transform-rotate-ref.svg
== dynamic-font-size-4.svg dynamic-font-size-4-ref.svg
== dynamic-dominant-baseline.svg dynamic-dominant-baseline-ref.svg
== dynamic-multiple-x.svg dynamic-multiple-x-ref.svg
fuzzy-if(!d2d,14,2) == dynamic-non-scaling-stroke.svg dynamic-non-scaling-stroke-ref.svg
# text and masks
HTTP(../..) == mask-applied.svg mask-applied-ref.svg

View File

@ -3232,6 +3232,12 @@ nsSVGTextFrame2::NotifySVGChanged(uint32_t aFlags)
needNewBounds = true;
needGlyphMetricsUpdate = true;
}
if (StyleSVGReset()->mVectorEffect ==
NS_STYLE_VECTOR_EFFECT_NON_SCALING_STROKE) {
// Stroke currently contributes to our mRect, and our stroke depends on
// the transform to our outer-<svg> if |vector-effect:non-scaling-stroke|.
needNewBounds = true;
}
}
if (needNewBounds) {

View File

@ -1334,13 +1334,13 @@ nsSVGUtils::GetFirstNonAAncestorFrame(nsIFrame* aStartFrame)
gfxMatrix
nsSVGUtils::GetStrokeTransform(nsIFrame *aFrame)
{
if (aFrame->GetContent()->IsNodeOfType(nsINode::eTEXT)) {
aFrame = aFrame->GetParent();
}
if (aFrame->StyleSVGReset()->mVectorEffect ==
NS_STYLE_VECTOR_EFFECT_NON_SCALING_STROKE) {
if (aFrame->GetContent()->IsNodeOfType(nsINode::eTEXT)) {
aFrame = aFrame->GetParent();
}
nsIContent *content = aFrame->GetContent();
NS_ABORT_IF_FALSE(content->IsSVG(), "bad cast");
@ -1732,14 +1732,10 @@ GetStrokeDashData(nsIFrame* aFrame,
*aDashOffset = aObjectPaint->GetStrokeDashOffset();
} else {
*aDashOffset = nsSVGUtils::CoordToFloat(presContext,
ctx,
style->mStrokeDashoffset);
ctx,
style->mStrokeDashoffset);
}
if (content->IsNodeOfType(nsINode::eTEXT)) {
content = content->GetParent();
}
return (totalLength > 0.0);
}

View File

@ -61,6 +61,7 @@ foreignObject {
*|*::-moz-svg-text {
unicode-bidi: inherit;
vector-effect: inherit;
}
*[xml|space=preserve] {