Bug 841261: Use init list instead of assignment in nsFrameIterator constructor. r=mats

This commit is contained in:
Daniel Holbert 2013-02-18 08:59:55 -08:00
Родитель 83a84bfa76
Коммит 77bedd32f8
1 изменённых файлов: 22 добавлений и 19 удалений

Просмотреть файл

@ -33,13 +33,11 @@ public:
protected:
void setCurrent(nsIFrame *aFrame){mCurrent = aFrame;}
nsIFrame *getCurrent(){return mCurrent;}
void setStart(nsIFrame *aFrame){mStart = aFrame;}
nsIFrame *getStart(){return mStart;}
nsIFrame *getLast(){return mLast;}
void setLast(nsIFrame *aFrame){mLast = aFrame;}
int8_t getOffEdge(){return mOffEdge;}
void setOffEdge(int8_t aOffEdge){mOffEdge = aOffEdge;}
void SetLockInScrollView(bool aLockScroll){mLockScroll = aLockScroll;}
/*
Our own versions of the standard frame tree navigation
@ -85,15 +83,15 @@ protected:
nsIFrame* GetPlaceholderFrame(nsIFrame* aFrame);
bool IsPopupFrame(nsIFrame* aFrame);
nsPresContext* mPresContext;
bool mLockScroll;
bool mFollowOOFs;
nsIteratorType mType;
nsPresContext* const mPresContext;
const bool mLockScroll;
const bool mFollowOOFs;
const nsIteratorType mType;
private:
nsIFrame *mStart;
nsIFrame *mCurrent;
nsIFrame *mLast; //the last one that was in current;
nsIFrame* const mStart;
nsIFrame* mCurrent;
nsIFrame* mLast; //the last one that was in current;
int8_t mOffEdge; //0= no -1 to far prev, 1 to far next;
};
@ -141,6 +139,11 @@ NS_NewFrameTraversal(nsIFrameEnumerator **aEnumerator,
{
if (!aEnumerator || !aStart)
return NS_ERROR_NULL_POINTER;
if (aFollowOOFs) {
aStart = nsPlaceholderFrame::GetRealFrameFor(aStart);
}
nsCOMPtr<nsIFrameEnumerator> trav;
if (aVisual) {
trav = new nsVisualIterator(aPresContext, aStart, aType,
@ -185,17 +188,17 @@ NS_IMPL_ISUPPORTS1(nsFrameIterator, nsIFrameEnumerator)
nsFrameIterator::nsFrameIterator(nsPresContext* aPresContext, nsIFrame *aStart,
nsIteratorType aType, bool aLockInScrollView,
bool aFollowOOFs)
: mPresContext(aPresContext),
mLockScroll(aLockInScrollView),
mFollowOOFs(aFollowOOFs),
mType(aType),
mStart(aStart),
mCurrent(aStart),
mLast(aStart),
mOffEdge(0)
{
mOffEdge = 0;
mPresContext = aPresContext;
if (aFollowOOFs && aStart)
aStart = nsPlaceholderFrame::GetRealFrameFor(aStart);
setStart(aStart);
setCurrent(aStart);
setLast(aStart);
mType = aType;
SetLockInScrollView(aLockInScrollView);
mFollowOOFs = aFollowOOFs;
MOZ_ASSERT(!aFollowOOFs || aStart->GetType() != nsGkAtoms::placeholderFrame,
"Caller should have resolved placeholder frame");
}