Bug 364811 - svg:svg not live to length modifications. r=jwatt, sr=roc

git-svn-id: svn://10.0.0.236/trunk@217723 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
tor%cs.brown.edu 2007-01-04 14:39:54 +00:00
parent 5ac72b9307
commit 9a3460d709
2 changed files with 34 additions and 19 deletions

View File

@ -1193,26 +1193,8 @@ nsSVGSVGElement::DidModifySVGObservable (nsISVGValue* observable,
}
}
// invalidate viewbox -> viewport xform & inform frames
mViewBoxToViewportTransform = nsnull;
InvalidateTransformNotifyFrame();
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
if (frame) {
nsISVGSVGFrame* svgframe;
CallQueryInterface(frame, &svgframe);
if (svgframe) {
svgframe->NotifyViewportChange();
}
#ifdef DEBUG
else {
// XXX we get here during nsSVGOuterSVGFrame::Init() since that
// function is called before the presshell association between us
// and our frame is established.
NS_WARNING("wrong frame type");
}
#endif
}
return NS_OK;
}
@ -1317,6 +1299,34 @@ void nsSVGSVGElement::GetOffsetToAncestor(nsIContent* ancestor,
}
}
void
nsSVGSVGElement::InvalidateTransformNotifyFrame()
{
nsIDocument* doc = GetCurrentDoc();
if (!doc) return;
nsIPresShell* presShell = doc->GetShellAt(0);
if (!presShell) return;
mViewBoxToViewportTransform = nsnull;
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
if (frame) {
nsISVGSVGFrame* svgframe;
CallQueryInterface(frame, &svgframe);
if (svgframe) {
svgframe->NotifyViewportChange();
}
#ifdef DEBUG
else {
// XXX we get here during nsSVGOuterSVGFrame::Init() since that
// function is called before the presshell association between us
// and our frame is established.
NS_WARNING("wrong frame type");
}
#endif
}
}
//----------------------------------------------------------------------
// nsISVGContent methods
@ -1351,6 +1361,8 @@ nsSVGSVGElement::DidChangeLength(PRUint8 aAttrEnum, PRBool aDoSetAttr)
mViewBox->GetAnimVal(getter_AddRefs(vb));
vb->SetWidth(mLengthAttributes[WIDTH].GetAnimValue(mCoordCtx));
vb->SetHeight(mLengthAttributes[HEIGHT].GetAnimValue(mCoordCtx));
} else {
InvalidateTransformNotifyFrame();
}
}

View File

@ -125,6 +125,9 @@ protected:
// implementation helpers:
void GetOffsetToAncestor(nsIContent* ancestor, float &x, float &y);
// invalidate viewbox -> viewport xform & inform frames
void InvalidateTransformNotifyFrame();
virtual LengthAttributesInfo GetLengthInfo();
enum { X, Y, WIDTH, HEIGHT };