Bug 463064 - Use covered region to minimise foreignObject painting r+sr=roc

This commit is contained in:
Robert Longson 2008-12-06 15:22:01 +00:00
Родитель 43f50162ec
Коммит 668d43d2f9
4 изменённых файлов: 64 добавлений и 0 удалений

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

@ -0,0 +1,20 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Testing that foreignobject works in filters</title>
<foreignObject id="fo1" x="150" y="50" width="50" height="50">
<html:div style="width:100%; height:100%; background:lime;">
</html:div>
</foreignObject>
<foreignObject id="fo2" x="150" y="150" width="50" height="50" filter="url(#f1)">
<html:div style="width:100%; height:100%; background:lime;">
</html:div>
</foreignObject>
<filter id="f1" x="0" y="0" width="100%" height="100%">
<feOffset/>
</filter>
</svg>

После

Ширина:  |  Высота:  |  Размер: 771 B

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

@ -0,0 +1,31 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xlink="http://www.w3.org/1999/xlink" onload="m();">
<title>Testing that foreignobject works in filters</title>
<foreignObject id="fo1" x="50" y="50" width="50" height="50">
<html:div style="width:100%; height:100%; background:lime;">
</html:div>
</foreignObject>
<foreignObject id="fo2" x="50" y="150" width="50" height="50" filter="url(#f1)">
<html:div style="width:100%; height:100%; background:lime;">
</html:div>
</foreignObject>
<filter id="f1" x="0" y="0" width="100%" height="100%">
<feOffset/>
</filter>
<script>
function m() {
var svgns = "http://www.w3.org/2000/svg";
var fo1 = document.getElementById("fo1");
fo1.setAttribute("x", "150");
var fo2 = document.getElementById("fo2");
fo2.setAttribute("x", "150");
}
</script>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.0 KiB

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

@ -54,6 +54,7 @@ include moz-only/reftest.list
== filter-foreignObject-01.svg pass.svg
== filter-translated-01.svg filter-translated-01-ref.svg
== foreignObject-01.svg pass.svg
== foreignObject-02.svg foreignObject-02-ref.svg
== foreignObject-ancestor-style-change-01.svg foreignObject-ancestor-style-change-01-ref.svg
== foreignObject-change-transform-01.svg pass.svg
== foreignObject-display-01.svg pass.svg

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

@ -265,6 +265,18 @@ nsSVGForeignObjectFrame::PaintSVG(nsSVGRenderState *aContext,
return NS_ERROR_FAILURE;
}
/* Check if we need to draw anything. */
if (aDirtyRect) {
gfxRect extent = matrix.TransformBounds(
gfxRect(kid->GetRect().x, kid->GetRect().y,
kid->GetRect().width, kid->GetRect().height));
extent.RoundOut();
nsIntRect rect;
if (NS_SUCCEEDED(nsSVGUtils::GfxRectToIntRect(extent, &rect)) &&
!aDirtyRect->Intersects(rect))
return NS_OK;
}
gfxContext *gfx = aContext->GetGfxContext();
gfx->Save();