зеркало из https://github.com/mozilla/gecko-dev.git
Bug 504221 part 5. Switch from GetFirstChild to GetChildList (returning an nsFrameList). For now, keep a GetFirstChild shim so callers don't have to be updated. r=fantasai, r+sr=roc
This commit is contained in:
Родитель
5488eaf4ad
Коммит
cf7d0b6141
|
@ -1230,13 +1230,13 @@ nsComboboxControlFrame::Destroy()
|
|||
}
|
||||
|
||||
|
||||
nsIFrame*
|
||||
nsComboboxControlFrame::GetFirstChild(nsIAtom* aListName) const
|
||||
nsFrameList
|
||||
nsComboboxControlFrame::GetChildList(nsIAtom* aListName) const
|
||||
{
|
||||
if (nsGkAtoms::selectPopupList == aListName) {
|
||||
return mPopupFrames.FirstChild();
|
||||
return mPopupFrames;
|
||||
}
|
||||
return nsBlockFrame::GetFirstChild(aListName);
|
||||
return nsBlockFrame::GetChildList(aListName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -141,7 +141,7 @@ public:
|
|||
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
||||
#endif
|
||||
virtual void Destroy();
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
nsIAtom* GetChildListName() const { return mChildListName; }
|
||||
#endif
|
||||
|
||||
nsIFrame* GetFirstChild() const { return mAbsoluteFrames.FirstChild(); }
|
||||
const nsFrameList& GetChildList() const { return mAbsoluteFrames; }
|
||||
|
||||
nsresult SetInitialChildList(nsIFrame* aDelegatingFrame,
|
||||
nsIAtom* aListName,
|
||||
|
|
|
@ -513,13 +513,16 @@ nsBlockFrame::GetBaseline() const
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Child frame enumeration
|
||||
|
||||
nsIFrame*
|
||||
nsBlockFrame::GetFirstChild(nsIAtom* aListName) const
|
||||
nsFrameList
|
||||
nsBlockFrame::GetChildList(nsIAtom* aListName) const
|
||||
{
|
||||
if (nsGkAtoms::absoluteList == aListName) {
|
||||
return mAbsoluteContainer.GetFirstChild();
|
||||
return mAbsoluteContainer.GetChildList();
|
||||
}
|
||||
else if (nsnull == aListName) {
|
||||
// XXXbz once we start using mFrames, or some other sane storage for our
|
||||
// in-flow kids, we could switch GetChildList to returning a |const
|
||||
// nsFrameList&|.
|
||||
return (mLines.empty()) ? nsnull : mLines.front()->mFirstChild;
|
||||
}
|
||||
else if (aListName == nsGkAtoms::overflowList) {
|
||||
|
@ -527,15 +530,15 @@ nsBlockFrame::GetFirstChild(nsIAtom* aListName) const
|
|||
return overflowLines ? overflowLines->front()->mFirstChild : nsnull;
|
||||
}
|
||||
else if (aListName == nsGkAtoms::overflowOutOfFlowList) {
|
||||
return GetOverflowOutOfFlows().FirstChild();
|
||||
return GetOverflowOutOfFlows();
|
||||
}
|
||||
else if (aListName == nsGkAtoms::floatList) {
|
||||
return mFloats.FirstChild();
|
||||
return mFloats;
|
||||
}
|
||||
else if (aListName == nsGkAtoms::bulletList) {
|
||||
return (HaveOutsideBullet()) ? mBullet : nsnull;
|
||||
}
|
||||
return nsContainerFrame::GetFirstChild(aListName);;
|
||||
return nsContainerFrame::GetChildList(aListName);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
|
@ -6164,8 +6167,9 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
DisplayOverflowContainers(aBuilder, aDirtyRect, aLists);
|
||||
}
|
||||
|
||||
aBuilder->MarkFramesForDisplayList(this, mFloats.FirstChild(), aDirtyRect);
|
||||
aBuilder->MarkFramesForDisplayList(this, mAbsoluteContainer.GetFirstChild(), aDirtyRect);
|
||||
aBuilder->MarkFramesForDisplayList(this, mFloats, aDirtyRect);
|
||||
aBuilder->MarkFramesForDisplayList(this, mAbsoluteContainer.GetChildList(),
|
||||
aDirtyRect);
|
||||
|
||||
// Don't use the line cursor if we might have a descendant placeholder ...
|
||||
// it might skip lines that contain placeholders but don't themselves
|
||||
|
|
|
@ -176,7 +176,7 @@ public:
|
|||
nsIFrame* aFrameList);
|
||||
NS_IMETHOD RemoveFrame(nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame);
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
virtual nsIFrame* GetLastChild(nsIAtom* aListName) const;
|
||||
virtual nscoord GetBaseline() const;
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
|
|
|
@ -311,28 +311,34 @@ nsContainerFrame::Destroy()
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Child frame enumeration
|
||||
|
||||
nsIFrame*
|
||||
nsContainerFrame::GetFirstChild(nsIAtom* aListName) const
|
||||
nsFrameList
|
||||
nsContainerFrame::GetChildList(nsIAtom* aListName) const
|
||||
{
|
||||
// We only know about the unnamed principal child list and the overflow
|
||||
// list
|
||||
// lists
|
||||
if (nsnull == aListName) {
|
||||
return mFrames.FirstChild();
|
||||
} else if (nsGkAtoms::overflowList == aListName) {
|
||||
return mFrames;
|
||||
}
|
||||
|
||||
if (nsGkAtoms::overflowList == aListName) {
|
||||
nsFrameList* frameList = GetOverflowFrames();
|
||||
return frameList ? frameList->FirstChild() : nsnull;
|
||||
} else if (nsGkAtoms::overflowContainersList == aListName) {
|
||||
return frameList ? *frameList : nsFrameList::EmptyList();
|
||||
}
|
||||
|
||||
if (nsGkAtoms::overflowContainersList == aListName) {
|
||||
nsFrameList* list = GetPropTableFrames(PresContext(),
|
||||
nsGkAtoms::overflowContainersProperty);
|
||||
return (list) ? list->FirstChild() : nsnull;
|
||||
} else if (nsGkAtoms::excessOverflowContainersList == aListName) {
|
||||
return list ? *list : nsFrameList::EmptyList();
|
||||
}
|
||||
|
||||
if (nsGkAtoms::excessOverflowContainersList == aListName) {
|
||||
nsFrameList* list = GetPropTableFrames(PresContext(),
|
||||
nsGkAtoms::excessOverflowContainersProperty);
|
||||
return (list) ? list->FirstChild() : nsnull;
|
||||
return list ? *list : nsFrameList::EmptyList();
|
||||
|
||||
} else {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return nsFrameList::EmptyList();
|
||||
}
|
||||
|
||||
#define NS_CONTAINER_FRAME_OVERFLOW_LIST_INDEX 0
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
NS_IMETHOD RemoveFrame(nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame);
|
||||
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
virtual void Destroy();
|
||||
virtual void ChildIsDirty(nsIFrame* aChild);
|
||||
|
|
|
@ -759,10 +759,10 @@ nsFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsFrame::GetFirstChild(nsIAtom* aListName) const
|
||||
nsFrameList
|
||||
nsFrame::GetChildList(nsIAtom* aListName) const
|
||||
{
|
||||
return nsnull;
|
||||
return nsFrameList::EmptyList();
|
||||
}
|
||||
|
||||
static nsIFrame*
|
||||
|
|
|
@ -179,7 +179,7 @@ public:
|
|||
NS_IMETHOD SetParent(const nsIFrame* aParent);
|
||||
virtual nscoord GetBaseline() const;
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus);
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
nsIFrame* aOldFrame);
|
||||
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
|
||||
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
||||
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
||||
|
@ -383,13 +383,13 @@ CanvasFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
|||
return nsHTMLContainerFrame::GetAdditionalChildListName(aIndex);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
CanvasFrame::GetFirstChild(nsIAtom* aListName) const
|
||||
nsFrameList
|
||||
CanvasFrame::GetChildList(nsIAtom* aListName) const
|
||||
{
|
||||
if (nsGkAtoms::absoluteList == aListName)
|
||||
return mAbsoluteContainer.GetFirstChild();
|
||||
return mAbsoluteContainer.GetChildList();
|
||||
|
||||
return nsHTMLContainerFrame::GetFirstChild(aListName);
|
||||
return nsHTMLContainerFrame::GetChildList(aListName);
|
||||
}
|
||||
|
||||
nsRect CanvasFrame::CanvasArea() const
|
||||
|
@ -477,7 +477,8 @@ CanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
DisplayOverflowContainers(aBuilder, aDirtyRect, aLists);
|
||||
}
|
||||
|
||||
aBuilder->MarkFramesForDisplayList(this, mAbsoluteContainer.GetFirstChild(), aDirtyRect);
|
||||
aBuilder->MarkFramesForDisplayList(this, mAbsoluteContainer.GetChildList(),
|
||||
aDirtyRect);
|
||||
|
||||
// Force a background to be shown. We may have a background propagated to us,
|
||||
// in which case GetStyleBackground wouldn't have the right background
|
||||
|
|
|
@ -848,14 +848,23 @@ public:
|
|||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const = 0;
|
||||
|
||||
/**
|
||||
* Get the first child frame from the specified child list.
|
||||
* Get the specified child list.
|
||||
*
|
||||
* @param aListName the name of the child list. A NULL pointer for the atom
|
||||
* name means the unnamed principal child list
|
||||
* @return the child frame, or NULL if there is no such child
|
||||
* @return the child list. If this is an unknown list name, an empty list
|
||||
* will be returned.
|
||||
* @see #GetAdditionalListName()
|
||||
*/
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const = 0;
|
||||
// XXXbz if all our frame storage were actually backed by nsFrameList, we
|
||||
// could make this return a const reference... nsBlockFrame is the only real
|
||||
// culprit here. Make sure to assign the return value of this function into
|
||||
// a |const nsFrameList&|, not an nsFrameList.
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const = 0;
|
||||
// XXXbz this method should go away
|
||||
nsIFrame* GetFirstChild(nsIAtom* aListName) const {
|
||||
return GetChildList(aListName).FirstChild();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last child frame from the specified child list.
|
||||
|
|
|
@ -1148,7 +1148,8 @@ nsPositionedInlineFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists)
|
||||
{
|
||||
aBuilder->MarkFramesForDisplayList(this, mAbsoluteContainer.GetFirstChild(), aDirtyRect);
|
||||
aBuilder->MarkFramesForDisplayList(this, mAbsoluteContainer.GetChildList(),
|
||||
aDirtyRect);
|
||||
return nsHTMLContainerFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
||||
}
|
||||
|
||||
|
@ -1161,13 +1162,13 @@ nsPositionedInlineFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsPositionedInlineFrame::GetFirstChild(nsIAtom* aListName) const
|
||||
nsFrameList
|
||||
nsPositionedInlineFrame::GetChildList(nsIAtom* aListName) const
|
||||
{
|
||||
if (nsGkAtoms::absoluteList == aListName)
|
||||
return mAbsoluteContainer.GetFirstChild();
|
||||
return mAbsoluteContainer.GetChildList();
|
||||
|
||||
return nsInlineFrame::GetFirstChild(aListName);
|
||||
return nsInlineFrame::GetChildList(aListName);
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
|
|
|
@ -272,7 +272,7 @@ public:
|
|||
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
|
||||
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
|
|
@ -97,7 +97,8 @@ ViewportFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
// mark our visible out-of-flow frames (i.e., the fixed position frames) so
|
||||
// that display list construction is guaranteed to recurse into their
|
||||
// ancestors.
|
||||
aBuilder->MarkFramesForDisplayList(this, mFixedContainer.GetFirstChild(), aDirtyRect);
|
||||
aBuilder->MarkFramesForDisplayList(this, mFixedContainer.GetChildList(),
|
||||
aDirtyRect);
|
||||
|
||||
nsIFrame* kid = mFrames.FirstChild();
|
||||
if (!kid)
|
||||
|
@ -120,7 +121,7 @@ ViewportFrame::AppendFrames(nsIAtom* aListName,
|
|||
}
|
||||
else {
|
||||
NS_ASSERTION(!aListName, "unexpected child list");
|
||||
NS_ASSERTION(!GetFirstChild(nsnull), "Shouldn't have any kids!");
|
||||
NS_ASSERTION(GetChildList(nsnull).IsEmpty(), "Shouldn't have any kids!");
|
||||
rv = nsContainerFrame::AppendFrames(aListName, aFrameList);
|
||||
}
|
||||
|
||||
|
@ -139,7 +140,7 @@ ViewportFrame::InsertFrames(nsIAtom* aListName,
|
|||
}
|
||||
else {
|
||||
NS_ASSERTION(!aListName, "unexpected child list");
|
||||
NS_ASSERTION(!GetFirstChild(nsnull), "Shouldn't have any kids!");
|
||||
NS_ASSERTION(GetChildList(nsnull).IsEmpty(), "Shouldn't have any kids!");
|
||||
rv = nsContainerFrame::InsertFrames(aListName, aPrevFrame, aFrameList);
|
||||
}
|
||||
|
||||
|
@ -175,13 +176,13 @@ ViewportFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
|||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
ViewportFrame::GetFirstChild(nsIAtom* aListName) const
|
||||
nsFrameList
|
||||
ViewportFrame::GetChildList(nsIAtom* aListName) const
|
||||
{
|
||||
if (nsGkAtoms::fixedList == aListName)
|
||||
return mFixedContainer.GetFirstChild();
|
||||
return mFixedContainer.GetChildList();
|
||||
|
||||
return nsContainerFrame::GetFirstChild(aListName);
|
||||
return nsContainerFrame::GetChildList(aListName);
|
||||
}
|
||||
|
||||
/* virtual */ nscoord
|
||||
|
@ -304,8 +305,8 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsPoint offset = AdjustReflowStateForScrollbars(&reflowState);
|
||||
|
||||
#ifdef DEBUG
|
||||
nsIFrame* f = mFixedContainer.GetFirstChild();
|
||||
NS_ASSERTION(!f || (offset.x == 0 && offset.y == 0),
|
||||
NS_ASSERTION(mFixedContainer.GetChildList().IsEmpty() ||
|
||||
(offset.x == 0 && offset.y == 0),
|
||||
"We don't handle correct positioning of fixed frames with "
|
||||
"scrollbars in odd positions");
|
||||
#endif
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
|
||||
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
|
|
|
@ -1214,14 +1214,14 @@ nsTableFrame::InsertRowGroups(nsIFrame* aFirstRowGroupFrame,
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Child frame enumeration
|
||||
|
||||
nsIFrame*
|
||||
nsTableFrame::GetFirstChild(nsIAtom* aListName) const
|
||||
nsFrameList
|
||||
nsTableFrame::GetChildList(nsIAtom* aListName) const
|
||||
{
|
||||
if (aListName == nsGkAtoms::colGroupList) {
|
||||
return mColGroups.FirstChild();
|
||||
return mColGroups;
|
||||
}
|
||||
|
||||
return nsHTMLContainerFrame::GetFirstChild(aListName);
|
||||
return nsHTMLContainerFrame::GetChildList(aListName);
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
|
|
|
@ -260,10 +260,7 @@ public:
|
|||
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
|
||||
/** return the first child belonging to the list aListName.
|
||||
* @see nsIFrame::GetFirstChild
|
||||
*/
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
|
||||
/** @see nsIFrame::GetAdditionalChildListName */
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
|
|
|
@ -215,16 +215,16 @@ nsTableOuterFrame::Destroy()
|
|||
nsHTMLContainerFrame::Destroy();
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsTableOuterFrame::GetFirstChild(nsIAtom* aListName) const
|
||||
nsFrameList
|
||||
nsTableOuterFrame::GetChildList(nsIAtom* aListName) const
|
||||
{
|
||||
if (nsGkAtoms::captionList == aListName) {
|
||||
return mCaptionFrames.FirstChild();
|
||||
return mCaptionFrames;
|
||||
}
|
||||
if (!aListName) {
|
||||
return mFrames.FirstChild();
|
||||
return mFrames;
|
||||
}
|
||||
return nsnull;
|
||||
return nsFrameList::EmptyList();
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
|
||||
|
|
|
@ -325,13 +325,13 @@ nsMenuFrame::~nsMenuFrame()
|
|||
|
||||
// The following methods are all overridden to ensure that the menupopup frame
|
||||
// is placed in the appropriate list.
|
||||
nsIFrame*
|
||||
nsMenuFrame::GetFirstChild(nsIAtom* aListName) const
|
||||
nsFrameList
|
||||
nsMenuFrame::GetChildList(nsIAtom* aListName) const
|
||||
{
|
||||
if (nsGkAtoms::popupList == aListName) {
|
||||
return mPopupFrame;
|
||||
}
|
||||
return nsBoxFrame::GetFirstChild(aListName);
|
||||
return nsBoxFrame::GetChildList(aListName);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
// The following methods are all overridden so that the menupopup
|
||||
// can be stored in a separate list, so that it doesn't impact reflow of the
|
||||
// actual menu item at all.
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
|
|
Загрузка…
Ссылка в новой задаче