Bug 1404181 - Part 11: Factor out PresShell paint count code se we can still call it without needing to build the display items. r?mstange
MozReview-Commit-ID: Ai4P92dd1zR
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -3734,16 +3734,17 @@ nsLayoutUtils::PaintFrame(gfxContext* aR
builder.SetDirtyRect(dirtyRect);
builder.SetVisibleRect(dirtyRect);
aFrame->BuildDisplayListForStackingContext(&builder, &list);
}
AddExtraBackgroundItems(builder, list, aFrame, canvasArea, visibleRegion, aBackstop);
builder.LeavePresShell(aFrame, &list);
+ builder.IncrementPresShellPaintCount(presShell);
if (!record.GetStart().IsNull() && gfxPrefs::LayersDrawFPS()) {
if (RefPtr<LayerManager> lm = builder.GetWidgetLayerManager()) {
if (PaintTiming* pt = ClientLayerManager::MaybeGetPaintTiming(lm)) {
pt->dlMs() = (TimeStamp::Now() - record.GetStart()).ToMilliseconds();
}
}
}
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -416,16 +416,17 @@ nsSubDocumentFrame::BuildDisplayList(nsD
ignoreViewportScrolling = presShell->IgnoringViewportScrolling();
if (ignoreViewportScrolling) {
savedIgnoreScrollFrame = aBuilder->GetIgnoreScrollFrame();
aBuilder->SetIgnoreScrollFrame(rootScrollFrame);
}
}
aBuilder->EnterPresShell(subdocRootFrame, pointerEventsNone);
+ aBuilder->IncrementPresShellPaintCount(presShell);
} else {
visible = aBuilder->GetVisibleRect();
dirty = aBuilder->GetDirtyRect();
}
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
if (ShouldClipSubdocument()) {
clipState.ClipContainingBlockDescendantsToContentBox(aBuilder, this);
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -1237,36 +1237,39 @@ nsDisplayListBuilder::SubtractFromVisibl
nsCaret *
nsDisplayListBuilder::GetCaret() {
RefPtr<nsCaret> caret = CurrentPresShellState()->mPresShell->GetCaret();
return caret;
}
void
+nsDisplayListBuilder::IncrementPresShellPaintCount(nsIPresShell* aPresShell)
+{
+ if (mIsPaintingToWindow) {
+ mReferenceFrame->AddPaintedPresShell(aPresShell);
+ aPresShell->IncrementPaintCount();
+ }
+}
+
+void
nsDisplayListBuilder::EnterPresShell(nsIFrame* aReferenceFrame,
bool aPointerEventsNoneDoc)
{
PresShellState* state = mPresShellStates.AppendElement();
state->mPresShell = aReferenceFrame->PresContext()->PresShell();
state->mCaretFrame = nullptr;
state->mFirstFrameMarkedForDisplay = mFramesMarkedForDisplay.Length();
#ifdef DEBUG
state->mAutoLayoutPhase.emplace(aReferenceFrame->PresContext(), eLayoutPhase_DisplayListBuilding);
#endif
state->mPresShell->UpdateCanvasBackground();
- if (mIsPaintingToWindow) {
- mReferenceFrame->AddPaintedPresShell(state->mPresShell);
-
- state->mPresShell->IncrementPaintCount();
- }
-
bool buildCaret = mBuildCaret;
if (mIgnoreSuppression || !state->mPresShell->IsPaintingSuppressed()) {
state->mIsBackgroundOnly = false;
} else {
state->mIsBackgroundOnly = true;
buildCaret = false;
}
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -737,16 +737,18 @@ public:
* MarkFramesForDisplayList do not carry over between batches.
*/
void ResetMarkedFramesForDisplayList();
/**
* Notify the display list builder that we're leaving a presshell.
*/
void LeavePresShell(nsIFrame* aReferenceFrame, nsDisplayList* aPaintedContents);
+ void IncrementPresShellPaintCount(nsIPresShell* aPresShell);
+
/**
* Returns true if we're currently building a display list that's
* directly or indirectly under an nsDisplayTransform.
*/
bool IsInTransform() const { return mInTransform; }
/**
* Indicate whether or not we're directly or indirectly under and
* nsDisplayTransform or SVG foreignObject.