Commit 21dca92f authored by ed@opera.com's avatar ed@opera.com

[SVG] Transform animation leaves traces of text behind.

AffineTransform.inverse() unexpectedly returned an identity matrix when
the matrix was not invertible. This caused invalid rendering for e.g
scale(0) matrices in svg.

BUG=352603

Review URL: https://codereview.chromium.org/200053005

git-svn-id: svn://svn.chromium.org/blink/trunk@169666 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f46329f8
<svg width="620" height="450" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="textGroup" transform="translate(70,300)" font-family="sans-serif" font-size="60" text-rendering="geometricPrecision">
<rect x="254" width="1" height="1"/>
</g>
</svg>
<svg width="620" height="450" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="runTest()">
<desc>
This test places a text element so that it spans across two render tiles (note: the tile width is ~255px at the time of writing this).
If the text doesn't span across tiles then other screen updates will "cover up" the bug.
The scale(0,1) transform matrix has a 0 determinant, which means it cannot be inverted.
Any text/shape in svg that has a scale(0) transform means it should be invisible.
</desc>
<script>
<![CDATA[
function runTest() {
document.getElementById('first').setAttribute("transform", "translate(241.0859375, -21)scale(0, 1)translate(-241.0859375, 21)");
document.getElementById('second').setAttribute("transform", "translate(241.0859375, -21)scale(0, 1)translate(-241.0859375, 21)");
}
]]>
</script>
<g id="textGroup" transform="translate(70,300)" font-family="sans-serif" font-size="60" text-rendering="geometricPrecision">
<rect x="254" width="1" height="1"/>
<text id="first" x="197.7978515625" y="0" fill="red">s</text>
<text id="second" x="229.0576171875" y="0" fill="red">!</text>
</g>
</svg>
......@@ -95,7 +95,10 @@ struct PaintInfo {
if (rect == infiniteRect())
return;
rect = localToAncestorTransform.inverse().mapRect(rect);
if (localToAncestorTransform.isInvertible())
rect = localToAncestorTransform.inverse().mapRect(rect);
else
rect.setSize(IntSize(0, 0));
}
static IntRect infiniteRect() { return IntRect(LayoutRect::infiniteRect()); }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment