Bug 1414345 - Part 1: Add 'Frame Construction' markers to all frame construction paths r?mstange
MozReview-Commit-ID: 4s9MGljBqPp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2702,16 +2702,17 @@ nsCSSFrameConstructor::ConstructDocEleme
return newFrame;
}
nsIFrame*
nsCSSFrameConstructor::ConstructRootFrame()
{
+ AUTO_PROFILER_TRACING("Frame Construction", "ConstructRootFrame");
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
ServoStyleSet* styleSet = mPresShell->StyleSet();
// --------- BUILD VIEWPORT -----------
RefPtr<ComputedStyle> viewportPseudoStyle =
styleSet->ResolveInheritingAnonymousBoxStyle(nsCSSAnonBoxes::viewport,
nullptr);
@@ -7083,16 +7084,17 @@ nsCSSFrameConstructor::FindNextSiblingFo
void
nsCSSFrameConstructor::ContentAppended(nsIContent* aFirstNewContent,
InsertionKind aInsertionKind)
{
MOZ_ASSERT(aInsertionKind == InsertionKind::Sync ||
!RestyleManager()->IsInStyleRefresh());
+ AUTO_PROFILER_TRACING("Frame Construction", "ContentAppended");
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
#ifdef DEBUG
if (gNoisyContentUpdates) {
printf("nsCSSFrameConstructor::ContentAppended container=%p "
"first-child=%p lazy=%d\n",
aFirstNewContent->GetParent(),
aFirstNewContent,
@@ -7428,16 +7430,17 @@ void
nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aStartChild,
nsIContent* aEndChild,
nsILayoutHistoryState* aFrameState,
InsertionKind aInsertionKind)
{
MOZ_ASSERT(aInsertionKind == InsertionKind::Sync ||
!RestyleManager()->IsInStyleRefresh());
+ AUTO_PROFILER_TRACING("Frame Construction", "ContentRangeInserted");
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
MOZ_ASSERT(aStartChild, "must always pass a child");
#ifdef DEBUG
if (gNoisyContentUpdates) {
printf("nsCSSFrameConstructor::ContentRangeInserted container=%p "
"start-child=%p end-child=%p lazy=%d\n",
@@ -7889,16 +7892,17 @@ nsCSSFrameConstructor::ContentRangeInser
bool
nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild,
nsIContent* aOldNextSibling,
RemoveFlags aFlags)
{
MOZ_ASSERT(aChild);
MOZ_ASSERT(!aChild->IsRootOfAnonymousSubtree() || !aOldNextSibling,
"Anonymous roots don't have siblings");
+ AUTO_PROFILER_TRACING("Frame Construction", "ContentRemoved");
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
nsPresContext* presContext = mPresShell->GetPresContext();
MOZ_ASSERT(presContext, "Our presShell should have a valid presContext");
// We want to detect when the viewport override element stored in the
// prescontext is in the subtree being removed. Except in fullscreen cases
// (which are handled in Element::UnbindFromTree and do not get stored on the
// prescontext), the override element is always either the root element or a
@@ -8286,16 +8290,17 @@ nsCSSFrameConstructor::EnsureFrameForTex
root, nsRestyleHint(0), nsChangeHint_ReconstructFrame);
return true;
}
void
nsCSSFrameConstructor::CharacterDataChanged(nsIContent* aContent,
const CharacterDataChangeInfo& aInfo)
{
+ AUTO_PROFILER_TRACING("Frame Construction", "CharacterDataChanged");
AUTO_LAYOUT_PHASE_ENTRY_POINT(mPresShell->GetPresContext(), FrameC);
if ((aContent->HasFlag(NS_CREATE_FRAME_IF_NON_WHITESPACE) &&
!aContent->TextIsOnlyWhitespace()) ||
(aContent->HasFlag(NS_REFRAME_IF_WHITESPACE) &&
aContent->TextIsOnlyWhitespace())) {
#ifdef DEBUG
nsIFrame* frame = aContent->GetPrimaryFrame();