Bug 1388939, part 3 - Give clear names to the nsFrameManager methods for registering undisplayed style contexts. r=dholbert draft
authorJonathan Watt <jwatt@jwatt.org>
Thu, 10 Aug 2017 01:44:47 +0100
changeset 643661 69c3bd8d39f91a30176a7873cfebe43947e85e77
parent 643660 b51659c11d3e6a782cde04f4286fa9a4cce740c3
child 643662 4f001c9d5e8e1555a51dcb14ccc12ef1798577a4
push id73172
push userjwatt@jwatt.org
push dateThu, 10 Aug 2017 00:52:54 +0000
reviewersdholbert
bugs1388939
milestone57.0a1
Bug 1388939, part 3 - Give clear names to the nsFrameManager methods for registering undisplayed style contexts. r=dholbert MozReview-Commit-ID: 6mKYwHqwp1b
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSFrameConstructor.h
layout/base/nsFrameManager.cpp
layout/base/nsFrameManager.h
--- 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);