mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 11:38:16 +00:00
Another peformance test for bug 378480. Will back out in a few cycles.
This commit is contained in:
parent
30f03c5271
commit
d35b8816a8
@ -878,7 +878,7 @@ nsContentSink::RefreshIfEnabled(nsIViewManager* vm)
|
||||
PRBool enabled;
|
||||
contentViewer->GetEnableRendering(&enabled);
|
||||
if (enabled) {
|
||||
vm->EnableRefresh(NS_VMREFRESH_IMMEDIATE);
|
||||
vm->EnableRefresh(NS_VMREFRESH_NO_SYNC);
|
||||
}
|
||||
}
|
||||
|
||||
@ -902,6 +902,14 @@ nsContentSink::StartLayout(PRBool aIgnorePendingSheets)
|
||||
|
||||
mDeferredLayoutStart = PR_FALSE;
|
||||
|
||||
// Notify on all our content. If none of our presshells have started layout
|
||||
// yet it'll be a no-op except for updating our data structures, a la
|
||||
// UpdateChildCounts() (because we don't want to double-notify on whatever we
|
||||
// have right now). If some of them _have_ started layout, we want to make
|
||||
// sure to flush tags instead of just calling UpdateChildCounts() after we
|
||||
// loop over the shells.
|
||||
FlushTags();
|
||||
|
||||
mLayoutStarted = PR_TRUE;
|
||||
mLastNotificationTime = PR_Now();
|
||||
|
||||
|
@ -2455,6 +2455,10 @@ PresShell::GetDidInitialReflow(PRBool *aDidInitialReflow)
|
||||
NS_IMETHODIMP
|
||||
PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
if (mIsDestroying) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
|
||||
mDidInitialReflow = PR_TRUE;
|
||||
|
||||
@ -2474,22 +2478,12 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
||||
if (mCaret)
|
||||
mCaret->EraseCaret();
|
||||
|
||||
NS_ASSERTION(mViewManager, "Should have view manager");
|
||||
// Painting should be suppressed for the initial reflow, so this won't
|
||||
// really do anything right now, but it will be useful when we
|
||||
// start batching widget changes
|
||||
mViewManager->BeginUpdateViewBatch();
|
||||
|
||||
// XXX Do a full invalidate at the beginning so that invalidates along
|
||||
// the way don't have region accumulation issues?
|
||||
|
||||
WillCauseReflow();
|
||||
WillDoReflow();
|
||||
|
||||
if (mPresContext) {
|
||||
nsRect r(0, 0, aWidth, aHeight);
|
||||
mPresContext->SetVisibleArea(r);
|
||||
}
|
||||
mPresContext->SetVisibleArea(nsRect(0, 0, aWidth, aHeight));
|
||||
|
||||
nsIContent *root = mDocument ? mDocument->GetRootContent() : nsnull;
|
||||
|
||||
@ -2524,72 +2518,13 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
||||
}
|
||||
|
||||
if (rootFrame) {
|
||||
MOZ_TIMER_DEBUGLOG(("Reset and start: Reflow: PresShell::InitialReflow(), this=%p\n",
|
||||
(void*)this));
|
||||
MOZ_TIMER_RESET(mReflowWatch);
|
||||
MOZ_TIMER_START(mReflowWatch);
|
||||
// Kick off a top-down reflow
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS,
|
||||
("enter nsPresShell::InitialReflow: %d,%d", aWidth, aHeight));
|
||||
#ifdef NS_DEBUG
|
||||
if (nsIFrameDebug::GetVerifyTreeEnable()) {
|
||||
nsIFrameDebug* frameDebug;
|
||||
|
||||
if (NS_SUCCEEDED(rootFrame->QueryInterface(NS_GET_IID(nsIFrameDebug),
|
||||
(void**)&frameDebug))) {
|
||||
frameDebug->VerifyTree();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef DEBUG_kipp
|
||||
nsPresShell_ReflowStackPointerTop = (char*) &aWidth;
|
||||
#endif
|
||||
nsRect bounds = mPresContext->GetVisibleArea();
|
||||
nsSize maxSize(bounds.width, bounds.height);
|
||||
nsHTMLReflowMetrics desiredSize;
|
||||
nsReflowStatus status;
|
||||
nsIRenderingContext* rcx = nsnull;
|
||||
|
||||
nsresult rv=CreateRenderingContext(rootFrame, &rcx);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
AUTO_LAYOUT_PHASE_ENTRY_POINT(GetPresContext(), Reflow);
|
||||
mIsReflowing = PR_TRUE;
|
||||
|
||||
nsHTMLReflowState reflowState(mPresContext, rootFrame, rcx, maxSize);
|
||||
rootFrame->WillReflow(mPresContext);
|
||||
nsContainerFrame::PositionFrameView(rootFrame);
|
||||
rootFrame->Reflow(mPresContext, desiredSize, reflowState, status);
|
||||
rootFrame->SetSize(nsSize(desiredSize.width, desiredSize.height));
|
||||
mPresContext->SetVisibleArea(nsRect(0,0,desiredSize.width,desiredSize.height));
|
||||
|
||||
nsContainerFrame::SyncFrameViewAfterReflow(mPresContext, rootFrame, rootFrame->GetView(),
|
||||
&desiredSize.mOverflowArea);
|
||||
rootFrame->DidReflow(mPresContext, nsnull, NS_FRAME_REFLOW_FINISHED);
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
if (nsIFrameDebug::GetVerifyTreeEnable()) {
|
||||
nsIFrameDebug* frameDebug;
|
||||
|
||||
if (NS_SUCCEEDED(rootFrame->QueryInterface(NS_GET_IID(nsIFrameDebug),
|
||||
(void**)&frameDebug))) {
|
||||
frameDebug->VerifyTree();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
VERIFY_STYLE_TREE;
|
||||
NS_IF_RELEASE(rcx);
|
||||
NS_FRAME_LOG(NS_FRAME_TRACE_CALLS, ("exit nsPresShell::InitialReflow"));
|
||||
MOZ_TIMER_DEBUGLOG(("Stop: Reflow: PresShell::InitialReflow(), this=%p\n", (void*)this));
|
||||
MOZ_TIMER_STOP(mReflowWatch);
|
||||
|
||||
mIsReflowing = PR_FALSE;
|
||||
rootFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
FrameNeedsReflow(rootFrame, eResize);
|
||||
mDirtyRoots.AppendElement(rootFrame);
|
||||
rootFrame->SetSize(mPresContext->GetVisibleArea().Size());
|
||||
}
|
||||
|
||||
DidCauseReflow();
|
||||
DidDoReflow();
|
||||
|
||||
mViewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
|
||||
|
||||
if (mViewManager && mCaret && !mViewEventListener) {
|
||||
nsIScrollableView* scrollingView = nsnull;
|
||||
@ -6280,8 +6215,9 @@ PresShell::ProcessReflowCommands(PRBool aInterruptible)
|
||||
mDocument->BeginUpdate(UPDATE_ALL);
|
||||
mDocument->EndUpdate(UPDATE_ALL);
|
||||
|
||||
// That might have executed (via XBL binding constructors). So we may no
|
||||
// longer have reflow commands. In fact, we may have had Destroy() called.
|
||||
// That might have executed JS (via XBL binding constructors). So we may
|
||||
// no longer have reflow commands. In fact, we may have had Destroy()
|
||||
// called.
|
||||
|
||||
// Scope for the reflow entry point, in addition to the |if| condition.
|
||||
if (!mIsDestroying && mDirtyRoots.Count() != 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user