From 352fe83985e4a251a96fb5260d923a36c9ed56b4 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 17 Apr 2020 07:19:16 -0400 Subject: Bug 979782 - Implement lazy frame construction for display:contents descendants * Fixup FindFrameForContentSibling to don't duplicate work and trigger assertions for display: contents * Enable lazy frame construction for display: contents direct descendants Tag #1375 --- layout/base/nsCSSFrameConstructor.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'layout/base') diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index bc49c277b..617e9a940 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -6681,6 +6681,12 @@ nsCSSFrameConstructor::FindFrameForContentSibling(nsIContent* aContent, sibling = aPrevSibling ? FindPreviousSibling(iter, aTargetContent, aTargetContentDisplay, aParentFrame) : FindNextSibling(iter, aTargetContent, aTargetContentDisplay, aParentFrame); + + // The recursion above has already done all the placeholder and + // continuation fixups. + if (sibling) { + return sibling; + } } if (!sibling) { // ... then ::after / ::before on the opposite end. @@ -6704,7 +6710,7 @@ nsCSSFrameConstructor::FindFrameForContentSibling(nsIContent* aContent, sibling = placeholderFrame; } - // The frame we have now should never be a continuation + // The frame we have now should never be a continuation. NS_ASSERTION(!sibling->GetPrevContinuation(), "How did that happen?"); if (aPrevSibling) { @@ -7025,11 +7031,8 @@ nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation, nsIContent* aContainer, nsIContent* aChild) { - // XXXmats no lazy frames for display:contents direct descendants yet - // (Mozilla bug 979782). if (mPresShell->GetPresContext()->IsChrome() || !aContainer || - aContainer->IsInNativeAnonymousSubtree() || aContainer->IsXULElement() || - GetDisplayContentsStyleFor(aContainer)) { + aContainer->IsInNativeAnonymousSubtree() || aContainer->IsXULElement()) { return false; } @@ -7065,8 +7068,7 @@ nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation, // hit a node with a leaf frame. // // Also, it's fine if one of the nodes without primary frame is a display: - // contents node except if it's the direct ancestor of the children we're - // recreating frames for. + // contents node. bool noPrimaryFrame = false; bool needsFrameBitSet = false; #endif -- cgit v1.2.3