Bug 1388939, part 8 - Remove nsFrameManager::GetDisplayContentsNodeFor and rewrite its caller to use other APIs. r=dholbert

MozReview-Commit-ID: 6S4MpwBlrjj
This commit is contained in:
Jonathan Watt 2017-08-02 09:56:28 +01:00
Родитель a7bc022071
Коммит 3d364409fe
2 изменённых файлов: 10 добавлений и 21 удалений

Просмотреть файл

@ -610,14 +610,14 @@ ServoRestyleManager::ProcessPostTraversal(
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();
}
}
@ -637,7 +637,7 @@ ServoRestyleManager::ProcessPostTraversal(
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());
@ -659,9 +659,10 @@ ServoRestyleManager::ProcessPostTraversal(
f->SetStyleContext(newContext);
}
if (MOZ_UNLIKELY(displayContentsNode)) {
if (MOZ_UNLIKELY(displayContentsStyle)) {
MOZ_ASSERT(!styleFrame);
displayContentsNode->mStyle = newContext;
PresContext()->FrameConstructor()->
ChangeRegisteredDisplayContentsStyleFor(aElement, newContext);
}
if (styleFrame) {
@ -707,7 +708,7 @@ ServoRestyleManager::ProcessPostTraversal(
StyleChildrenIterator it(aElement);
TextPostTraversalState textState(*upToDateContext,
displayContentsNode && wasRestyled,
displayContentsStyle && wasRestyled,
childrenRestyleState);
for (nsIContent* n = it.GetNextChild(); n; n = it.GetNextChild()) {
if (traverseElementChildren && n->IsElement()) {

Просмотреть файл

@ -153,18 +153,6 @@ public:
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 this method also unregisters the style contexts