Backing out bug 396587 to hopefully fix orange.

This commit is contained in:
bzbarsky@mit.edu 2007-09-19 20:41:29 -07:00
Родитель acc3123915
Коммит f17ce63d07
3 изменённых файлов: 49 добавлений и 101 удалений

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

@ -3624,11 +3624,9 @@ nsDocShell::SetPositionAndSize(PRInt32 x, PRInt32 y, PRInt32 cx,
mBounds.width = cx;
mBounds.height = cy;
// Hold strong ref, since SetBounds can make us null out mContentViewer
nsCOMPtr<nsIContentViewer> viewer = mContentViewer;
if (viewer) {
if (mContentViewer) {
//XXX Border figured in here or is that handled elsewhere?
NS_ENSURE_SUCCESS(viewer->SetBounds(mBounds), NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(mContentViewer->SetBounds(mBounds), NS_ERROR_FAILURE);
}
return NS_OK;

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

@ -2480,40 +2480,29 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight)
return NS_OK;
NS_ASSERTION(mViewManager, "Must have view manager");
nsCOMPtr<nsIViewManager> viewManager = mViewManager;
viewManager->BeginUpdateViewBatch();
mViewManager->BeginUpdateViewBatch();
// Take this ref after viewManager so it'll make sure to go away first
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
// XXX Do a full invalidate at the beginning so that invalidates along
// the way don't have region accumulation issues?
// Make sure style is up to date
mFrameConstructor->ProcessPendingRestyles();
if (!mIsDestroying) {
// XXX Do a full invalidate at the beginning so that invalidates along
// the way don't have region accumulation issues?
WillCauseReflow();
WillDoReflow();
WillCauseReflow();
WillDoReflow();
{
// Kick off a top-down reflow
AUTO_LAYOUT_PHASE_ENTRY_POINT(GetPresContext(), Reflow);
mIsReflowing = PR_TRUE;
{
// Kick off a top-down reflow
AUTO_LAYOUT_PHASE_ENTRY_POINT(GetPresContext(), Reflow);
mIsReflowing = PR_TRUE;
mDirtyRoots.RemoveElement(rootFrame);
DoReflow(rootFrame);
mIsReflowing = PR_FALSE;
}
DidCauseReflow();
DidDoReflow();
mDirtyRoots.RemoveElement(rootFrame);
DoReflow(rootFrame);
mIsReflowing = PR_FALSE;
}
viewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
DidCauseReflow();
DidDoReflow();
mViewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
if (!mIsDestroying) {
CreateResizeEventTimer();
}
CreateResizeEventTimer();
return NS_OK; //XXX this needs to be real. MMP
}
@ -6234,31 +6223,26 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
DidDoReflow();
// DidDoReflow might have killed us
if (!mIsDestroying) {
#ifdef DEBUG
if (VERIFY_REFLOW_DUMP_COMMANDS & gVerifyReflowFlags) {
printf("\nPresShell::ProcessReflowCommands() finished: this=%p\n",
(void*)this);
}
DoVerifyReflow();
if (VERIFY_REFLOW_DUMP_COMMANDS & gVerifyReflowFlags) {
printf("\nPresShell::ProcessReflowCommands() finished: this=%p\n", (void*)this);
}
DoVerifyReflow();
#endif
// If any new reflow commands were enqueued during the reflow, schedule
// another reflow event to process them. Note that we want to do this
// after DidDoReflow(), since that method can change whether there are
// dirty roots around by flushing, and there's no point in posting a
// reflow event just to have the flush revoke it.
if (mDirtyRoots.Count())
PostReflowEvent();
}
// If any new reflow commands were enqueued during the reflow, schedule
// another reflow event to process them. Note that we want to do this
// after DidDoReflow(), since that method can change whether there are
// dirty roots around by flushing, and there's no point in posting a reflow
// event just to have the flush revoke it.
if (mDirtyRoots.Count())
PostReflowEvent();
}
MOZ_TIMER_DEBUGLOG(("Stop: Reflow: PresShell::ProcessReflowCommands(), this=%p\n", this));
MOZ_TIMER_STOP(mReflowWatch);
if (!mIsDestroying && mShouldUnsuppressPainting &&
mDirtyRoots.Count() == 0) {
if (mShouldUnsuppressPainting && mDirtyRoots.Count() == 0) {
// We only unlock if we're out of reflows. It's pointless
// to unlock if reflows are still pending, since reflows
// are just going to thrash the frames around some more. By

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

@ -89,7 +89,6 @@
#include "nsIDOMNSHTMLDocument.h"
#include "nsDisplayList.h"
#include "nsUnicharUtils.h"
#include "nsIReflowCallback.h"
// For Accessibility
#ifdef ACCESSIBILITY
@ -103,8 +102,7 @@ static NS_DEFINE_CID(kCChildCID, NS_CHILD_CID);
* nsSubDocumentFrame
*****************************************************************************/
class nsSubDocumentFrame : public nsLeafFrame,
public nsIFrameFrame,
public nsIReflowCallback
public nsIFrameFrame
{
public:
nsSubDocumentFrame(nsStyleContext* aContext);
@ -161,9 +159,6 @@ public:
NS_IMETHOD VerifyTree() const;
// nsIReflowCallback
virtual PRBool ReflowFinished();
protected:
nsSize GetMargin();
PRBool IsInline() { return mIsInline; }
@ -180,12 +175,11 @@ protected:
PRPackedBool mDidCreateDoc;
PRPackedBool mOwnsFrameLoader;
PRPackedBool mIsInline;
PRPackedBool mPostedReflowCallback;
};
nsSubDocumentFrame::nsSubDocumentFrame(nsStyleContext* aContext)
: nsLeafFrame(aContext), mDidCreateDoc(PR_FALSE), mOwnsFrameLoader(PR_FALSE),
mIsInline(PR_FALSE), mPostedReflowCallback(PR_FALSE)
mIsInline(PR_FALSE)
{
}
@ -378,9 +372,6 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
aStatus = NS_FRAME_COMPLETE;
NS_ASSERTION(aPresContext->GetPresShell()->GetPrimaryFrameFor(mContent) == this,
"Shouldn't happen");
// "offset" is the offset of our content area from our frame's
// top-left corner.
nsPoint offset(0, 0);
@ -418,9 +409,22 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
nsRect rect(nsPoint(0, 0), GetSize());
Invalidate(rect, PR_FALSE);
if (!aPresContext->IsPaginated() && !mPostedReflowCallback) {
PresContext()->PresShell()->PostReflowCallback(this);
mPostedReflowCallback = PR_TRUE;
if (!aPresContext->IsPaginated()) {
nsCOMPtr<nsIDocShell> docShell;
GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIBaseWindow> baseWindow(do_QueryInterface(docShell));
// resize the sub document
if (baseWindow) {
PRInt32 x = 0;
PRInt32 y = 0;
baseWindow->GetPositionAndSize(&x, &y, nsnull, nsnull);
PRInt32 cx = aPresContext->AppUnitsToDevPixels(innerSize.width);
PRInt32 cy = aPresContext->AppUnitsToDevPixels(innerSize.height);
baseWindow->SetPositionAndSize(x, y, cx, cy, PR_FALSE);
}
}
// printf("OuterFrame::Reflow DONE %X (%d,%d)\n", this,
@ -434,39 +438,6 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
return NS_OK;
}
PRBool
nsSubDocumentFrame::ReflowFinished()
{
mPostedReflowCallback = PR_FALSE;
nsSize innerSize(GetSize());
if (IsInline()) {
nsMargin usedBorderPadding = GetUsedBorderAndPadding();
innerSize.width -= usedBorderPadding.LeftRight();
innerSize.height -= usedBorderPadding.TopBottom();
}
nsCOMPtr<nsIDocShell> docShell;
GetDocShell(getter_AddRefs(docShell));
nsCOMPtr<nsIBaseWindow> baseWindow(do_QueryInterface(docShell));
// resize the sub document
if (baseWindow) {
PRInt32 x = 0;
PRInt32 y = 0;
nsPresContext* presContext = PresContext();
baseWindow->GetPositionAndSize(&x, &y, nsnull, nsnull);
PRInt32 cx = presContext->AppUnitsToDevPixels(innerSize.width);
PRInt32 cy = presContext->AppUnitsToDevPixels(innerSize.height);
baseWindow->SetPositionAndSize(x, y, cx, cy, PR_FALSE);
}
return PR_FALSE;
}
NS_IMETHODIMP
nsSubDocumentFrame::VerifyTree() const
{
@ -585,11 +556,6 @@ NS_NewSubDocumentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
void
nsSubDocumentFrame::Destroy()
{
if (mPostedReflowCallback) {
PresContext()->PresShell()->CancelReflowCallback(this);
mPostedReflowCallback = PR_FALSE;
}
if (mFrameLoader && mDidCreateDoc) {
// Get the content viewer through the docshell, but don't call
// GetDocShell() since we don't want to create one if we don't
@ -718,7 +684,7 @@ nsSubDocumentFrame::ShowDocShell()
if (presShell) {
// The docshell is already showing, nothing left to do...
NS_ASSERTION(mInnerView, "What's going on?");
return NS_OK;
}