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