зеркало из https://github.com/mozilla/gecko-dev.git
Bug 496823. Blocks can implement GetLastChild() much faster than by just getting first child and iterating its siblings. r=roc
This commit is contained in:
Родитель
d83933dd9b
Коммит
1950f2e7c4
|
@ -5725,13 +5725,13 @@ AdjustAppendParentForAfterContent(nsPresContext* aPresContext,
|
|||
static nsIFrame*
|
||||
FindAppendPrevSibling(nsIFrame* aParentFrame, nsIFrame* aAfterFrame)
|
||||
{
|
||||
nsFrameList childList(aParentFrame->GetFirstChild(nsnull));
|
||||
if (aAfterFrame) {
|
||||
nsFrameList childList(aParentFrame->GetFirstChild(nsnull));
|
||||
NS_ASSERTION(aAfterFrame->GetParent() == aParentFrame, "Wrong parent");
|
||||
return childList.GetPrevSiblingFor(aAfterFrame);
|
||||
}
|
||||
|
||||
return childList.LastChild();
|
||||
return aParentFrame->GetLastChild(nsnull);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -538,6 +538,20 @@ nsBlockFrame::GetFirstChild(nsIAtom* aListName) const
|
|||
return nsContainerFrame::GetFirstChild(aListName);;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsBlockFrame::GetLastChild(nsIAtom* aListName) const
|
||||
{
|
||||
if (aListName) {
|
||||
return nsBlockFrameSuper::GetLastChild(aListName);
|
||||
}
|
||||
|
||||
if (mLines.empty()) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return mLines.back()->LastChild();
|
||||
}
|
||||
|
||||
#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)
|
||||
|
|
|
@ -177,6 +177,7 @@ public:
|
|||
NS_IMETHOD RemoveFrame(nsIAtom* aListName,
|
||||
nsIFrame* aOldFrame);
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
virtual nsIFrame* GetLastChild(nsIAtom* aListName) const;
|
||||
virtual nscoord GetBaseline() const;
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
virtual void Destroy();
|
||||
|
|
|
@ -1667,6 +1667,12 @@ nsIFrame::CreateWidgetForView(nsIView* aView)
|
|||
return aView->CreateWidget(kWidgetCID);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsIFrame::GetLastChild(nsIAtom* aListName) const
|
||||
{
|
||||
return nsLayoutUtils::GetLastSibling(GetFirstChild(aListName));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -856,6 +856,16 @@ public:
|
|||
*/
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const = 0;
|
||||
|
||||
/**
|
||||
* Get the last child frame from 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
|
||||
* @see #GetAdditionalListName()
|
||||
*/
|
||||
virtual nsIFrame* GetLastChild(nsIAtom* aListName) const;
|
||||
|
||||
/**
|
||||
* Child frames are linked together in a singly-linked list
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче