--- a/layout/base/nsFrameManager.h
+++ b/layout/base/nsFrameManager.h
@@ -58,101 +58,129 @@ struct UndisplayedNode : public LinkedLi
*
* Do not add virtual methods (a vtable pointer) or members to this class, or
* else you'll break the validity of the reinterpret_cast in nsIPresShell's
* FrameManager() method.
*/
class nsFrameManager : public nsFrameManagerBase
{
typedef mozilla::layout::FrameChildListID ChildListID;
+ typedef mozilla::UndisplayedNode UndisplayedNode;
public:
explicit nsFrameManager(nsIPresShell* aPresShell) {
mPresShell = aPresShell;
MOZ_ASSERT(mPresShell, "need a pres shell");
}
~nsFrameManager();
/*
* After Destroy is called, it is an error to call any FrameManager methods.
* Destroy should be called when the frame tree managed by the frame
* manager is no longer being displayed.
*/
void Destroy();
- // Mapping undisplayed content
+
+ // 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);
+
+ /**
+ * Register the style context for the display:contents content, aContent.
+ */
+ void SetDisplayContents(nsIContent* aContent, nsStyleContext* aStyleContext);
+
+ /**
+ * Change the style context for the display:none content, aContent.
+ */
+ void ChangeUndisplayedContent(nsIContent* aContent,
+ nsStyleContext* aStyleContext)
+ {
+ ChangeStyleContextInMap(mDisplayNoneMap, aContent, aStyleContext);
+ }
+
+ /**
+ * Change the style context for the display:contents content, aContent.
+ */
+ void ChangeDisplayContents(nsIContent* aContent,
+ nsStyleContext* aStyleContext)
+ {
+ ChangeStyleContextInMap(mDisplayContentsMap, aContent, aStyleContext);
+ }
+
+ /**
+ * Get the style context for the display:none content, aContent.
+ */
nsStyleContext* GetUndisplayedContent(const nsIContent* aContent)
{
if (!mDisplayNoneMap) {
return nullptr;
}
return GetStyleContextInMap(mDisplayNoneMap, aContent);
}
- mozilla::UndisplayedNode*
- GetAllUndisplayedContentIn(nsIContent* aParentContent);
- void SetUndisplayedContent(nsIContent* aContent,
- nsStyleContext* aStyleContext);
- void ChangeUndisplayedContent(nsIContent* aContent,
- nsStyleContext* aStyleContext)
- {
- ChangeStyleContextInMap(mDisplayNoneMap, aContent, aStyleContext);
- }
- void ClearUndisplayedContentIn(nsIContent* aContent,
- nsIContent* aParentContent);
-
- // display:contents related methods:
/**
- * Return the registered display:contents style context for aContent, if any.
+ * Get the style context for the display:contents content, aContent.
*/
nsStyleContext* GetDisplayContentsStyleFor(const nsIContent* aContent)
{
if (!mDisplayContentsMap) {
return nullptr;
}
return GetStyleContextInMap(mDisplayContentsMap, aContent);
}
/**
- * Return the linked list of UndisplayedNodes containing the registered
- * display:contents children of aParentContent, if any.
+ * Return a linked list of style contexts registered for display:none
+ * children of aParentContent.
*/
- mozilla::UndisplayedNode* GetAllDisplayContentsIn(nsIContent* aParentContent);
+ UndisplayedNode* GetAllUndisplayedContentIn(nsIContent* aParentContent);
+
+ /**
+ * Return a linked list of style contexts registered for display:contents
+ * children of aParentContent.
+ */
+ UndisplayedNode* GetAllDisplayContentsIn(nsIContent* aParentContent);
/**
* Return the relevant undisplayed node for a given content with display:
* contents style.
*/
- mozilla::UndisplayedNode* GetDisplayContentsNodeFor(
- const nsIContent* aContent) {
+ UndisplayedNode* GetDisplayContentsNodeFor(const nsIContent* aContent)
+ {
if (!mDisplayContentsMap) {
return nullptr;
}
return GetUndisplayedNodeInMapFor(mDisplayContentsMap, aContent);
}
/**
- * Register aContent having a display:contents style context.
- */
- void SetDisplayContents(nsIContent* aContent, nsStyleContext* aStyleContext);
- /**
- * Change the registered style context for aContent to aStyleContext.
+ * 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 ChangeDisplayContents(nsIContent* aContent,
- nsStyleContext* aStyleContext)
- {
- ChangeStyleContextInMap(mDisplayContentsMap, aContent, aStyleContext);
- }
+ void ClearUndisplayedContentIn(nsIContent* aContent,
+ nsIContent* aParentContent);
/**
- * Unregister the display:contents style context for aContent, if any.
- * If found, then also unregister any display:contents and display:none
- * style contexts for its descendants.
+ * Unregister the style context for the display:contents content, aContent,
+ * if any. If found, then also unregisters the style contexts for any
+ * display:contents and display:none descendants of aContent.
*/
- void ClearDisplayContentsIn(nsIContent* aContent, nsIContent* aParentContent);
+ void ClearDisplayContentsIn(nsIContent* aContent,
+ nsIContent* aParentContent);
+
// Functions for manipulating the frame model
void AppendFrames(nsContainerFrame* aParentFrame,
ChildListID aListID,
nsFrameList& aFrameList);
void InsertFrames(nsContainerFrame* aParentFrame,
ChildListID aListID,