Bug 571863: Make sure to update graphic and/or invalidate transform on an inner <svg> element when its various attributes are modified. r=dholbert a=blocking-betaN+

This commit is contained in:
Robert Longson 2010-10-07 12:19:32 -07:00
Родитель 191b24cc24
Коммит 2ca2942f10
4 изменённых файлов: 69 добавлений и 4 удалений

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

@ -0,0 +1,40 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/licenses/publicdomain/
-->
<svg xmlns="http://www.w3.org/2000/svg" class="reftest-wait"
onload="startTest()">
<script>
<![CDATA[
function startTest() {
document.addEventListener("MozReftestInvalidate", boom, false);
// in case we're not gecko
setTimeout(boom, 5000);
}
function boom() {
document.getElementById('inner1').setAttribute('x', 20);
document.getElementById('inner2').setAttribute('width', 100);
document.documentElement.removeAttribute("class");
}
]]>
</script>
<rect width="100%" height="100%" fill="lime"/>
<rect x="20" y="20" width="100" height="100" fill="red"/>
<svg id="inner1" x="260" y="20" width="100" height="100">
<rect x="0" y="0" width="100" height="100" fill="lime"/>
</svg>
<rect x="20" y="140" width="100" height="100" fill="red"/>
<svg id="inner2" x="20" y="140" width="1" height="100">
<rect x="0" y="0" width="100" height="100" fill="lime"/>
</svg>
</svg>

После

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

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

@ -45,6 +45,7 @@ include svg-integration/reftest.list
== dynamic-filter-contents-01.svg dynamic-filter-contents-01-ref.svg
== dynamic-gradient-contents-01.svg pass.svg
== dynamic-gradient-contents-02.svg pass.svg
== dynamic-inner-svg-01.svg pass.svg
== dynamic-link-style-01.svg pass.svg
== dynamic-marker-01.svg pass.svg
== dynamic-marker-02.svg dynamic-marker-02-ref.svg

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

@ -157,6 +157,30 @@ nsSVGInnerSVGFrame::NotifySVGChanged(PRUint32 aFlags)
nsSVGInnerSVGFrameBase::NotifySVGChanged(aFlags);
}
NS_IMETHODIMP
nsSVGInnerSVGFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType)
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::width ||
aAttribute == nsGkAtoms::height ||
aAttribute == nsGkAtoms::preserveAspectRatio ||
aAttribute == nsGkAtoms::viewBox) {
nsSVGUtils::UpdateGraphic(this);
} else if (aAttribute == nsGkAtoms::transform ||
aAttribute == nsGkAtoms::x ||
aAttribute == nsGkAtoms::y) {
// make sure our cached transform matrix gets (lazily) updated
mCanvasTM = nsnull;
nsSVGUtils::NotifyChildrenOfSVGChange(this, TRANSFORM_CHANGED);
}
}
return NS_OK;
}
NS_IMETHODIMP_(nsIFrame*)
nsSVGInnerSVGFrame::GetFrameForPoint(const nsPoint &aPoint)
{

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

@ -56,10 +56,6 @@ public:
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
// We don't define an AttributeChanged method since changes to the
// 'x', 'y', 'width' and 'height' attributes of our content object
// are handled in nsSVGSVGElement::DidModifySVGObservable
#ifdef DEBUG
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
@ -80,6 +76,10 @@ public:
}
#endif
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType);
// nsISVGChildFrame interface:
NS_IMETHOD PaintSVG(nsSVGRenderState *aContext, const nsIntRect *aDirtyRect);
virtual void NotifySVGChanged(PRUint32 aFlags);