Fixing bug 369992. Areas previously occupied by a foreignObject aren't repainted. r+sr=tor@acm.org

This commit is contained in:
jwatt%jwatt.org 2007-02-14 21:38:43 +00:00
parent bcd2b98845
commit 53905dfeea

View File

@ -122,16 +122,13 @@ nsSVGForeignObjectFrame::AttributeChanged(PRInt32 aNameSpaceID,
if (aAttribute == nsGkAtoms::width ||
aAttribute == nsGkAtoms::height) {
PostChildDirty();
UpdateCoveredRegion();
UpdateGraphic();
} else if (aAttribute == nsGkAtoms::x ||
aAttribute == nsGkAtoms::y) {
UpdateCoveredRegion();
UpdateGraphic();
} else if (aAttribute == nsGkAtoms::transform) {
// make sure our cached transform matrix gets (lazily) updated
mCanvasTM = nsnull;
UpdateCoveredRegion();
UpdateGraphic();
}
}
@ -359,7 +356,6 @@ NS_IMETHODIMP
nsSVGForeignObjectFrame::NotifyCanvasTMChanged(PRBool suppressInvalidation)
{
mCanvasTM = nsnull;
UpdateCoveredRegion();
UpdateGraphic();
return NS_OK;
}
@ -373,8 +369,13 @@ nsSVGForeignObjectFrame::NotifyRedrawSuspended()
NS_IMETHODIMP
nsSVGForeignObjectFrame::NotifyRedrawUnsuspended()
{
if (!(mParent->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD))
FlushDirtyRegion();
if (!(mParent->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
if (GetStateBits() & NS_STATE_SVG_DIRTY) {
UpdateGraphic();
} else {
FlushDirtyRegion();
}
}
return NS_OK;
}
@ -490,6 +491,9 @@ void nsSVGForeignObjectFrame::PostChildDirty()
void nsSVGForeignObjectFrame::UpdateGraphic()
{
if (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)
return;
nsSVGOuterSVGFrame *outerSVGFrame = nsSVGUtils::GetOuterSVGFrame(this);
if (!outerSVGFrame) {
NS_ERROR("null outerSVGFrame");
@ -498,13 +502,26 @@ void nsSVGForeignObjectFrame::UpdateGraphic()
PRBool suspended;
outerSVGFrame->IsRedrawSuspended(&suspended);
if (!suspended) {
nsRect rect = nsSVGUtils::FindFilterInvalidation(this);
if (rect.IsEmpty()) {
rect = mRect;
if (suspended) {
AddStateBits(NS_STATE_SVG_DIRTY);
} else {
RemoveStateBits(NS_STATE_SVG_DIRTY);
outerSVGFrame->InvalidateRect(mRect);
UpdateCoveredRegion();
nsRect filterRect;
filterRect = nsSVGUtils::FindFilterInvalidation(this);
if (!filterRect.IsEmpty()) {
outerSVGFrame->InvalidateRect(filterRect);
} else {
outerSVGFrame->InvalidateRect(mRect);
}
outerSVGFrame->InvalidateRect(rect);
}
// Clear any layout dirty region since we invalidated our whole area.
mDirtyRegion.SetEmpty();
}
void
@ -590,6 +607,7 @@ nsSVGForeignObjectFrame::FlushDirtyRegion() {
nsRect rect = nsSVGUtils::FindFilterInvalidation(this);
if (!rect.IsEmpty()) {
outerSVGFrame->InvalidateRect(rect);
mDirtyRegion.SetEmpty();
return;
}