Bug 1388939, part 3 - Give clear names to the nsFrameManager methods for registering undisplayed style contexts. r=dholbert
MozReview-Commit-ID: 6mKYwHqwp1b
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -2601,17 +2601,17 @@ nsCSSFrameConstructor::ConstructDocEleme
// --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
NS_ASSERTION(!display->IsScrollableOverflow() ||
state.mPresContext->IsPaginated() ||
propagatedScrollFrom == aDocElement,
"Scrollbars should have been propagated to the viewport");
if (MOZ_UNLIKELY(display->mDisplay == StyleDisplay::None)) {
- SetUndisplayedContent(aDocElement, styleContext);
+ RegisterDisplayNoneStyleFor(aDocElement, styleContext);
return nullptr;
}
TreeMatchContext::AutoAncestorPusher ancestorPusher(state.mTreeMatchContext);
ancestorPusher.PushAncestorAndStyleScope(aDocElement);
// Make sure to start any background image loads for the root element now.
styleContext->StartBackgroundImageLoads();
@@ -5828,17 +5828,17 @@ nsCSSFrameConstructor::SetAsUndisplayedC
aContent->UnbindFromTree();
}
return;
}
NS_ASSERTION(!aIsGeneratedContent, "Should have had pseudo type");
if (aState.mCreatingExtraFrames) {
MOZ_ASSERT(GetUndisplayedContent(aContent),
- "should have called SetUndisplayedContent earlier");
+ "should have called RegisterDisplayNoneStyleFor earlier");
return;
}
aList.AppendUndisplayedItem(aContent, aStyleContext);
}
void
nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState& aState,
nsIContent* aContent,
@@ -6073,17 +6073,18 @@ nsCSSFrameConstructor::AddFrameConstruct
if (canHavePageBreak && display->mBreakBefore) {
AddPageBreakItem(aContent, aItems);
}
if (MOZ_UNLIKELY(bits & FCDATA_IS_CONTENTS)) {
if (!GetDisplayContentsStyleFor(aContent)) {
MOZ_ASSERT(styleContext->GetPseudo() || !isGeneratedContent,
"Should have had pseudo type");
- aState.mFrameManager->SetDisplayContents(aContent, styleContext);
+ aState.mFrameManager->RegisterDisplayContentsStyleFor(aContent,
+ styleContext);
} else {
aState.mFrameManager->ChangeDisplayContents(aContent, styleContext);
}
TreeMatchContext::AutoAncestorPusher ancestorPusher(aState.mTreeMatchContext);
if (aState.HasAncestorFilter()) {
ancestorPusher.PushAncestorAndStyleScope(aContent->AsElement());
} else {
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -887,17 +887,17 @@ private:
// haven't, then we're just throwing it away and will probably try again.
if (!mUndisplayedItems.IsEmpty() && mTriedConstructingFrames) {
// We could store the frame manager in a member, but just
// getting it off the style context is not too bad.
nsFrameManager *mgr =
mUndisplayedItems[0].mStyleContext->PresContext()->FrameManager();
for (uint32_t i = 0; i < mUndisplayedItems.Length(); ++i) {
UndisplayedItem& item = mUndisplayedItems[i];
- mgr->SetUndisplayedContent(item.mContent, item.mStyleContext);
+ mgr->RegisterDisplayNoneStyleFor(item.mContent, item.mStyleContext);
}
}
}
void SetLineBoundaryAtStart(bool aBoundary) { mLineBoundaryAtStart = aBoundary; }
void SetLineBoundaryAtEnd(bool aBoundary) { mLineBoundaryAtEnd = aBoundary; }
void SetParentHasNoXBLChildren(bool aHasNoXBLChildren) {
mParentHasNoXBLChildren = aHasNoXBLChildren;
--- a/layout/base/nsFrameManager.cpp
+++ b/layout/base/nsFrameManager.cpp
@@ -205,18 +205,18 @@ nsFrameManager::SetStyleContextInMap(Und
shell->GetDocument()->GetRootElement() == aContent),
"undisplayed content must have a parent, unless it's the root "
"element");
#endif
aMap->AddNodeFor(parent, aContent, aStyleContext);
}
void
-nsFrameManager::SetUndisplayedContent(nsIContent* aContent,
- nsStyleContext* aStyleContext)
+nsFrameManager::RegisterDisplayNoneStyleFor(nsIContent* aContent,
+ nsStyleContext* aStyleContext)
{
if (!mDisplayNoneMap) {
mDisplayNoneMap = new UndisplayedMap;
}
SetStyleContextInMap(mDisplayNoneMap, aContent, aStyleContext);
}
/* static */ void
@@ -309,18 +309,18 @@ nsFrameManager::ClearAllMapsFor(nsIConte
ClearDisplayContentsIn(child, parent);
}
}
}
//----------------------------------------------------------------------
void
-nsFrameManager::SetDisplayContents(nsIContent* aContent,
- nsStyleContext* aStyleContext)
+nsFrameManager::RegisterDisplayContentsStyleFor(nsIContent* aContent,
+ nsStyleContext* aStyleContext)
{
if (!mDisplayContentsMap) {
mDisplayContentsMap = new UndisplayedMap;
}
SetStyleContextInMap(mDisplayContentsMap, aContent, aStyleContext);
}
UndisplayedNode*
--- a/layout/base/nsFrameManager.h
+++ b/layout/base/nsFrameManager.h
@@ -83,23 +83,24 @@ public:
// display:none and display:contents content does not get an nsIFrame. To
// enable the style context for such content to be obtained we store the
// contexts in a couple of hash tables. The following methods provide the
// API that's used to set, reset, obtain and clear these style contexts.
/**
* Register the style context for the display:none content, aContent.
*/
- void SetUndisplayedContent(nsIContent* aContent,
- nsStyleContext* aStyleContext);
+ void RegisterDisplayNoneStyleFor(nsIContent* aContent,
+ nsStyleContext* aStyleContext);
/**
* Register the style context for the display:contents content, aContent.
*/
- void SetDisplayContents(nsIContent* aContent, nsStyleContext* aStyleContext);
+ void RegisterDisplayContentsStyleFor(nsIContent* aContent,
+ nsStyleContext* aStyleContext);
/**
* Change the style context for the display:none content, aContent.
*/
void ChangeUndisplayedContent(nsIContent* aContent,
nsStyleContext* aStyleContext)
{
ChangeStyleContextInMap(mDisplayNoneMap, aContent, aStyleContext);