Bug 1388939, part 8 - Remove nsFrameManager::GetDisplayContentsNodeFor. r=dholbert
MozReview-Commit-ID: HGFdHVURUKP
--- a/layout/base/ServoRestyleManager.cpp
+++ b/layout/base/ServoRestyleManager.cpp
@@ -605,24 +605,24 @@ ServoRestyleManager::ProcessPostTraversa
// ServoStyleContext case, which uses atomic refcounting.
//
// Hold the old style context alive, because it could become a dangling
// pointer during the replacement. In practice it's not a huge deal, but
// better not playing with dangling pointers if not needed.
RefPtr<ServoStyleContext> oldStyleContext =
styleFrame ? styleFrame->StyleContext()->AsServo() : nullptr;
- UndisplayedNode* displayContentsNode = nullptr;
+ nsStyleContext* displayContentsStyle = nullptr;
// FIXME(emilio, bug 1303605): This can be simpler for Servo.
// Note that we intentionally don't check for display: none content.
if (!oldStyleContext) {
- displayContentsNode =
- PresContext()->FrameConstructor()->GetDisplayContentsNodeFor(aElement);
- if (displayContentsNode) {
- oldStyleContext = displayContentsNode->mStyle->AsServo();
+ displayContentsStyle =
+ PresContext()->FrameConstructor()->GetDisplayContentsStyleFor(aElement);
+ if (displayContentsStyle) {
+ oldStyleContext = displayContentsStyle->AsServo();
}
}
Maybe<ServoRestyleState> thisFrameRestyleState;
if (styleFrame) {
auto type = isOutOfFlow
? ServoRestyleState::Type::OutOfFlow
: ServoRestyleState::Type::InFlow;
@@ -632,17 +632,17 @@ ServoRestyleManager::ProcessPostTraversa
// We can't really assume as used changes from display: contents elements (or
// other elements without frames).
ServoRestyleState& childrenRestyleState =
thisFrameRestyleState ? *thisFrameRestyleState : aRestyleState;
RefPtr<ServoStyleContext> newContext = nullptr;
if (wasRestyled && oldStyleContext) {
- MOZ_ASSERT(styleFrame || displayContentsNode);
+ MOZ_ASSERT(styleFrame || displayContentsStyle);
newContext =
aRestyleState.StyleSet().ResolveServoStyle(aElement, aFlags);
MOZ_ASSERT(oldStyleContext->ComputedData() != newContext->ComputedData());
newContext->ResolveSameStructsAs(oldStyleContext);
// We want to walk all the continuations here, even the ones with different
// styles. In practice, the only reason we get continuations with different
@@ -654,19 +654,20 @@ ServoRestyleManager::ProcessPostTraversa
//
// This does mean that we may be setting the wrong style context on our
// initial continuations; ::first-line fixes that up after the fact.
for (nsIFrame* f = styleFrame; f; f = f->GetNextContinuation()) {
MOZ_ASSERT_IF(f != styleFrame, !f->GetAdditionalStyleContext(0));
f->SetStyleContext(newContext);
}
- if (MOZ_UNLIKELY(displayContentsNode)) {
+ if (MOZ_UNLIKELY(displayContentsStyle)) {
MOZ_ASSERT(!styleFrame);
- displayContentsNode->mStyle = newContext;
+ PresContext()->FrameConstructor()->
+ ChangeRegisteredDisplayContentsStyleFor(aElement, newContext);
}
if (styleFrame) {
UpdateAdditionalStyleContexts(styleFrame, aRestyleState);
styleFrame->UpdateStyleOfOwnedAnonBoxes(childrenRestyleState);
}
if (!aElement->GetParent()) {
@@ -702,17 +703,17 @@ ServoRestyleManager::ProcessPostTraversa
wasRestyled || (!forThrottledAnimationFlush && descendantsNeedFrames);
bool recreatedAnyContext = wasRestyled;
if (traverseElementChildren || traverseTextChildren) {
ServoStyleContext* upToDateContext =
wasRestyled ? newContext : oldStyleContext;
StyleChildrenIterator it(aElement);
TextPostTraversalState textState(*upToDateContext,
- displayContentsNode && wasRestyled,
+ displayContentsStyle && wasRestyled,
childrenRestyleState);
for (nsIContent* n = it.GetNextChild(); n; n = it.GetNextChild()) {
if (traverseElementChildren && n->IsElement()) {
recreatedAnyContext |= ProcessPostTraversal(n->AsElement(),
upToDateContext,
childrenRestyleState,
aFlags);
} else if (traverseTextChildren && n->IsNodeOfType(nsINode::eTEXT)) {
--- a/layout/base/nsFrameManager.h
+++ b/layout/base/nsFrameManager.h
@@ -147,28 +147,16 @@ public:
/**
* Return the linked list of style contexts registered for display:contents
* children of aParentContent.
*/
UndisplayedNode*
GetAllRegisteredDisplayContentsStylesIn(nsIContent* aParentContent);
/**
- * Return the relevant undisplayed node for a given content with display:
- * contents style.
- */
- UndisplayedNode* GetDisplayContentsNodeFor(const nsIContent* aContent)
- {
- if (!mDisplayContentsMap) {
- return nullptr;
- }
- return GetUndisplayedNodeInMapFor(mDisplayContentsMap, aContent);
- }
-
- /**
* Unregister the style context for the display:none content, aContent,
* if any. If found, then also unregisters the style contexts for any
* display:contents and display:none descendants of aContent.
*/
void UnregisterDisplayNoneStyleFor(nsIContent* aContent,
nsIContent* aParentContent);
/**