diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index c9408a5d992..dd3a4d425f1 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -1294,7 +1294,8 @@ nsXBLBinding::BuildInsertionTable() PRUint32 count; childrenElements->Count(&count); - for (PRUint32 i = 0; i < count; i++) { + PRUint32 i; + for (i = 0; i < count; i++) { nsCOMPtr supp; childrenElements->GetElementAt(i, getter_AddRefs(supp)); nsCOMPtr child(do_QueryInterface(supp)); @@ -1332,6 +1333,20 @@ nsXBLBinding::BuildInsertionTable() } } } + + // Now remove the elements. + for (i = 0; i < count; i++) { + nsCOMPtr supp; + childrenElements->GetElementAt(i, getter_AddRefs(supp)); + nsCOMPtr child(do_QueryInterface(supp)); + if (child) { + nsCOMPtr parent; + child->GetParent(*getter_AddRefs(parent)); + PRInt32 index; + parent->IndexOf(child, index); + parent->RemoveChildAt(index, PR_FALSE); + } + } } PRBool diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index d36a04e44ef..02a96303b83 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -152,7 +152,7 @@ static PRBool gReallyNoisyContentUpdates = PR_FALSE; static PRBool gNoisyInlineConstruction = PR_FALSE; #endif -//#define XULTREE +#define XULTREE #ifdef XULTREE #include "nsXULTreeFrame.h" #include "nsXULTreeOuterGroupFrame.h" @@ -9050,8 +9050,8 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, nsBoxLayoutState state(aPresContext); treeRowGroup->MarkDirtyChildren(state); treeRowGroup->ClearRowGroupInfo(); - return NS_OK; } + return NS_OK; #else nsTreeRowGroupFrame* treeRowGroup = (nsTreeRowGroupFrame*)parentFrame; if (treeRowGroup) { diff --git a/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/layout/html/forms/src/nsGfxTextControlFrame2.cpp index eb27d4cb03d..d26c04a1b38 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -1450,7 +1450,7 @@ nsGfxTextControlFrame2::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize) if (!aReflowState) return NS_OK; - if (eReflowReason_Initial == aReflowState->reason) + if (mState & NS_FRAME_FIRST_REFLOW) { nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE); nsFormFrame::AddFormControlFrame(aPresContext, *NS_STATIC_CAST(nsIFrame*, this)); diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index d36a04e44ef..02a96303b83 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -152,7 +152,7 @@ static PRBool gReallyNoisyContentUpdates = PR_FALSE; static PRBool gNoisyInlineConstruction = PR_FALSE; #endif -//#define XULTREE +#define XULTREE #ifdef XULTREE #include "nsXULTreeFrame.h" #include "nsXULTreeOuterGroupFrame.h" @@ -9050,8 +9050,8 @@ nsCSSFrameConstructor::ContentRemoved(nsIPresContext* aPresContext, nsBoxLayoutState state(aPresContext); treeRowGroup->MarkDirtyChildren(state); treeRowGroup->ClearRowGroupInfo(); - return NS_OK; } + return NS_OK; #else nsTreeRowGroupFrame* treeRowGroup = (nsTreeRowGroupFrame*)parentFrame; if (treeRowGroup) { diff --git a/layout/xbl/src/nsXBLBinding.cpp b/layout/xbl/src/nsXBLBinding.cpp index c9408a5d992..dd3a4d425f1 100644 --- a/layout/xbl/src/nsXBLBinding.cpp +++ b/layout/xbl/src/nsXBLBinding.cpp @@ -1294,7 +1294,8 @@ nsXBLBinding::BuildInsertionTable() PRUint32 count; childrenElements->Count(&count); - for (PRUint32 i = 0; i < count; i++) { + PRUint32 i; + for (i = 0; i < count; i++) { nsCOMPtr supp; childrenElements->GetElementAt(i, getter_AddRefs(supp)); nsCOMPtr child(do_QueryInterface(supp)); @@ -1332,6 +1333,20 @@ nsXBLBinding::BuildInsertionTable() } } } + + // Now remove the elements. + for (i = 0; i < count; i++) { + nsCOMPtr supp; + childrenElements->GetElementAt(i, getter_AddRefs(supp)); + nsCOMPtr child(do_QueryInterface(supp)); + if (child) { + nsCOMPtr parent; + child->GetParent(*getter_AddRefs(parent)); + PRInt32 index; + parent->IndexOf(child, index); + parent->RemoveChildAt(index, PR_FALSE); + } + } } PRBool diff --git a/layout/xul/base/src/nsBoxLayout.h b/layout/xul/base/src/nsBoxLayout.h index d58af01fcae..d72c683692b 100644 --- a/layout/xul/base/src/nsBoxLayout.h +++ b/layout/xul/base/src/nsBoxLayout.h @@ -33,6 +33,7 @@ class nsBoxLayout : public nsIBoxLayout { public: nsBoxLayout(); + virtual ~nsBoxLayout() {}; NS_DECL_ISUPPORTS diff --git a/layout/xul/base/src/nsContainerBox.cpp b/layout/xul/base/src/nsContainerBox.cpp index f134570d88f..113946a201e 100644 --- a/layout/xul/base/src/nsContainerBox.cpp +++ b/layout/xul/base/src/nsContainerBox.cpp @@ -74,6 +74,10 @@ nsContainerBox::nsContainerBox(nsIPresShell* aShell):nsBox(aShell) mChildCount = 0; } +nsContainerBox::~nsContainerBox() +{ +} + void nsContainerBox::GetBoxName(nsAutoString& aName) { diff --git a/layout/xul/base/src/nsContainerBox.h b/layout/xul/base/src/nsContainerBox.h index 927ba2060ce..22f1a9d95d3 100644 --- a/layout/xul/base/src/nsContainerBox.h +++ b/layout/xul/base/src/nsContainerBox.h @@ -39,6 +39,7 @@ public: NS_IMETHOD GetChildBox(nsIBox** aBox); nsContainerBox(nsIPresShell* aShell); + virtual ~nsContainerBox(); NS_IMETHOD SetLayoutManager(nsIBoxLayout* aLayout); NS_IMETHOD GetLayoutManager(nsIBoxLayout** aLayout); @@ -65,8 +66,6 @@ public: virtual void SanityCheck(nsFrameList& aFrameList); virtual void SetDebugOnChildList(nsBoxLayoutState& aState, nsIBox* aChild, PRBool aDebug); - virtual ~nsContainerBox() {} - static nsresult LayoutChildAt(nsBoxLayoutState& aState, nsIBox* aBox, const nsRect& aRect); diff --git a/layout/xul/base/src/nsGridLayout.cpp b/layout/xul/base/src/nsGridLayout.cpp index 50517f3b05e..34ec5c3de2a 100644 --- a/layout/xul/base/src/nsGridLayout.cpp +++ b/layout/xul/base/src/nsGridLayout.cpp @@ -87,8 +87,8 @@ nsGridLayout::GetOtherTemple(nsIBox* aBox, nsTempleLayout** aTemple, nsIBox** aT child = b; } - nsIBoxLayout* layout = nsnull; - child->GetLayoutManager(&layout); + nsCOMPtr layout; + child->GetLayoutManager(getter_AddRefs(layout)); // must find a temple that is not our requestor and is a monument. if (layout != aRequestor) { @@ -186,7 +186,6 @@ nsGridLayout::EnscriptionChanged(nsBoxLayoutState& aState, PRInt32 aIndex) NS_IMETHODIMP nsGridLayout::DesecrateMonuments(nsIBox* aBox, nsBoxLayoutState& aState) { - NS_ERROR("Should Never be Called!"); return NS_OK; } diff --git a/layout/xul/base/src/nsIMonument.h b/layout/xul/base/src/nsIMonument.h index 0eed8d7bba3..2bc1f2e9376 100644 --- a/layout/xul/base/src/nsIMonument.h +++ b/layout/xul/base/src/nsIMonument.h @@ -72,7 +72,8 @@ public: virtual PRInt32 GetRefCount()=0; virtual PRBool SetListener(nsIBox* aBox, nsBoxSizeListener& aListener)=0; virtual void RemoveListener()=0; - + virtual void SetAdjacent(nsBoxLayoutState& aState, nsBoxSizeList* aList)=0; + virtual nsBoxSizeList* GetAdjacent()=0; }; // {AF0C1603-06C3-11d4-BA07-001083023C1E} diff --git a/layout/xul/base/src/nsMonumentLayout.cpp b/layout/xul/base/src/nsMonumentLayout.cpp index d3b17e165d1..4354bd8da16 100644 --- a/layout/xul/base/src/nsMonumentLayout.cpp +++ b/layout/xul/base/src/nsMonumentLayout.cpp @@ -179,16 +179,15 @@ nsMonumentIterator::GetNextObelisk(nsObeliskLayout** aObelisk, PRBool aSearchChi //------ nsInfoListNodeImpl ---- +nsBoxSizeListNodeImpl::~nsBoxSizeListNodeImpl() +{ + +} + void nsBoxSizeListNodeImpl::Release(nsBoxLayoutState& aState) { - mRefCount--; - if (mRefCount == 0) { - Clear(aState); - if (mNext) - mNext->Release(aState); - delete this; - } + delete this; } void @@ -201,18 +200,18 @@ nsBoxSizeListNodeImpl::Desecrate(nsBoxLayoutState& aState) void nsBoxSizeListNodeImpl::MarkDirty(nsBoxLayoutState& aState) { - mBox->MarkDirty(aState); + if (mBox) + mBox->MarkDirty(aState); } void nsBoxSizeListNodeImpl::SetNext(nsBoxLayoutState& aState, nsBoxSizeList* aNext) { - if (mNext) { - mNext->Release(aState); - } - mNext = aNext; - if (mNext) - aNext->AddRef(); +} + +void nsBoxSizeListNodeImpl::SetAdjacent(nsBoxLayoutState& aState, nsBoxSizeList* aNext) +{ + mAdjacent = aNext; } void @@ -223,6 +222,7 @@ nsBoxSizeListNodeImpl::Append(nsBoxLayoutState& aState, nsBoxSizeList* aChild) nsBoxSizeListNodeImpl::nsBoxSizeListNodeImpl(nsIBox* aBox):mNext(nsnull), mParent(nsnull), + mAdjacent(nsnull), mBox(aBox), mRefCount(0), mIsSet(PR_FALSE) @@ -239,7 +239,7 @@ nsBoxSizeListNodeImpl::GetAt(PRInt32 aIndex) if (count == aIndex) return node; - node = node->GetNext(); + node = node->GetAdjacent(); count++; } @@ -272,15 +272,29 @@ nsBoxSizeListImpl::nsBoxSizeListImpl(nsIBox* aBox):nsBoxSizeListNodeImpl(aBox), { } +nsBoxSizeListImpl::~nsBoxSizeListImpl() +{ +} + void nsBoxSizeListImpl::Release(nsBoxLayoutState& aState) { - if (mRefCount == 1) { - if (mListener) - mListener->WillBeDestroyed(mListenerBox, aState, *this); - } + if (mListener) { + mListener->WillBeDestroyed(mListenerBox, aState, *this); + } - nsBoxSizeListNodeImpl::Release(aState); + nsBoxSizeList* list = mFirst; + while(list) + { + nsBoxSizeList* toRelease = list; + list = list->GetNext(); + toRelease->SetParent(nsnull); + } + + if (mAdjacent) + mAdjacent->Release(aState); + + delete this; } void @@ -308,7 +322,6 @@ nsBoxSizeListImpl::Append(nsBoxLayoutState& aState, nsBoxSizeList* aChild) mLast = aChild; aChild->SetParent(this); - aChild->AddRef(); } void @@ -401,6 +414,9 @@ nsBoxSizeListNodeImpl::GetBoxSize(nsBoxLayoutState& aState, PRBool aIsHorizontal nscoord ascent = 0; nscoord flex = 0; + if (!mBox) + return size; + mBox->GetPrefSize(aState, pref); mBox->GetMinSize(aState, min); mBox->GetMaxSize(aState, max); @@ -502,8 +518,8 @@ nsMonumentLayout::GetOtherMonumentsAt(nsIBox* aBox, PRInt32 aIndexOfObelisk, nsB childBox = do_QueryInterface(childFrame); } - nsIBoxLayout* layout = nsnull; - childBox->GetLayoutManager(&layout); + nsCOMPtr layout; + childBox->GetLayoutManager(getter_AddRefs(layout)); // only all monuments nsCOMPtr monument = do_QueryInterface(layout, &rv); @@ -556,7 +572,7 @@ nsMonumentLayout::GetMonumentsAt(nsIBox* aBox, PRInt32 aMonumentIndex, nsBoxSize *aList = list; return NS_OK; } - list = list->GetNext(); + list = list->GetAdjacent(); count++; } @@ -607,7 +623,7 @@ nsMonumentLayout::GetMonumentList(nsIBox* aBox, nsBoxLayoutState& aState, nsBoxS if (*aList == nsnull) *aList = last = newOne; else { - last->SetNext(aState, newOne); + last->SetAdjacent(aState, newOne); last = newOne; } child->GetNextBox(&child); diff --git a/layout/xul/base/src/nsMonumentLayout.h b/layout/xul/base/src/nsMonumentLayout.h index 0f08c2e0ea4..7c3bf379141 100644 --- a/layout/xul/base/src/nsMonumentLayout.h +++ b/layout/xul/base/src/nsMonumentLayout.h @@ -88,10 +88,15 @@ public: virtual PRBool IsSet() { return mIsSet; } virtual nsIBox* GetBox() { return mBox; } + virtual void SetAdjacent(nsBoxLayoutState& aState, nsBoxSizeList* aAdjacent); + virtual nsBoxSizeList* GetAdjacent() { return mAdjacent; } + nsBoxSizeListNodeImpl(nsIBox* aBox); + virtual ~nsBoxSizeListNodeImpl(); nsBoxSizeList* mNext; nsBoxSizeList* mParent; + nsBoxSizeList* mAdjacent; nsIBox* mBox; PRInt32 mRefCount; PRBool mIsSet; @@ -113,6 +118,7 @@ public: virtual void Release(nsBoxLayoutState& aState); nsBoxSizeListImpl(nsIBox* aBox); + virtual ~nsBoxSizeListImpl(); nsBoxSizeList* mFirst; nsBoxSizeList* mLast; diff --git a/layout/xul/base/src/nsTempleLayout.cpp b/layout/xul/base/src/nsTempleLayout.cpp index 7bee9d11a41..bb4bd65cebc 100644 --- a/layout/xul/base/src/nsTempleLayout.cpp +++ b/layout/xul/base/src/nsTempleLayout.cpp @@ -73,52 +73,42 @@ nsTempleLayout::GetMonumentList(nsIBox* aBox, nsBoxLayoutState& aState, nsBoxSiz return NS_OK; } - *aList = nsnull; - // run through our children. // ask each child for its monument list // append the list to our list - nsIBox* box = nsnull; - aBox->GetChildBox(&box); + nsIBox* firstChild = nsnull; + aBox->GetChildBox(&firstChild); + nsBoxSizeList* current = nsnull; nsCOMPtr monument; + nsMonumentIterator it(firstChild); - nsMonumentIterator it(box); - + nsIBox* box = nsnull; while(it.GetNextMonument(getter_AddRefs(monument))) { it.GetBox(&box); - if (!mMonuments) { - mMonuments = new nsBoxSizeListImpl(box); - mMonuments->AddRef(); - } - current = mMonuments; nsBoxSizeList* node = nsnull; monument->GetMonumentList(box, aState, &node); - if (node) - node->AddRef(); - while(node) { + if (!mMonuments) { + mMonuments = new nsBoxSizeListImpl(firstChild); + current = mMonuments; + } + current->Append(aState, node); - node->Release(aState); - - nsBoxSizeList* tmp = node->GetNext(); - if (tmp) - tmp->AddRef(); - - node->SetNext(aState, nsnull); - node = tmp; - - if (node && !current->GetNext()) { + + node = node->GetAdjacent(); + + if (node && !current->GetAdjacent()) { nsBoxSizeList* newOne = new nsBoxSizeListImpl(box); - current->SetNext(aState, newOne); + current->SetAdjacent(aState, newOne); current = newOne; } else { - current = current->GetNext(); + current = current->GetAdjacent(); } } } @@ -225,10 +215,16 @@ nsTempleLayout::ChildrenRemoved(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* NS_IMETHODIMP nsTempleLayout::DesecrateMonuments(nsIBox* aBox, nsBoxLayoutState& aState) { + nsCOMPtr parent; + nsCOMPtr parentBox; + GetParentMonument(aBox, parentBox, getter_AddRefs(parent)); + if (parent) + parent->DesecrateMonuments(parentBox, aState); + if (mMonuments) { nsBoxSizeList* tmp = mMonuments; + mMonuments->Release(aState); mMonuments = nsnull; - tmp->Release(aState); } return NS_OK; diff --git a/layout/xul/base/src/nsTreeBoxObject.cpp b/layout/xul/base/src/nsTreeBoxObject.cpp index 73522083462..1f94e9c10ef 100644 --- a/layout/xul/base/src/nsTreeBoxObject.cpp +++ b/layout/xul/base/src/nsTreeBoxObject.cpp @@ -33,7 +33,7 @@ #include "nsIPresContext.h" #include "nsIFrame.h" -//#define XULTREE +#define XULTREE // XXX Hack #include "nsTreeOuterFrame.h" diff --git a/layout/xul/base/src/nsTreeLayout.cpp b/layout/xul/base/src/nsTreeLayout.cpp index cd2dd0c0beb..38b716cea33 100644 --- a/layout/xul/base/src/nsTreeLayout.cpp +++ b/layout/xul/base/src/nsTreeLayout.cpp @@ -94,7 +94,7 @@ nsTreeLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSiz aSize.height = frame->GetRowCount() * rowheight; // Pad the height. nscoord y = frame->GetAvailableHeight(); - if (y > 0 && rowheight > 0) { + if (aSize.height > y && y > 0 && rowheight > 0) { nscoord m = (aSize.height-y)%rowheight; nscoord remainder = m == 0 ? 0 : rowheight - m; aSize.height += remainder; @@ -113,7 +113,7 @@ nsTreeLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize aSize.height = frame->GetRowCount() * rowheight; // Pad the height. nscoord y = frame->GetAvailableHeight(); - if (y > 0 && rowheight > 0) { + if (aSize.height > y && y > 0 && rowheight > 0) { nscoord m = (aSize.height-y)%rowheight; nscoord remainder = m == 0 ? 0 : rowheight - m; aSize.height += remainder; @@ -132,7 +132,7 @@ nsTreeLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nsSize aSize.height = frame->GetRowCount() * rowheight; // Pad the height. nscoord y = frame->GetAvailableHeight(); - if (y > 0 && rowheight > 0) { + if (aSize.height > y && y > 0 && rowheight > 0) { nscoord m = (aSize.height-y)%rowheight; nscoord remainder = m == 0 ? 0 : rowheight - m; aSize.height += remainder; diff --git a/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp b/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp index 69c591b971d..f840063c682 100644 --- a/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp +++ b/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp @@ -25,6 +25,7 @@ #include "nsCOMPtr.h" #include "nsXULTreeOuterGroupFrame.h" #include "nsXULAtoms.h" +#include "nsHTMLAtoms.h" #include "nsIContent.h" #include "nsINameSpaceManager.h" #include "nsIScrollableFrame.h" @@ -63,7 +64,7 @@ NS_NewXULTreeOuterGroupFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRB // Constructor nsXULTreeOuterGroupFrame::nsXULTreeOuterGroupFrame(nsIPresShell* aPresShell, PRBool aIsRoot, nsIBoxLayout* aLayoutManager, PRBool aIsHorizontal) :nsXULTreeGroupFrame(aPresShell, aIsRoot, aLayoutManager, aIsHorizontal), - mRowGroupInfo(nsnull), mRowHeight(TREE_LINE_HEIGHT), mCurrentIndex(0), mTwipIndex(0) + mRowGroupInfo(nsnull), mRowHeight(0), mCurrentIndex(0), mTwipIndex(0) {} // Destructor @@ -124,6 +125,42 @@ nsXULTreeOuterGroupFrame::Init(nsIPresContext* aPresContext, nsIContent* aConten } // Init +PRBool +nsXULTreeOuterGroupFrame::IsFixedRowSize() +{ + nsCOMPtr parent; + mContent->GetParent(*getter_AddRefs(parent)); + nsAutoString rows; + parent->GetAttribute(kNameSpaceID_None, nsXULAtoms::rows, rows); + if (!rows.IsEmpty()) + return PR_TRUE; + return PR_FALSE; +} + +void +nsXULTreeOuterGroupFrame::SetRowHeight(nscoord aRowHeight) +{ + if (mRowHeight == 0) { + mRowHeight = aRowHeight; + nsCOMPtr parent; + mContent->GetParent(*getter_AddRefs(parent)); + nsAutoString rows; + parent->GetAttribute(kNameSpaceID_None, nsXULAtoms::rows, rows); + if (!rows.IsEmpty()) { + PRInt32 dummy; + PRInt32 count = rows.ToInteger(&dummy); + float t2p; + mPresContext->GetTwipsToPixels(&t2p); + PRInt32 rowHeight = NSTwipsToIntPixels(aRowHeight, t2p); + nsAutoString value; + value.AppendInt(rowHeight*count); + parent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::height, value, PR_FALSE); + } + nsBoxLayoutState state(mPresContext); + MarkDirtyChildren(state); + } +} + nscoord nsXULTreeOuterGroupFrame::GetYPosition() { @@ -337,7 +374,7 @@ nsXULTreeOuterGroupFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta) } nsBoxLayoutState state(mPresContext); - mFirstChild = mLastChild = nsnull; + ClearChildren(state); mFrames.DestroyFrames(mPresContext); nsCOMPtr topRowContent; @@ -715,19 +752,28 @@ nsXULTreeOuterGroupFrame::EnsureRowIsVisible(PRInt32 aRowIndex) { PRInt32 rows = GetAvailableHeight()/mRowHeight; PRInt32 bottomIndex = mCurrentIndex + rows - 1; - + if (IsFixedRowSize()) + bottomIndex++; + // if row is visible, ignore if (mCurrentIndex <= aRowIndex && aRowIndex <= bottomIndex) return; - // Try to center the new index. - PRInt32 newIndex = aRowIndex - rows/2; - if (newIndex < 0) - newIndex = 0; - + PRInt32 newIndex = aRowIndex; + PRInt32 delta = mCurrentIndex > newIndex ? mCurrentIndex - newIndex : newIndex - mCurrentIndex; - PRInt32 up = newIndex < mCurrentIndex; - mCurrentIndex = newIndex; + PRBool up = newIndex < mCurrentIndex; + if (up) + mCurrentIndex = newIndex; + else { + // Scroll just enough to bring the newIndex into view. + PRInt32 adjustment = newIndex - rows; + if (!IsFixedRowSize()) + adjustment++; + delta = adjustment - mCurrentIndex; + mCurrentIndex = adjustment; + } + InternalPositionChanged(up, delta); // This change has to happen immediately. @@ -742,7 +788,7 @@ nsXULTreeOuterGroupFrame::ScrollToIndex(PRInt32 aRowIndex) { PRInt32 newIndex = aRowIndex; PRInt32 delta = mCurrentIndex > newIndex ? mCurrentIndex - newIndex : newIndex - mCurrentIndex; - PRInt32 up = newIndex < mCurrentIndex; + PRBool up = newIndex < mCurrentIndex; mCurrentIndex = newIndex; InternalPositionChanged(up, delta); diff --git a/layout/xul/base/src/nsXULTreeOuterGroupFrame.h b/layout/xul/base/src/nsXULTreeOuterGroupFrame.h index 2fc598d785a..71ed5e4793c 100644 --- a/layout/xul/base/src/nsXULTreeOuterGroupFrame.h +++ b/layout/xul/base/src/nsXULTreeOuterGroupFrame.h @@ -95,14 +95,8 @@ public: void ClearRowGroupInfo() { if (mRowGroupInfo) mRowGroupInfo->Clear(); NeedsRecalc(); }; - void SetRowHeight(PRInt32 aRowHeight) - { - if (mRowHeight != aRowHeight) { - mRowHeight = aRowHeight; - nsBoxLayoutState state(mPresContext); - MarkDirtyChildren(state); - } - }; + void SetRowHeight(PRInt32 aRowHeight); + PRBool IsFixedRowSize(); nscoord GetYPosition(); nscoord GetAvailableHeight();