mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 12:35:58 +00:00
Bug 653649 - New way of getting child lists from frames. (part 2/5) r=roc sr=dbaron
Implement GetChildList(ChildListID) and GetChildLists(nsTArray<ChildList>*) for various frame classes. Remove GetAdditionalChildListName(PRInt32) methods and associated macros and list index constants.
This commit is contained in:
parent
36202edfbd
commit
605a290f3b
@ -1237,14 +1237,20 @@ nsComboboxControlFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
nsBlockFrame::DestroyFrom(aDestructRoot);
|
||||
}
|
||||
|
||||
|
||||
nsFrameList
|
||||
nsComboboxControlFrame::GetChildList(nsIAtom* aListName) const
|
||||
nsComboboxControlFrame::GetChildList(ChildListID aListID) const
|
||||
{
|
||||
if (nsGkAtoms::selectPopupList == aListName) {
|
||||
if (kSelectPopupList == aListID) {
|
||||
return mPopupFrames;
|
||||
}
|
||||
return nsBlockFrame::GetChildList(aListName);
|
||||
return nsBlockFrame::GetChildList(aListID);
|
||||
}
|
||||
|
||||
void
|
||||
nsComboboxControlFrame::GetChildLists(nsTArray<ChildList>* aLists) const
|
||||
{
|
||||
nsBlockFrame::GetChildLists(aLists);
|
||||
mPopupFrames.AppendIfNonempty(aLists, kSelectPopupList);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -1269,25 +1275,6 @@ nsComboboxControlFrame::SetInitialChildList(nsIAtom* aListName,
|
||||
return rv;
|
||||
}
|
||||
|
||||
#define NS_COMBO_FRAME_POPUP_LIST_INDEX (NS_BLOCK_LIST_COUNT)
|
||||
|
||||
nsIAtom*
|
||||
nsComboboxControlFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
||||
{
|
||||
// Maintain a separate child list for the dropdown list (i.e. popup listbox)
|
||||
// This is necessary because we don't want the listbox to be included in the layout
|
||||
// of the combox's children because it would take up space, when it is suppose to
|
||||
// be floating above the display.
|
||||
if (aIndex < NS_BLOCK_LIST_COUNT) {
|
||||
return nsBlockFrame::GetAdditionalChildListName(aIndex);
|
||||
}
|
||||
|
||||
if (NS_COMBO_FRAME_POPUP_LIST_INDEX == aIndex) {
|
||||
return nsGkAtoms::selectPopupList;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//nsIRollupListener
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -85,6 +85,12 @@ public:
|
||||
#endif
|
||||
|
||||
const nsFrameList& GetChildList() const { return mAbsoluteFrames; }
|
||||
void AppendChildList(nsTArray<nsIFrame::ChildList>* aLists,
|
||||
ChildListID aListID) const
|
||||
{
|
||||
NS_ASSERTION(aListID == GetChildListID(), "wrong list ID");
|
||||
GetChildList().AppendIfNonempty(aLists, aListID);
|
||||
}
|
||||
|
||||
nsresult SetInitialChildList(nsIFrame* aDelegatingFrame,
|
||||
nsIAtom* aListName,
|
||||
|
@ -582,66 +582,62 @@ nsBlockFrame::GetCaretBaseline() const
|
||||
// Child frame enumeration
|
||||
|
||||
nsFrameList
|
||||
nsBlockFrame::GetChildList(nsIAtom* aListName) const
|
||||
nsBlockFrame::GetChildList(ChildListID aListID) const
|
||||
{
|
||||
if (nsGkAtoms::absoluteList == aListName) {
|
||||
return mAbsoluteContainer.GetChildList();
|
||||
switch (aListID) {
|
||||
case kPrincipalList:
|
||||
return mFrames;
|
||||
case kOverflowList: {
|
||||
// XXXbz once we start using nsFrameList for our overflow list, we
|
||||
// could switch GetChildList to returning a |const nsFrameList&|.
|
||||
nsLineList* overflowLines = GetOverflowLines();
|
||||
return overflowLines ? nsFrameList(overflowLines->front()->mFirstChild,
|
||||
overflowLines->back()->LastChild())
|
||||
: nsFrameList::EmptyList();
|
||||
}
|
||||
case kAbsoluteList:
|
||||
return mAbsoluteContainer.GetChildList();
|
||||
case kFloatList:
|
||||
return mFloats;
|
||||
case kOverflowOutOfFlowList: {
|
||||
const nsFrameList* list = GetOverflowOutOfFlows();
|
||||
return list ? *list : nsFrameList::EmptyList();
|
||||
}
|
||||
case kPushedFloatsList: {
|
||||
const nsFrameList* list = GetPushedFloats();
|
||||
return list ? *list : nsFrameList::EmptyList();
|
||||
}
|
||||
case kBulletList:
|
||||
return HaveOutsideBullet() ? nsFrameList(mBullet, mBullet)
|
||||
: nsFrameList::EmptyList();
|
||||
default:
|
||||
return nsContainerFrame::GetChildList(aListID);
|
||||
}
|
||||
else if (nsnull == aListName) {
|
||||
return mFrames;
|
||||
}
|
||||
else if (aListName == nsGkAtoms::overflowList) {
|
||||
// XXXbz once we start using nsFrameList for our overflow list, we
|
||||
// could switch GetChildList to returning a |const nsFrameList&|.
|
||||
nsLineList* overflowLines = GetOverflowLines();
|
||||
return overflowLines ? nsFrameList(overflowLines->front()->mFirstChild,
|
||||
overflowLines->back()->LastChild())
|
||||
: nsFrameList::EmptyList();
|
||||
}
|
||||
else if (aListName == nsGkAtoms::overflowOutOfFlowList) {
|
||||
const nsFrameList* list = GetOverflowOutOfFlows();
|
||||
return list ? *list : nsFrameList::EmptyList();
|
||||
}
|
||||
else if (aListName == nsGkAtoms::pushedFloatsList) {
|
||||
const nsFrameList* list = GetPushedFloats();
|
||||
return list ? *list : nsFrameList::EmptyList();
|
||||
}
|
||||
else if (aListName == nsGkAtoms::floatList) {
|
||||
return mFloats;
|
||||
}
|
||||
else if (aListName == nsGkAtoms::bulletList) {
|
||||
return HaveOutsideBullet() ? nsFrameList(mBullet, mBullet)
|
||||
: nsFrameList::EmptyList();
|
||||
}
|
||||
return nsContainerFrame::GetChildList(aListName);
|
||||
}
|
||||
|
||||
#define NS_BLOCK_FRAME_OVERFLOW_OOF_LIST_INDEX (NS_CONTAINER_LIST_COUNT_INCL_OC + 0)
|
||||
#define NS_BLOCK_FRAME_FLOAT_LIST_INDEX (NS_CONTAINER_LIST_COUNT_INCL_OC + 1)
|
||||
#define NS_BLOCK_FRAME_BULLET_LIST_INDEX (NS_CONTAINER_LIST_COUNT_INCL_OC + 2)
|
||||
#define NS_BLOCK_FRAME_ABSOLUTE_LIST_INDEX (NS_CONTAINER_LIST_COUNT_INCL_OC + 3)
|
||||
#define NS_BLOCK_FRAME_PUSHED_FLOATS_LIST_INDEX (NS_CONTAINER_LIST_COUNT_INCL_OC + 4)
|
||||
// If adding/removing lists, don't forget to update the count in nsBlockFrame.h
|
||||
|
||||
nsIAtom*
|
||||
nsBlockFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
||||
void
|
||||
nsBlockFrame::GetChildLists(nsTArray<ChildList>* aLists) const
|
||||
{
|
||||
if (aIndex < NS_CONTAINER_LIST_COUNT_INCL_OC)
|
||||
return nsContainerFrame::GetAdditionalChildListName(aIndex);
|
||||
|
||||
switch (aIndex) {
|
||||
case NS_BLOCK_FRAME_FLOAT_LIST_INDEX:
|
||||
return nsGkAtoms::floatList;
|
||||
case NS_BLOCK_FRAME_BULLET_LIST_INDEX:
|
||||
return nsGkAtoms::bulletList;
|
||||
case NS_BLOCK_FRAME_OVERFLOW_OOF_LIST_INDEX:
|
||||
return nsGkAtoms::overflowOutOfFlowList;
|
||||
case NS_BLOCK_FRAME_ABSOLUTE_LIST_INDEX:
|
||||
return nsGkAtoms::absoluteList;
|
||||
case NS_BLOCK_FRAME_PUSHED_FLOATS_LIST_INDEX:
|
||||
return nsGkAtoms::pushedFloatsList;
|
||||
default:
|
||||
return nsnull;
|
||||
nsContainerFrame::GetChildLists(aLists);
|
||||
nsLineList* overflowLines = GetOverflowLines();
|
||||
if (overflowLines && overflowLines->front()->mFirstChild) {
|
||||
nsFrameList overflowList(overflowLines->front()->mFirstChild,
|
||||
overflowLines->back()->LastChild());
|
||||
overflowList.AppendIfNonempty(aLists, kOverflowList);
|
||||
}
|
||||
const nsFrameList* list = GetOverflowOutOfFlows();
|
||||
if (list) {
|
||||
list->AppendIfNonempty(aLists, kOverflowOutOfFlowList);
|
||||
}
|
||||
mFloats.AppendIfNonempty(aLists, kFloatList);
|
||||
if (HaveOutsideBullet()) {
|
||||
nsFrameList bullet(mBullet, mBullet);
|
||||
bullet.AppendIfNonempty(aLists, kBulletList);
|
||||
}
|
||||
mAbsoluteContainer.AppendChildList(aLists, kAbsoluteList);
|
||||
list = GetPushedFloats();
|
||||
if (list) {
|
||||
list->AppendIfNonempty(aLists, kPushedFloatsList);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,12 +227,19 @@ nsCanvasFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
||||
}
|
||||
|
||||
nsFrameList
|
||||
nsCanvasFrame::GetChildList(nsIAtom* aListName) const
|
||||
nsCanvasFrame::GetChildList(ChildListID aListID) const
|
||||
{
|
||||
if (nsGkAtoms::absoluteList == aListName)
|
||||
if (kAbsoluteList == aListID)
|
||||
return mAbsoluteContainer.GetChildList();
|
||||
|
||||
return nsHTMLContainerFrame::GetChildList(aListName);
|
||||
return nsHTMLContainerFrame::GetChildList(aListID);
|
||||
}
|
||||
|
||||
void
|
||||
nsCanvasFrame::GetChildLists(nsTArray<ChildList>* aLists) const
|
||||
{
|
||||
nsHTMLContainerFrame::GetChildLists(aLists);
|
||||
mAbsoluteContainer.AppendChildList(aLists, kAbsoluteList);
|
||||
}
|
||||
|
||||
nsRect nsCanvasFrame::CanvasArea() const
|
||||
|
@ -84,8 +84,8 @@ public:
|
||||
NS_IMETHOD RemoveFrame(nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame);
|
||||
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
virtual nsFrameList GetChildList(ChildListID aListID) const;
|
||||
virtual void GetChildLists(nsTArray<ChildList>* aLists) const;
|
||||
|
||||
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
|
||||
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
|
||||
|
@ -294,52 +294,57 @@ nsContainerFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
// Child frame enumeration
|
||||
|
||||
nsFrameList
|
||||
nsContainerFrame::GetChildList(nsIAtom* aListName) const
|
||||
nsContainerFrame::GetChildList(ChildListID aListID) const
|
||||
{
|
||||
// We only know about the unnamed principal child list and the overflow
|
||||
// lists
|
||||
if (nsnull == aListName) {
|
||||
return mFrames;
|
||||
// We only know about the principal child list and the overflow lists.
|
||||
switch (aListID) {
|
||||
case kPrincipalList:
|
||||
return mFrames;
|
||||
case kOverflowList: {
|
||||
nsFrameList* list = GetOverflowFrames();
|
||||
return list ? *list : nsFrameList::EmptyList();
|
||||
}
|
||||
case kOverflowContainersList: {
|
||||
nsFrameList* list =
|
||||
GetPropTableFrames(PresContext(), OverflowContainersProperty());
|
||||
return list ? *list : nsFrameList::EmptyList();
|
||||
}
|
||||
case kExcessOverflowContainersList: {
|
||||
nsFrameList* list =
|
||||
GetPropTableFrames(PresContext(), ExcessOverflowContainersProperty());
|
||||
return list ? *list : nsFrameList::EmptyList();
|
||||
}
|
||||
default:
|
||||
return nsSplittableFrame::GetChildList(aListID);
|
||||
}
|
||||
|
||||
if (nsGkAtoms::overflowList == aListName) {
|
||||
nsFrameList* frameList = GetOverflowFrames();
|
||||
return frameList ? *frameList : nsFrameList::EmptyList();
|
||||
}
|
||||
|
||||
if (nsGkAtoms::overflowContainersList == aListName) {
|
||||
nsFrameList* list = GetPropTableFrames(PresContext(),
|
||||
OverflowContainersProperty());
|
||||
return list ? *list : nsFrameList::EmptyList();
|
||||
}
|
||||
|
||||
if (nsGkAtoms::excessOverflowContainersList == aListName) {
|
||||
nsFrameList* list = GetPropTableFrames(PresContext(),
|
||||
ExcessOverflowContainersProperty());
|
||||
return list ? *list : nsFrameList::EmptyList();
|
||||
}
|
||||
|
||||
return nsFrameList::EmptyList();
|
||||
}
|
||||
|
||||
#define NS_CONTAINER_FRAME_OVERFLOW_LIST_INDEX 0
|
||||
#define NS_CONTAINER_FRAME_OVERFLOW_CONTAINERS_LIST_INDEX 1
|
||||
#define NS_CONTAINER_FRAME_EXCESS_OVERFLOW_CONTAINERS_LIST_INDEX 2
|
||||
// If adding/removing lists, don't forget to update count in .h file
|
||||
|
||||
|
||||
nsIAtom*
|
||||
nsContainerFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
||||
static void AppendIfNonempty(const nsIFrame* aFrame,
|
||||
FramePropertyTable* aPropTable,
|
||||
const FramePropertyDescriptor* aProperty,
|
||||
nsTArray<nsIFrame::ChildList>* aLists,
|
||||
nsIFrame::ChildListID aListID)
|
||||
{
|
||||
if (NS_CONTAINER_FRAME_OVERFLOW_LIST_INDEX == aIndex)
|
||||
return nsGkAtoms::overflowList;
|
||||
else if (IsFrameOfType(nsIFrame::eCanContainOverflowContainers)) {
|
||||
if (NS_CONTAINER_FRAME_OVERFLOW_CONTAINERS_LIST_INDEX == aIndex)
|
||||
return nsGkAtoms::overflowContainersList;
|
||||
else if (NS_CONTAINER_FRAME_EXCESS_OVERFLOW_CONTAINERS_LIST_INDEX == aIndex)
|
||||
return nsGkAtoms::excessOverflowContainersList;
|
||||
nsFrameList* list = static_cast<nsFrameList*>(
|
||||
aPropTable->Get(aFrame, aProperty));
|
||||
if (list) {
|
||||
list->AppendIfNonempty(aLists, aListID);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsContainerFrame::GetChildLists(nsTArray<ChildList>* aLists) const
|
||||
{
|
||||
mFrames.AppendIfNonempty(aLists, kPrincipalList);
|
||||
FramePropertyTable* propTable = PresContext()->PropertyTable();
|
||||
::AppendIfNonempty(this, propTable, OverflowProperty(),
|
||||
aLists, kOverflowList);
|
||||
if (IsFrameOfType(nsIFrame::eCanContainOverflowContainers)) {
|
||||
::AppendIfNonempty(this, propTable, OverflowContainersProperty(),
|
||||
aLists, kOverflowContainersList);
|
||||
::AppendIfNonempty(this, propTable, ExcessOverflowContainersProperty(),
|
||||
aLists, kExcessOverflowContainersList);
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -591,6 +591,28 @@ nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||
}
|
||||
}
|
||||
|
||||
// MSVC fails with link error "one or more multiply defined symbols found",
|
||||
// gcc fails with "hidden symbol `nsIFrame::kPrincipalList' isn't defined"
|
||||
// etc if they are not defined.
|
||||
#ifndef _MSC_VER
|
||||
// static nsIFrame constants; initialized in the header file.
|
||||
const nsIFrame::ChildListID nsIFrame::kPrincipalList;
|
||||
const nsIFrame::ChildListID nsIFrame::kAbsoluteList;
|
||||
const nsIFrame::ChildListID nsIFrame::kBulletList;
|
||||
const nsIFrame::ChildListID nsIFrame::kCaptionList;
|
||||
const nsIFrame::ChildListID nsIFrame::kColGroupList;
|
||||
const nsIFrame::ChildListID nsIFrame::kExcessOverflowContainersList;
|
||||
const nsIFrame::ChildListID nsIFrame::kFixedList;
|
||||
const nsIFrame::ChildListID nsIFrame::kFloatList;
|
||||
const nsIFrame::ChildListID nsIFrame::kOverflowContainersList;
|
||||
const nsIFrame::ChildListID nsIFrame::kOverflowList;
|
||||
const nsIFrame::ChildListID nsIFrame::kOverflowOutOfFlowList;
|
||||
const nsIFrame::ChildListID nsIFrame::kPopupList;
|
||||
const nsIFrame::ChildListID nsIFrame::kPushedFloatsList;
|
||||
const nsIFrame::ChildListID nsIFrame::kSelectPopupList;
|
||||
const nsIFrame::ChildListID nsIFrame::kNoReflowPrincipalList;
|
||||
#endif
|
||||
|
||||
/* virtual */ nsMargin
|
||||
nsIFrame::GetUsedMargin() const
|
||||
{
|
||||
@ -918,21 +940,6 @@ nsFrame::GetBaseline() const
|
||||
return mRect.height + GetUsedMargin().bottom;
|
||||
}
|
||||
|
||||
// Child frame enumeration
|
||||
|
||||
nsIAtom*
|
||||
nsFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
||||
{
|
||||
NS_PRECONDITION(aIndex >= 0, "invalid index number");
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsFrameList
|
||||
nsFrame::GetChildList(nsIAtom* aListName) const
|
||||
{
|
||||
return nsFrameList::EmptyList();
|
||||
}
|
||||
|
||||
static nsIFrame*
|
||||
GetActiveSelectionFrame(nsPresContext* aPresContext, nsIFrame* aFrame)
|
||||
{
|
||||
|
@ -191,7 +191,11 @@ public:
|
||||
virtual void SetParent(nsIFrame* aParent);
|
||||
virtual nscoord GetBaseline() const;
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
virtual nsFrameList GetChildList(nsIAtom* aListName) const;
|
||||
virtual nsFrameList GetChildList(ChildListID aListID) const {
|
||||
return nsFrameList::EmptyList();
|
||||
}
|
||||
virtual void GetChildLists(nsTArray<ChildList>* aLists) const {}
|
||||
|
||||
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus);
|
||||
|
@ -60,6 +60,7 @@
|
||||
#include "gfxMatrix.h"
|
||||
#include "nsFrameList.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "mozilla/layout/FrameChildList.h"
|
||||
#include "FramePropertyTable.h"
|
||||
|
||||
/**
|
||||
@ -525,6 +526,11 @@ public:
|
||||
typedef mozilla::FramePropertyDescriptor FramePropertyDescriptor;
|
||||
typedef mozilla::FrameProperties FrameProperties;
|
||||
typedef mozilla::layers::Layer Layer;
|
||||
typedef mozilla::layout::FrameChildList ChildList;
|
||||
typedef mozilla::layout::FrameChildListID ChildListID;
|
||||
typedef mozilla::layout::FrameChildListIDs ChildListIDs;
|
||||
typedef mozilla::layout::FrameChildListIterator ChildListIterator;
|
||||
typedef mozilla::layout::FrameChildListArrayIterator ChildListArrayIterator;
|
||||
|
||||
NS_DECL_QUERYFRAME_TARGET(nsIFrame)
|
||||
|
||||
@ -1017,38 +1023,49 @@ public:
|
||||
return GetBaseline();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to iterate the list of additional child list names. Returns the atom
|
||||
* name for the additional child list at the specified 0-based index, or a
|
||||
* NULL pointer if there are no more named child lists.
|
||||
*
|
||||
* Note that the list is only the additional named child lists and does not
|
||||
* include the unnamed principal child list.
|
||||
*/
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const = 0;
|
||||
|
||||
/**
|
||||
* 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 list. If this is an unknown list name, an empty list
|
||||
* will be returned.
|
||||
* @see #GetAdditionalListName()
|
||||
* @param aListID identifies the requested child list.
|
||||
* @return the child list. If the requested list is unsupported by this
|
||||
* frame type, an empty list will be returned.
|
||||
*/
|
||||
// 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;
|
||||
virtual nsFrameList GetChildList(ChildListID aListID) const = 0;
|
||||
nsFrameList PrincipalChildList() { return GetChildList(kPrincipalList); }
|
||||
virtual void GetChildLists(nsTArray<ChildList>* aLists) const = 0;
|
||||
// XXXbz this method should go away
|
||||
nsIFrame* GetFirstChild(nsIAtom* aListName) const {
|
||||
return GetChildList(aListName).FirstChild();
|
||||
nsIFrame* GetFirstChild(ChildListID aListID) const {
|
||||
return GetChildList(aListID).FirstChild();
|
||||
}
|
||||
// XXXmats this method should also go away then
|
||||
nsIFrame* GetLastChild(nsIAtom* aListName) const {
|
||||
return GetChildList(aListName).LastChild();
|
||||
nsIFrame* GetLastChild(ChildListID aListID) const {
|
||||
return GetChildList(aListID).LastChild();
|
||||
}
|
||||
nsIFrame* GetFirstPrincipalChild() const {
|
||||
return GetFirstChild(kPrincipalList);
|
||||
}
|
||||
|
||||
// The individual concrete child lists.
|
||||
static const ChildListID kPrincipalList = mozilla::layout::kPrincipalList;
|
||||
static const ChildListID kAbsoluteList = mozilla::layout::kAbsoluteList;
|
||||
static const ChildListID kBulletList = mozilla::layout::kBulletList;
|
||||
static const ChildListID kCaptionList = mozilla::layout::kCaptionList;
|
||||
static const ChildListID kColGroupList = mozilla::layout::kColGroupList;
|
||||
static const ChildListID kExcessOverflowContainersList = mozilla::layout::kExcessOverflowContainersList;
|
||||
static const ChildListID kFixedList = mozilla::layout::kFixedList;
|
||||
static const ChildListID kFloatList = mozilla::layout::kFloatList;
|
||||
static const ChildListID kOverflowContainersList = mozilla::layout::kOverflowContainersList;
|
||||
static const ChildListID kOverflowList = mozilla::layout::kOverflowList;
|
||||
static const ChildListID kOverflowOutOfFlowList = mozilla::layout::kOverflowOutOfFlowList;
|
||||
static const ChildListID kPopupList = mozilla::layout::kPopupList;
|
||||
static const ChildListID kPushedFloatsList = mozilla::layout::kPushedFloatsList;
|
||||
static const ChildListID kSelectPopupList = mozilla::layout::kSelectPopupList;
|
||||
// A special alias for kPrincipalList that do not request reflow.
|
||||
static const ChildListID kNoReflowPrincipalList = mozilla::layout::kNoReflowPrincipalList;
|
||||
|
||||
/**
|
||||
* Child frames are linked together in a doubly-linked list
|
||||
|
@ -1207,22 +1207,20 @@ nsPositionedInlineFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
return nsHTMLContainerFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsPositionedInlineFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
||||
{
|
||||
if (0 == aIndex) {
|
||||
return nsGkAtoms::absoluteList;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsFrameList
|
||||
nsPositionedInlineFrame::GetChildList(nsIAtom* aListName) const
|
||||
nsPositionedInlineFrame::GetChildList(ChildListID aListID) const
|
||||
{
|
||||
if (nsGkAtoms::absoluteList == aListName)
|
||||
if (kAbsoluteList == aListID)
|
||||
return mAbsoluteContainer.GetChildList();
|
||||
|
||||
return nsInlineFrame::GetChildList(aListName);
|
||||
return nsInlineFrame::GetChildList(aListID);
|
||||
}
|
||||
|
||||
void
|
||||
nsPositionedInlineFrame::GetChildLists(nsTArray<ChildList>* aLists) const
|
||||
{
|
||||
nsInlineFrame::GetChildLists(aLists);
|
||||
mAbsoluteContainer.AppendChildList(aLists, kAbsoluteList);
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
|
@ -170,25 +170,20 @@ ViewportFrame::RemoveFrame(nsIAtom* aListName,
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
ViewportFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
||||
{
|
||||
NS_PRECONDITION(aIndex >= 0, "illegal index");
|
||||
|
||||
if (0 == aIndex) {
|
||||
return nsGkAtoms::fixedList;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsFrameList
|
||||
ViewportFrame::GetChildList(nsIAtom* aListName) const
|
||||
ViewportFrame::GetChildList(ChildListID aListID) const
|
||||
{
|
||||
if (nsGkAtoms::fixedList == aListName)
|
||||
if (kFixedList == aListID)
|
||||
return mFixedContainer.GetChildList();
|
||||
|
||||
return nsContainerFrame::GetChildList(aListName);
|
||||
return nsContainerFrame::GetChildList(aListID);
|
||||
}
|
||||
|
||||
void
|
||||
ViewportFrame::GetChildLists(nsTArray<ChildList>* aLists) const
|
||||
{
|
||||
nsContainerFrame::GetChildLists(aLists);
|
||||
mFixedContainer.AppendChildList(aLists, kFixedList);
|
||||
}
|
||||
|
||||
/* virtual */ nscoord
|
||||
|
@ -1067,26 +1067,19 @@ nsTableFrame::InsertRowGroups(const nsFrameList::Slice& aRowGroups)
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Child frame enumeration
|
||||
|
||||
nsFrameList
|
||||
nsTableFrame::GetChildList(nsIAtom* aListName) const
|
||||
nsTableFrame::GetChildList(ChildListID aListID) const
|
||||
{
|
||||
if (aListName == nsGkAtoms::colGroupList) {
|
||||
if (aListID == kColGroupList) {
|
||||
return mColGroups;
|
||||
}
|
||||
|
||||
return nsHTMLContainerFrame::GetChildList(aListName);
|
||||
return nsHTMLContainerFrame::GetChildList(aListID);
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsTableFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
||||
void
|
||||
nsTableFrame::GetChildLists(nsTArray<ChildList>* aLists) const
|
||||
{
|
||||
if (aIndex == NS_TABLE_FRAME_COLGROUP_LIST_INDEX) {
|
||||
return nsGkAtoms::colGroupList;
|
||||
}
|
||||
if (aIndex == NS_TABLE_FRAME_OVERFLOW_LIST_INDEX) {
|
||||
return nsGkAtoms::overflowList;
|
||||
}
|
||||
return nsnull;
|
||||
nsHTMLContainerFrame::GetChildLists(aLists);
|
||||
mColGroups.AppendIfNonempty(aLists, kColGroupList);
|
||||
}
|
||||
|
||||
nsRect
|
||||
|
@ -219,24 +219,23 @@ nsTableOuterFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
}
|
||||
|
||||
nsFrameList
|
||||
nsTableOuterFrame::GetChildList(nsIAtom* aListName) const
|
||||
nsTableOuterFrame::GetChildList(ChildListID aListID) const
|
||||
{
|
||||
if (nsGkAtoms::captionList == aListName) {
|
||||
return mCaptionFrames;
|
||||
switch (aListID) {
|
||||
case kPrincipalList:
|
||||
return mFrames;
|
||||
case kCaptionList:
|
||||
return mCaptionFrames;
|
||||
default:
|
||||
return nsFrameList::EmptyList();
|
||||
}
|
||||
if (!aListName) {
|
||||
return mFrames;
|
||||
}
|
||||
return nsFrameList::EmptyList();
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsTableOuterFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
||||
void
|
||||
nsTableOuterFrame::GetChildLists(nsTArray<ChildList>* aLists) const
|
||||
{
|
||||
if (aIndex == NS_TABLE_FRAME_CAPTION_LIST_INDEX) {
|
||||
return nsGkAtoms::captionList;
|
||||
}
|
||||
return nsnull;
|
||||
mFrames.AppendIfNonempty(aLists, kPrincipalList);
|
||||
mCaptionFrames.AppendIfNonempty(aLists, kCaptionList);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -301,15 +301,21 @@ nsMenuFrame::Init(nsIContent* aContent,
|
||||
return rv;
|
||||
}
|
||||
|
||||
// The following methods are all overridden to ensure that the menupopup frame
|
||||
// is placed in the appropriate list.
|
||||
nsFrameList
|
||||
nsMenuFrame::GetChildList(nsIAtom* aListName) const
|
||||
nsMenuFrame::GetChildList(ChildListID aListID) const
|
||||
{
|
||||
if (nsGkAtoms::popupList == aListName) {
|
||||
if (kPopupList == aListID) {
|
||||
return nsFrameList(mPopupFrame, mPopupFrame);
|
||||
}
|
||||
return nsBoxFrame::GetChildList(aListName);
|
||||
return nsBoxFrame::GetChildList(aListID);
|
||||
}
|
||||
|
||||
void
|
||||
nsMenuFrame::GetChildLists(nsTArray<ChildList>* aLists) const
|
||||
{
|
||||
nsBoxFrame::GetChildLists(aLists);
|
||||
nsFrameList popupList(mPopupFrame, mPopupFrame);
|
||||
popupList.AppendIfNonempty(aLists, kPopupList);
|
||||
}
|
||||
|
||||
void
|
||||
@ -335,15 +341,6 @@ nsMenuFrame::SetInitialChildList(nsIAtom* aListName,
|
||||
return nsBoxFrame::SetInitialChildList(aListName, aChildList);
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsMenuFrame::GetAdditionalChildListName(PRInt32 aIndex) const
|
||||
{
|
||||
if (NS_MENU_POPUP_LIST_INDEX == aIndex) {
|
||||
return nsGkAtoms::popupList;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
nsMenuFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user