Bug 339807 - SVG layout changes should be flushed before DOM calls. r=tor,sr=bzbarsky

This commit is contained in:
longsonr%gmail.com 2006-06-06 09:03:02 +00:00
Родитель 95eb4cae80
Коммит d4c7f4dd90
6 изменённых файлов: 59 добавлений и 21 удалений

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

@ -94,10 +94,19 @@ NS_IMETHODIMP nsSVGGraphicElement::GetBBox(nsIDOMSVGRect **_retval)
*_retval = nsnull;
nsIDocument* doc = GetCurrentDoc();
if (!doc) return NS_ERROR_FAILURE;
if (!doc) {
return NS_ERROR_FAILURE;
}
// Flush all pending notifications so that our frames are up to date. Make
// sure to do this first thing, since it may end up destroying our document's
// presshell.
doc->FlushPendingNotifications(Flush_Layout);
nsIPresShell *presShell = doc->GetShellAt(0);
NS_ASSERTION(presShell, "no presShell");
if (!presShell) return NS_ERROR_FAILURE;
if (!presShell) {
return NS_ERROR_FAILURE;
}
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);

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

@ -384,13 +384,16 @@ nsSVGPathElement::GetPathFlatten()
{
nsIDocument* doc = GetCurrentDoc();
if (!doc) {
NS_ERROR("no document");
return nsnull;
}
// Flush all pending notifications so that our frames are up to date. Make
// sure to do this first thing, since it may end up destroying our document's
// presshell.
doc->FlushPendingNotifications(Flush_Layout);
nsIPresShell* presShell = doc->GetShellAt(0);
if (!presShell) {
NS_ERROR("no presshell");
return nsnull;
}

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

@ -391,10 +391,14 @@ nsSVGSVGElement::SuspendRedraw(PRUint32 max_wait_milliseconds, PRUint32 *_retval
return NS_OK;
nsIDocument* doc = GetCurrentDoc();
if (!doc) return NS_ERROR_FAILURE;
if (!doc) {
return NS_ERROR_FAILURE;
}
nsIPresShell *presShell = doc->GetShellAt(0);
NS_ASSERTION(presShell, "need presShell to suspend redraw");
if (!presShell) return NS_ERROR_FAILURE;
if (!presShell) {
return NS_ERROR_FAILURE;
}
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
#ifdef DEBUG
@ -442,10 +446,14 @@ nsSVGSVGElement::UnsuspendRedrawAll()
mRedrawSuspendCount = 0;
nsIDocument* doc = GetCurrentDoc();
if (!doc) return NS_ERROR_FAILURE;
if (!doc) {
return NS_ERROR_FAILURE;
}
nsIPresShell *presShell = doc->GetShellAt(0);
NS_ASSERTION(presShell, "need presShell to unsuspend redraw");
if (!presShell) return NS_ERROR_FAILURE;
if (!presShell) {
return NS_ERROR_FAILURE;
}
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
#ifdef DEBUG
@ -704,10 +712,19 @@ nsSVGSVGElement::GetBBox(nsIDOMSVGRect **_retval)
*_retval = nsnull;
nsIDocument* doc = GetCurrentDoc();
if (!doc) return NS_ERROR_FAILURE;
nsIPresShell *presShell = doc->GetShellAt(0);
NS_ASSERTION(presShell, "no presShell");
if (!presShell) return NS_ERROR_FAILURE;
if (!doc) {
return NS_ERROR_FAILURE;
}
// Flush all pending notifications so that our frames are up to date. Make
// sure to do this first thing, since it may end up destroying our document's
// presshell.
doc->FlushPendingNotifications(Flush_Layout);
nsIPresShell* presShell = doc->GetShellAt(0);
if (!presShell) {
return NS_ERROR_FAILURE;
}
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);

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

@ -452,13 +452,16 @@ nsSVGTSpanElement::GetTextContentMetrics()
{
nsIDocument* doc = GetCurrentDoc();
if (!doc) {
NS_ERROR("no document");
return nsnull;
}
// Flush all pending notifications so that our frames are up to date. Make
// sure to do this first thing, since it may end up destroying our document's
// presshell.
doc->FlushPendingNotifications(Flush_Layout);
nsIPresShell* presShell = doc->GetShellAt(0);
if (!presShell) {
NS_ERROR("no presshell");
return nsnull;
}

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

@ -438,13 +438,16 @@ nsSVGTextElement::GetTextContentMetrics()
{
nsIDocument* doc = GetCurrentDoc();
if (!doc) {
NS_ERROR("no document");
return nsnull;
}
// Flush all pending notifications so that our frames are up to date. Make
// sure to do this first thing, since it may end up destroying our document's
// presshell.
doc->FlushPendingNotifications(Flush_Layout);
nsIPresShell* presShell = doc->GetShellAt(0);
if (!presShell) {
NS_ERROR("no presshell");
return nsnull;
}

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

@ -387,13 +387,16 @@ nsSVGTextPathElement::GetTextContentMetrics()
{
nsIDocument* doc = GetCurrentDoc();
if (!doc) {
NS_ERROR("no document");
return nsnull;
}
// Flush all pending notifications so that our frames are up to date. Make
// sure to do this first thing, since it may end up destroying our document's
// presshell.
doc->FlushPendingNotifications(Flush_Layout);
nsIPresShell* presShell = doc->GetShellAt(0);
if (!presShell) {
NS_ERROR("no presshell");
return nsnull;
}