Bug 901955 - Get 'opacity' property changes on SVG working again. r=roc

This commit is contained in:
Jonathan Watt 2013-08-14 10:51:00 +01:00
parent 898fb634c2
commit 401124f339
4 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,25 @@
<!--
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 repainting for opacity property changes</title>
<script>
function doTest() {
document.getElementById("r").style.opacity = 1;
document.documentElement.removeAttribute("class");
}
document.addEventListener("MozReftestInvalidate", doTest, false);
setTimeout(doTest, 4000); // fallback for running outside reftest
</script>
<rect width="100%" height="100%" fill="lime"/>
<rect width="100" height="100" fill="red"/>
<rect id="r" width="100" height="100" fill="lime" style="opacity:0.5"/>
</svg>

After

Width:  |  Height:  |  Size: 705 B

View File

@ -89,6 +89,7 @@ skip-if(B2G) == dynamic-marker-02.svg dynamic-marker-02-ref.svg
skip-if(B2G) == dynamic-marker-03.svg pass.svg
== dynamic-mask-01.svg pass.svg
skip-if(B2G) == dynamic-mask-contents-01.svg pass.svg
== dynamic-opacity-property-01.svg pass.svg
skip-if(B2G) == dynamic-pattern-01.svg pass.svg
skip-if(B2G) == dynamic-pattern-02.svg pass.svg
skip-if(B2G) == dynamic-pattern-contents-01.svg pass.svg

View File

@ -120,6 +120,23 @@ nsSVGPathGeometryFrame::AttributeChanged(int32_t aNameSpaceID,
return NS_OK;
}
/* virtual */ void
nsSVGPathGeometryFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
{
nsSVGPathGeometryFrameBase::DidSetStyleContext(aOldStyleContext);
if (aOldStyleContext) {
float oldOpacity = aOldStyleContext->PeekStyleDisplay()->mOpacity;
float newOpacity = StyleDisplay()->mOpacity;
if (newOpacity != oldOpacity &&
nsSVGUtils::CanOptimizeOpacity(this)) {
// nsIFrame::BuildDisplayListForStackingContext() is not going to create an
// nsDisplayOpacity display list item, so DLBI won't invalidate for us.
InvalidateFrame();
}
}
}
nsIAtom *
nsSVGPathGeometryFrame::GetType() const
{

View File

@ -56,6 +56,8 @@ public:
nsIAtom* aAttribute,
int32_t aModType) MOZ_OVERRIDE;
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
/**
* Get the "type" of the frame
*