зеркало из https://github.com/mozilla/gecko-dev.git
Rename nsIPresShell::InitialReflow to Initialize since it doesn't actually perform reflow. (Bug 788956) r=roc
This commit is contained in:
Родитель
62a92f1d14
Коммит
6521fcaca1
|
@ -1178,15 +1178,15 @@ nsContentSink::StartLayout(bool aIgnorePendingSheets)
|
|||
|
||||
mDocument->SetMayStartLayout(true);
|
||||
nsCOMPtr<nsIPresShell> shell = mDocument->GetShell();
|
||||
// Make sure we don't call InitialReflow() for a shell that has
|
||||
// Make sure we don't call Initialize() for a shell that has
|
||||
// already called it. This can happen when the layout frame for
|
||||
// an iframe is constructed *between* the Embed() call for the
|
||||
// docshell in the iframe, and the content sink's call to OpenBody().
|
||||
// (Bug 153815)
|
||||
if (shell && !shell->DidInitialReflow()) {
|
||||
if (shell && !shell->DidInitialize()) {
|
||||
nsRect r = shell->GetPresContext()->GetVisibleArea();
|
||||
nsCOMPtr<nsIPresShell> shellGrip = shell;
|
||||
nsresult rv = shell->InitialReflow(r.width, r.height);
|
||||
nsresult rv = shell->Initialize(r.width, r.height);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -6289,7 +6289,7 @@ nsDocument::FlushPendingNotifications(mozFlushType aType)
|
|||
// reflow.
|
||||
if ((!IsHTML() ||
|
||||
(aType > Flush_ContentAndNotify && mPresShell &&
|
||||
!mPresShell->DidInitialReflow())) &&
|
||||
!mPresShell->DidInitialize())) &&
|
||||
(mParser || mWeakSink)) {
|
||||
nsCOMPtr<nsIContentSink> sink;
|
||||
if (mParser) {
|
||||
|
|
|
@ -256,7 +256,7 @@ nsImageLoadingContent::OnStopDecode(imgIRequest* aRequest,
|
|||
// decoding, so we can't wait for them to finish. See bug 512435.
|
||||
//
|
||||
// (*) IsPaintingSuppressed returns false if we haven't gotten the initial
|
||||
// reflow yet, so we have to test !DidInitialReflow || IsPaintingSuppressed.
|
||||
// reflow yet, so we have to test !DidInitialize || IsPaintingSuppressed.
|
||||
// It's possible for painting to be suppressed for reasons other than the
|
||||
// initial paint delay (for example, being in the bfcache), but we probably
|
||||
// aren't loading images in those situations.
|
||||
|
@ -266,7 +266,7 @@ nsImageLoadingContent::OnStopDecode(imgIRequest* aRequest,
|
|||
nsIDocument* doc = GetOurOwnerDoc();
|
||||
nsIPresShell* shell = doc ? doc->GetShell() : nullptr;
|
||||
if (shell && shell->IsVisible() &&
|
||||
(!shell->DidInitialReflow() || shell->IsPaintingSuppressed())) {
|
||||
(!shell->DidInitialize() || shell->IsPaintingSuppressed())) {
|
||||
|
||||
mCurrentRequest->RequestDecode();
|
||||
}
|
||||
|
|
|
@ -280,9 +280,9 @@ MediaDocument::StartLayout()
|
|||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
// Don't mess with the presshell if someone has already handled
|
||||
// its initial reflow.
|
||||
if (shell && !shell->DidInitialReflow()) {
|
||||
if (shell && !shell->DidInitialize()) {
|
||||
nsRect visibleArea = shell->GetPresContext()->GetVisibleArea();
|
||||
nsresult rv = shell->InitialReflow(visibleArea.width, visibleArea.height);
|
||||
nsresult rv = shell->Initialize(visibleArea.width, visibleArea.height);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ PluginDocument::StartDocumentLoad(const char* aCommand,
|
|||
nsresult
|
||||
PluginDocument::CreateSyntheticPluginDocument()
|
||||
{
|
||||
NS_ASSERTION(!GetShell() || !GetShell()->DidInitialReflow(),
|
||||
NS_ASSERTION(!GetShell() || !GetShell()->DidInitialize(),
|
||||
"Creating synthetic plugin document content too late");
|
||||
|
||||
// make our generic document
|
||||
|
|
|
@ -1993,7 +1993,7 @@ nsXULDocument::StartLayout(void)
|
|||
|
||||
nsresult rv = NS_OK;
|
||||
nsRect r = cx->GetVisibleArea();
|
||||
rv = shell->InitialReflow(r.width, r.height);
|
||||
rv = shell->Initialize(r.width, r.height);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -3865,7 +3865,7 @@ nsXULDocument::OverlayForwardReference::Resolve()
|
|||
nsCOMPtr<nsIContent> target;
|
||||
|
||||
nsIPresShell *shell = mDocument->GetShell();
|
||||
bool notify = shell && shell->DidInitialReflow();
|
||||
bool notify = shell && shell->DidInitialize();
|
||||
|
||||
nsAutoString id;
|
||||
mOverlay->GetAttr(kNameSpaceID_None, nsGkAtoms::id, id);
|
||||
|
|
|
@ -1546,11 +1546,11 @@ nsGlobalWindow::SetInitialPrincipalToSubject()
|
|||
nsCOMPtr<nsIPresShell> shell;
|
||||
GetDocShell()->GetPresShell(getter_AddRefs(shell));
|
||||
|
||||
if (shell && !shell->DidInitialReflow()) {
|
||||
if (shell && !shell->DidInitialize()) {
|
||||
// Ensure that if someone plays with this document they will get
|
||||
// layout happening.
|
||||
nsRect r = shell->GetPresContext()->GetVisibleArea();
|
||||
shell->InitialReflow(r.width, r.height);
|
||||
shell->Initialize(r.width, r.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -173,9 +173,9 @@ gfxSVGGlyphsDocument::SetupPresentation()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
presShell->GetPresContext()->SetIsGlyph(true);
|
||||
|
||||
if (!presShell->DidInitialReflow()) {
|
||||
if (!presShell->DidInitialize()) {
|
||||
nsRect rect = presShell->GetPresContext()->GetVisibleArea();
|
||||
rv = presShell->InitialReflow(rect.width, rect.height);
|
||||
rv = presShell->Initialize(rect.width, rect.height);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
|
|
@ -1025,7 +1025,7 @@ nsCSSRendering::FindBackgroundStyleFrame(nsIFrame* aForFrame)
|
|||
// SCRIPT that does "document.location.href = 'foo'", then
|
||||
// nsParser::Terminate will call |DidBuildModel| methods
|
||||
// through to the content sink, which will call |StartLayout|
|
||||
// and thus |InitialReflow| on the pres shell. See bug 119351
|
||||
// and thus |Initialize| on the pres shell. See bug 119351
|
||||
// for the ugly details.
|
||||
if (!bodyContent) {
|
||||
return aForFrame;
|
||||
|
|
|
@ -704,7 +704,7 @@ DocumentViewerImpl::InitPresentationStuff(bool aDoInitialReflow)
|
|||
styleSet->EndUpdate();
|
||||
|
||||
if (aDoInitialReflow) {
|
||||
// Since InitialReflow() will create frames for *all* items
|
||||
// Since Initialize() will create frames for *all* items
|
||||
// that are currently in the document tree, we need to flush
|
||||
// any pending notifications to prevent the content sink from
|
||||
// duplicating layout frames for content it has added to the tree
|
||||
|
@ -730,10 +730,10 @@ DocumentViewerImpl::InitPresentationStuff(bool aDoInitialReflow)
|
|||
if (aDoInitialReflow) {
|
||||
nsCOMPtr<nsIPresShell> shellGrip = mPresShell;
|
||||
// Initial reflow
|
||||
mPresShell->InitialReflow(width, height);
|
||||
mPresShell->Initialize(width, height);
|
||||
} else {
|
||||
// Store the visible area so it's available for other callers of
|
||||
// InitialReflow, like nsContentSink::StartLayout.
|
||||
// Initialize, like nsContentSink::StartLayout.
|
||||
mPresContext->SetVisibleArea(nsRect(0, 0, width, height));
|
||||
}
|
||||
|
||||
|
|
|
@ -354,22 +354,22 @@ public:
|
|||
virtual NS_HIDDEN_(void) EndObservingDocument() = 0;
|
||||
|
||||
/**
|
||||
* Return whether InitialReflow() was previously called.
|
||||
* Return whether Initialize() was previously called.
|
||||
*/
|
||||
bool DidInitialReflow() const { return mDidInitialReflow; }
|
||||
bool DidInitialize() const { return mDidInitialize; }
|
||||
|
||||
/**
|
||||
* Perform the initial reflow. Constructs the frame for the root content
|
||||
* object and then reflows the frame model into the specified width and
|
||||
* height.
|
||||
* Perform initialization. Constructs the frame for the root content
|
||||
* object and then enqueues a reflow of the frame model into the
|
||||
* specified width and height.
|
||||
*
|
||||
* The coordinates for aWidth and aHeight must be in standard nscoords.
|
||||
*
|
||||
* Callers of this method must hold a reference to this shell that
|
||||
* is guaranteed to survive through arbitrary script execution.
|
||||
* Calling InitialReflow can execute arbitrary script.
|
||||
* Calling Initialize can execute arbitrary script.
|
||||
*/
|
||||
virtual NS_HIDDEN_(nsresult) InitialReflow(nscoord aWidth, nscoord aHeight) = 0;
|
||||
virtual NS_HIDDEN_(nsresult) Initialize(nscoord aWidth, nscoord aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Reflow the frame model into a new width and height. The
|
||||
|
@ -1374,7 +1374,7 @@ protected:
|
|||
RenderFlags mRenderFlags;
|
||||
|
||||
bool mStylesHaveChanged : 1;
|
||||
bool mDidInitialReflow : 1;
|
||||
bool mDidInitialize : 1;
|
||||
bool mIsDestroying : 1;
|
||||
bool mIsReflowing : 1;
|
||||
|
||||
|
|
|
@ -1617,7 +1617,7 @@ char* nsPresShell_ReflowStackPointerTop;
|
|||
#endif
|
||||
|
||||
nsresult
|
||||
PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
||||
PresShell::Initialize(nscoord aWidth, nscoord aHeight)
|
||||
{
|
||||
if (mIsDestroying) {
|
||||
return NS_OK;
|
||||
|
@ -1631,10 +1631,10 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
|||
NS_TIME_FUNCTION_WITH_DOCURL;
|
||||
mozilla::TimeStamp timerStart = mozilla::TimeStamp::Now();
|
||||
|
||||
NS_ASSERTION(!mDidInitialReflow, "Why are we being called?");
|
||||
NS_ASSERTION(!mDidInitialize, "Why are we being called?");
|
||||
|
||||
nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
|
||||
mDidInitialReflow = true;
|
||||
mDidInitialize = true;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (VERIFY_REFLOW_NOISY_RC & gVerifyReflowFlags) {
|
||||
|
@ -1643,7 +1643,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight)
|
|||
if (uri) {
|
||||
nsAutoCString url;
|
||||
uri->GetSpec(url);
|
||||
printf("*** PresShell::InitialReflow (this=%p, url='%s')\n", (void*)this, url.get());
|
||||
printf("*** PresShell::Initialize (this=%p, url='%s')\n", (void*)this, url.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2495,7 +2495,7 @@ PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
|
|||
|
||||
// If we've not yet done the initial reflow, then don't bother
|
||||
// enqueuing a reflow command yet.
|
||||
if (! mDidInitialReflow)
|
||||
if (! mDidInitialize)
|
||||
return;
|
||||
|
||||
// If we're already destroying, don't bother with this either.
|
||||
|
@ -2706,7 +2706,7 @@ PresShell::RecreateFramesFor(nsIContent* aContent)
|
|||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
NS_ENSURE_TRUE(mPresContext, NS_ERROR_FAILURE);
|
||||
if (!mDidInitialReflow) {
|
||||
if (!mDidInitialize) {
|
||||
// Nothing to do here. In fact, if we proceed and aContent is the
|
||||
// root we will crash.
|
||||
return NS_OK;
|
||||
|
@ -2967,7 +2967,7 @@ PresShell::ScrollToAnchor()
|
|||
if (!mLastAnchorScrolledTo)
|
||||
return NS_OK;
|
||||
|
||||
NS_ASSERTION(mDidInitialReflow, "should have done initial reflow by now");
|
||||
NS_ASSERTION(mDidInitialize, "should have done initial reflow by now");
|
||||
|
||||
nsIScrollableFrame* rootScroll = GetRootScrollFrameAsScrollable();
|
||||
if (!rootScroll ||
|
||||
|
@ -3226,7 +3226,7 @@ PresShell::ScrollContentIntoView(nsIContent* aContent,
|
|||
nsCOMPtr<nsIDocument> currentDoc = aContent->GetCurrentDoc();
|
||||
NS_ENSURE_STATE(currentDoc);
|
||||
|
||||
NS_ASSERTION(mDidInitialReflow, "should have done initial reflow by now");
|
||||
NS_ASSERTION(mDidInitialize, "should have done initial reflow by now");
|
||||
|
||||
if (mContentToScrollTo) {
|
||||
mContentToScrollTo->DeleteProperty(nsGkAtoms::scrolling);
|
||||
|
@ -3262,7 +3262,7 @@ PresShell::ScrollContentIntoView(nsIContent* aContent,
|
|||
void
|
||||
PresShell::DoScrollContentIntoView()
|
||||
{
|
||||
NS_ASSERTION(mDidInitialReflow, "should have done initial reflow by now");
|
||||
NS_ASSERTION(mDidInitialize, "should have done initial reflow by now");
|
||||
|
||||
nsIFrame* frame = mContentToScrollTo->GetPrimaryFrame();
|
||||
if (!frame) {
|
||||
|
@ -3967,7 +3967,7 @@ PresShell::ContentStateChanged(nsIDocument* aDocument,
|
|||
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentStateChanged");
|
||||
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
|
||||
|
||||
if (mDidInitialReflow) {
|
||||
if (mDidInitialize) {
|
||||
nsAutoCauseReflowNotifier crNotifier(this);
|
||||
mFrameConstructor->ContentStateChanged(aContent, aStateMask);
|
||||
VERIFY_STYLE_TREE;
|
||||
|
@ -3981,7 +3981,7 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument,
|
|||
NS_PRECONDITION(!mIsDocumentGone, "Unexpected DocumentStatesChanged");
|
||||
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
|
||||
|
||||
if (mDidInitialReflow &&
|
||||
if (mDidInitialize &&
|
||||
mStyleSet->HasDocumentStateDependentStyle(mPresContext,
|
||||
mDocument->GetRootElement(),
|
||||
aStateMask)) {
|
||||
|
@ -4011,7 +4011,7 @@ PresShell::AttributeWillChange(nsIDocument* aDocument,
|
|||
// XXXwaterson it might be more elegant to wait until after the
|
||||
// initial reflow to begin observing the document. That would
|
||||
// squelch any other inappropriate notifications as well.
|
||||
if (mDidInitialReflow) {
|
||||
if (mDidInitialize) {
|
||||
nsAutoCauseReflowNotifier crNotifier(this);
|
||||
mFrameConstructor->AttributeWillChange(aElement, aNameSpaceID,
|
||||
aAttribute, aModType);
|
||||
|
@ -4032,7 +4032,7 @@ PresShell::AttributeChanged(nsIDocument* aDocument,
|
|||
// XXXwaterson it might be more elegant to wait until after the
|
||||
// initial reflow to begin observing the document. That would
|
||||
// squelch any other inappropriate notifications as well.
|
||||
if (mDidInitialReflow) {
|
||||
if (mDidInitialize) {
|
||||
nsAutoCauseReflowNotifier crNotifier(this);
|
||||
mFrameConstructor->AttributeChanged(aElement, aNameSpaceID,
|
||||
aAttribute, aModType);
|
||||
|
@ -4050,7 +4050,7 @@ PresShell::ContentAppended(nsIDocument *aDocument,
|
|||
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
|
||||
NS_PRECONDITION(aContainer, "must have container");
|
||||
|
||||
if (!mDidInitialReflow) {
|
||||
if (!mDidInitialize) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4074,7 +4074,7 @@ PresShell::ContentInserted(nsIDocument* aDocument,
|
|||
NS_PRECONDITION(!mIsDocumentGone, "Unexpected ContentInserted");
|
||||
NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument");
|
||||
|
||||
if (!mDidInitialReflow) {
|
||||
if (!mDidInitialize) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4137,9 +4137,9 @@ PresShell::ContentRemoved(nsIDocument *aDocument,
|
|||
nsresult
|
||||
PresShell::ReconstructFrames(void)
|
||||
{
|
||||
NS_PRECONDITION(!mFrameConstructor->GetRootFrame() || mDidInitialReflow,
|
||||
NS_PRECONDITION(!mFrameConstructor->GetRootFrame() || mDidInitialize,
|
||||
"Must not have root frame before initial reflow");
|
||||
if (!mDidInitialReflow) {
|
||||
if (!mDidInitialize) {
|
||||
// Nothing to do here
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4175,7 +4175,7 @@ nsIPresShell::ReconstructStyleDataInternal()
|
|||
}
|
||||
|
||||
Element* root = mDocument->GetRootElement();
|
||||
if (!mDidInitialReflow) {
|
||||
if (!mDidInitialize) {
|
||||
// Nothing to do here, since we have no frames yet
|
||||
return;
|
||||
}
|
||||
|
@ -8204,7 +8204,7 @@ PresShell::VerifyIncrementalReflow()
|
|||
vm->SetPresShell(sh);
|
||||
{
|
||||
nsAutoCauseReflowNotifier crNotifier(this);
|
||||
sh->InitialReflow(r.width, r.height);
|
||||
sh->Initialize(r.width, r.height);
|
||||
}
|
||||
mDocument->BindingManager()->ProcessAttachedQueue();
|
||||
sh->FlushPendingNotifications(Flush_Layout);
|
||||
|
|
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
virtual NS_HIDDEN_(void) BeginObservingDocument();
|
||||
virtual NS_HIDDEN_(void) EndObservingDocument();
|
||||
virtual NS_HIDDEN_(nsresult) InitialReflow(nscoord aWidth, nscoord aHeight);
|
||||
virtual NS_HIDDEN_(nsresult) Initialize(nscoord aWidth, nscoord aHeight);
|
||||
virtual NS_HIDDEN_(nsresult) ResizeReflow(nscoord aWidth, nscoord aHeight);
|
||||
virtual NS_HIDDEN_(nsresult) ResizeReflowOverride(nscoord aWidth, nscoord aHeight);
|
||||
virtual NS_HIDDEN_(void) StyleChangeReflow();
|
||||
|
|
|
@ -1952,12 +1952,12 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO)
|
|||
aPO->mPresShell);
|
||||
}
|
||||
|
||||
rv = aPO->mPresShell->InitialReflow(adjSize.width, adjSize.height);
|
||||
rv = aPO->mPresShell->Initialize(adjSize.width, adjSize.height);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ASSERTION(aPO->mPresShell, "Presshell should still be here");
|
||||
|
||||
// Process the reflow event InitialReflow posted
|
||||
// Process the reflow event Initialize posted
|
||||
aPO->mPresShell->FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
nsCOMPtr<nsIPresShell> displayShell;
|
||||
|
|
Загрузка…
Ссылка в новой задаче