From 41e28a24f20f0c7d568d6b6c246cb8b221d51a4a Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Wed, 19 Mar 2003 06:51:46 +0000 Subject: [PATCH] Don't invalidate and such if no initial reflow yet. Bug 83774, r=pavlov git-svn-id: svn://10.0.0.236/trunk@139754 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsImageFrame.cpp | 32 ++++++++++++------- mozilla/layout/html/base/src/nsImageFrame.cpp | 32 ++++++++++++------- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 331b31a6f63..8b67b8ea980 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -555,6 +555,12 @@ nsImageFrame::OnDataAvailable(imgIRequest *aRequest, NS_ENSURE_ARG_POINTER(aRect); NS_ENSURE_TRUE(mPresContext, NS_ERROR_UNEXPECTED); // why are we bothering? + + if (!(mState & IMAGE_GOTINITIALREFLOW)) { + // Don't bother to do anything; we have a reflow coming up! + return NS_OK; + } + // handle iconLoads first... if (HandleIconLoads(aRequest, PR_FALSE)) { if (!aRect->IsEmpty()) { @@ -627,18 +633,20 @@ nsImageFrame::OnStopDecode(imgIRequest *aRequest, intrinsicSizeChanged = RecalculateTransform(imageContainer); } - if (!(mState & IMAGE_SIZECONSTRAINED) && intrinsicSizeChanged) { - NS_ASSERTION(mParent, "No parent to pass the reflow request up to."); - if (mParent && presShell && (mState & IMAGE_GOTINITIALREFLOW)) { // don't reflow if we havn't gotten the inital reflow yet - mState |= NS_FRAME_IS_DIRTY; - mParent->ReflowDirtyChild(presShell, NS_STATIC_CAST(nsIFrame*, this)); - } - } else { - nsSize s; - GetSize(s); - nsRect r(0, 0, s.width, s.height); - if (!r.IsEmpty()) { - Invalidate(mPresContext, r, PR_FALSE); + if (mState & IMAGE_GOTINITIALREFLOW) { // do nothing if we havn't gotten the inital reflow yet + if (!(mState & IMAGE_SIZECONSTRAINED) && intrinsicSizeChanged) { + NS_ASSERTION(mParent, "No parent to pass the reflow request up to."); + if (mParent && presShell) { + mState |= NS_FRAME_IS_DIRTY; + mParent->ReflowDirtyChild(presShell, NS_STATIC_CAST(nsIFrame*, this)); + } + } else { + nsSize s; + GetSize(s); + nsRect r(0, 0, s.width, s.height); + if (!r.IsEmpty()) { + Invalidate(mPresContext, r, PR_FALSE); + } } } } diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 331b31a6f63..8b67b8ea980 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -555,6 +555,12 @@ nsImageFrame::OnDataAvailable(imgIRequest *aRequest, NS_ENSURE_ARG_POINTER(aRect); NS_ENSURE_TRUE(mPresContext, NS_ERROR_UNEXPECTED); // why are we bothering? + + if (!(mState & IMAGE_GOTINITIALREFLOW)) { + // Don't bother to do anything; we have a reflow coming up! + return NS_OK; + } + // handle iconLoads first... if (HandleIconLoads(aRequest, PR_FALSE)) { if (!aRect->IsEmpty()) { @@ -627,18 +633,20 @@ nsImageFrame::OnStopDecode(imgIRequest *aRequest, intrinsicSizeChanged = RecalculateTransform(imageContainer); } - if (!(mState & IMAGE_SIZECONSTRAINED) && intrinsicSizeChanged) { - NS_ASSERTION(mParent, "No parent to pass the reflow request up to."); - if (mParent && presShell && (mState & IMAGE_GOTINITIALREFLOW)) { // don't reflow if we havn't gotten the inital reflow yet - mState |= NS_FRAME_IS_DIRTY; - mParent->ReflowDirtyChild(presShell, NS_STATIC_CAST(nsIFrame*, this)); - } - } else { - nsSize s; - GetSize(s); - nsRect r(0, 0, s.width, s.height); - if (!r.IsEmpty()) { - Invalidate(mPresContext, r, PR_FALSE); + if (mState & IMAGE_GOTINITIALREFLOW) { // do nothing if we havn't gotten the inital reflow yet + if (!(mState & IMAGE_SIZECONSTRAINED) && intrinsicSizeChanged) { + NS_ASSERTION(mParent, "No parent to pass the reflow request up to."); + if (mParent && presShell) { + mState |= NS_FRAME_IS_DIRTY; + mParent->ReflowDirtyChild(presShell, NS_STATIC_CAST(nsIFrame*, this)); + } + } else { + nsSize s; + GetSize(s); + nsRect r(0, 0, s.width, s.height); + if (!r.IsEmpty()) { + Invalidate(mPresContext, r, PR_FALSE); + } } } }