зеркало из https://github.com/mozilla/pjs.git
Bug 339807 - SVG layout changes should be flushed before DOM calls. r=tor,sr=bzbarsky
This commit is contained in:
Родитель
95eb4cae80
Коммит
d4c7f4dd90
|
@ -94,10 +94,19 @@ NS_IMETHODIMP nsSVGGraphicElement::GetBBox(nsIDOMSVGRect **_retval)
|
||||||
*_retval = nsnull;
|
*_retval = nsnull;
|
||||||
|
|
||||||
nsIDocument* doc = GetCurrentDoc();
|
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);
|
nsIPresShell *presShell = doc->GetShellAt(0);
|
||||||
NS_ASSERTION(presShell, "no presShell");
|
if (!presShell) {
|
||||||
if (!presShell) return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
||||||
|
|
||||||
|
|
|
@ -384,13 +384,16 @@ nsSVGPathElement::GetPathFlatten()
|
||||||
{
|
{
|
||||||
nsIDocument* doc = GetCurrentDoc();
|
nsIDocument* doc = GetCurrentDoc();
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
NS_ERROR("no document");
|
|
||||||
return nsnull;
|
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);
|
nsIPresShell* presShell = doc->GetShellAt(0);
|
||||||
if (!presShell) {
|
if (!presShell) {
|
||||||
NS_ERROR("no presshell");
|
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -391,10 +391,14 @@ nsSVGSVGElement::SuspendRedraw(PRUint32 max_wait_milliseconds, PRUint32 *_retval
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
nsIDocument* doc = GetCurrentDoc();
|
nsIDocument* doc = GetCurrentDoc();
|
||||||
if (!doc) return NS_ERROR_FAILURE;
|
if (!doc) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
nsIPresShell *presShell = doc->GetShellAt(0);
|
nsIPresShell *presShell = doc->GetShellAt(0);
|
||||||
NS_ASSERTION(presShell, "need presShell to suspend redraw");
|
if (!presShell) {
|
||||||
if (!presShell) return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -442,10 +446,14 @@ nsSVGSVGElement::UnsuspendRedrawAll()
|
||||||
mRedrawSuspendCount = 0;
|
mRedrawSuspendCount = 0;
|
||||||
|
|
||||||
nsIDocument* doc = GetCurrentDoc();
|
nsIDocument* doc = GetCurrentDoc();
|
||||||
if (!doc) return NS_ERROR_FAILURE;
|
if (!doc) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
nsIPresShell *presShell = doc->GetShellAt(0);
|
nsIPresShell *presShell = doc->GetShellAt(0);
|
||||||
NS_ASSERTION(presShell, "need presShell to unsuspend redraw");
|
if (!presShell) {
|
||||||
if (!presShell) return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -704,10 +712,19 @@ nsSVGSVGElement::GetBBox(nsIDOMSVGRect **_retval)
|
||||||
*_retval = nsnull;
|
*_retval = nsnull;
|
||||||
|
|
||||||
nsIDocument* doc = GetCurrentDoc();
|
nsIDocument* doc = GetCurrentDoc();
|
||||||
if (!doc) return NS_ERROR_FAILURE;
|
if (!doc) {
|
||||||
nsIPresShell *presShell = doc->GetShellAt(0);
|
return NS_ERROR_FAILURE;
|
||||||
NS_ASSERTION(presShell, "no presShell");
|
}
|
||||||
if (!presShell) 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);
|
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
|
||||||
|
|
||||||
|
|
|
@ -452,13 +452,16 @@ nsSVGTSpanElement::GetTextContentMetrics()
|
||||||
{
|
{
|
||||||
nsIDocument* doc = GetCurrentDoc();
|
nsIDocument* doc = GetCurrentDoc();
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
NS_ERROR("no document");
|
|
||||||
return nsnull;
|
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);
|
nsIPresShell* presShell = doc->GetShellAt(0);
|
||||||
if (!presShell) {
|
if (!presShell) {
|
||||||
NS_ERROR("no presshell");
|
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -438,13 +438,16 @@ nsSVGTextElement::GetTextContentMetrics()
|
||||||
{
|
{
|
||||||
nsIDocument* doc = GetCurrentDoc();
|
nsIDocument* doc = GetCurrentDoc();
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
NS_ERROR("no document");
|
|
||||||
return nsnull;
|
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);
|
nsIPresShell* presShell = doc->GetShellAt(0);
|
||||||
if (!presShell) {
|
if (!presShell) {
|
||||||
NS_ERROR("no presshell");
|
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -387,13 +387,16 @@ nsSVGTextPathElement::GetTextContentMetrics()
|
||||||
{
|
{
|
||||||
nsIDocument* doc = GetCurrentDoc();
|
nsIDocument* doc = GetCurrentDoc();
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
NS_ERROR("no document");
|
|
||||||
return nsnull;
|
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);
|
nsIPresShell* presShell = doc->GetShellAt(0);
|
||||||
if (!presShell) {
|
if (!presShell) {
|
||||||
NS_ERROR("no presshell");
|
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче