Fixing bug 399863. We frequently call InitialUpdate() more than once on SVG frames. r=tor@acm.org, sr+a1.9=roc@ocallahan.org

This commit is contained in:
jwatt@jwatt.org 2007-10-15 15:10:59 -07:00
Родитель 1dace90537
Коммит e8bf183b7b
5 изменённых файлов: 41 добавлений и 12 удалений

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

@ -76,7 +76,13 @@ public:
NS_IMETHOD_(nsRect) GetCoveredRegion()=0;
NS_IMETHOD UpdateCoveredRegion()=0;
// Called once on all SVG child frames, either when their nsSVGOuterSVGFrame
// recieves its initial reflow (i.e. once the SVG viewport dimensions are
// known), or else when they're inserted into the frame tree (if they're
// inserted after the initial reflow).
NS_IMETHOD InitialUpdate()=0;
NS_IMETHOD NotifyCanvasTMChanged(PRBool suppressInvalidation)=0;
NS_IMETHOD NotifyRedrawSuspended()=0;
NS_IMETHOD NotifyRedrawUnsuspended()=0;

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

@ -125,20 +125,23 @@ nsSVGDisplayContainerFrame::InsertFrames(nsIAtom* aListName,
// Insert the new frames
nsSVGContainerFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
// call InitialUpdate() on all new frames:
nsIFrame* end = nsnull;
if (lastNewFrame)
end = lastNewFrame->GetNextSibling();
for (nsIFrame* kid = aFrameList; kid != end;
kid = kid->GetNextSibling()) {
nsISVGChildFrame* SVGFrame=nsnull;
CallQueryInterface(kid, &SVGFrame);
if (SVGFrame) {
SVGFrame->InitialUpdate();
// Call InitialUpdate on the new frames ONLY if our nsSVGOuterSVGFrame has had
// its initial reflow (our NS_FRAME_FIRST_REFLOW bit is clear) - bug 399863.
if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
nsIFrame* end = nsnull;
if (lastNewFrame)
end = lastNewFrame->GetNextSibling();
for (nsIFrame* kid = aFrameList; kid != end;
kid = kid->GetNextSibling()) {
nsISVGChildFrame* SVGFrame=nsnull;
CallQueryInterface(kid, &SVGFrame);
if (SVGFrame) {
SVGFrame->InitialUpdate();
}
}
}
return NS_OK;
}
@ -214,6 +217,10 @@ nsSVGDisplayContainerFrame::UpdateCoveredRegion()
NS_IMETHODIMP
nsSVGDisplayContainerFrame::InitialUpdate()
{
NS_ASSERTION(GetStateBits() & NS_FRAME_FIRST_REFLOW,
"Yikes! We've been called already! Hopefully we weren't called "
"before our nsSVGOuterSVGFrame's initial Reflow()!!!");
for (nsIFrame* kid = mFrames.FirstChild(); kid;
kid = kid->GetNextSibling()) {
nsISVGChildFrame* SVGFrame = nsnull;

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

@ -365,6 +365,10 @@ nsSVGForeignObjectFrame::UpdateCoveredRegion()
NS_IMETHODIMP
nsSVGForeignObjectFrame::InitialUpdate()
{
NS_ASSERTION(GetStateBits() & NS_FRAME_FIRST_REFLOW,
"Yikes! We've been called already! Hopefully we weren't called "
"before our nsSVGOuterSVGFrame's initial Reflow()!!!");
UpdateCoveredRegion();
DoReflow();
@ -585,6 +589,10 @@ nsSVGForeignObjectFrame::DoReflow()
printf("**nsSVGForeignObjectFrame::DoReflow()\n");
#endif
NS_ASSERTION(!(nsSVGUtils::GetOuterSVGFrame(this)->
GetStateBits() & NS_FRAME_FIRST_REFLOW),
"Calling InitialUpdate too early - must not call DoReflow!!!");
if (IsDisabled())
return;

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

@ -461,6 +461,10 @@ nsSVGGlyphFrame::UpdateCoveredRegion()
NS_IMETHODIMP
nsSVGGlyphFrame::InitialUpdate()
{
NS_ASSERTION(GetStateBits() & NS_FRAME_FIRST_REFLOW,
"Yikes! We've been called already! Hopefully we weren't called "
"before our nsSVGOuterSVGFrame's initial Reflow()!!!");
NS_ASSERTION(!(mState & NS_FRAME_IN_REFLOW),
"We don't actually participate in reflow");

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

@ -444,6 +444,10 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion()
NS_IMETHODIMP
nsSVGPathGeometryFrame::InitialUpdate()
{
NS_ASSERTION(GetStateBits() & NS_FRAME_FIRST_REFLOW,
"Yikes! We've been called already! Hopefully we weren't called "
"before our nsSVGOuterSVGFrame's initial Reflow()!!!");
UpdateGraphic();
NS_ASSERTION(!(mState & NS_FRAME_IN_REFLOW),