From 4ffca0e0e454f9bcc144d6d031eaa3131233aaba Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Thu, 7 Sep 2000 10:26:51 +0000 Subject: [PATCH] Fix for 43326. r=ben git-svn-id: svn://10.0.0.236/trunk@78383 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/xul/base/src/nsXULTreeFrame.cpp | 17 ++++++++++++ mozilla/layout/xul/base/src/nsXULTreeFrame.h | 2 ++ .../xul/base/src/nsXULTreeOuterGroupFrame.cpp | 26 ++++++++++++++++--- .../xul/base/src/nsXULTreeOuterGroupFrame.h | 5 ++++ 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/mozilla/layout/xul/base/src/nsXULTreeFrame.cpp b/mozilla/layout/xul/base/src/nsXULTreeFrame.cpp index 2db3a1b393d..ba84f7170c1 100644 --- a/mozilla/layout/xul/base/src/nsXULTreeFrame.cpp +++ b/mozilla/layout/xul/base/src/nsXULTreeFrame.cpp @@ -104,6 +104,23 @@ GetImmediateChild(nsIContent* aParent, nsIAtom* aTag, nsIContent** aResult) return; } +NS_IMETHODIMP +nsXULTreeFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState) +{ + nsXULTreeOuterGroupFrame* treeOuterGroup = nsnull; + GetTreeBody(&treeOuterGroup); + + if (treeOuterGroup) + treeOuterGroup->SetLayingOut(PR_TRUE); + + nsresult rv = nsBoxFrame::DoLayout(aBoxLayoutState); + + if (treeOuterGroup) + treeOuterGroup->SetLayingOut(PR_FALSE); + + return rv; +} + NS_IMETHODIMP nsXULTreeFrame::EnsureRowIsVisible(PRInt32 aRowIndex) { diff --git a/mozilla/layout/xul/base/src/nsXULTreeFrame.h b/mozilla/layout/xul/base/src/nsXULTreeFrame.h index 866d9ab32f9..b68505c6108 100644 --- a/mozilla/layout/xul/base/src/nsXULTreeFrame.h +++ b/mozilla/layout/xul/base/src/nsXULTreeFrame.h @@ -39,6 +39,8 @@ public: NS_DECL_ISUPPORTS + NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState); + // nsITreeFrame NS_IMETHOD EnsureRowIsVisible(PRInt32 aRowIndex); NS_IMETHOD GetNextItem(nsIDOMElement* aStartItem, PRInt32 aDelta, nsIDOMElement** aResult); diff --git a/mozilla/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp b/mozilla/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp index 63bb376c0eb..abd568b6f15 100644 --- a/mozilla/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp +++ b/mozilla/layout/xul/base/src/nsXULTreeOuterGroupFrame.cpp @@ -200,6 +200,8 @@ nsXULTreeOuterGroupFrame::Init(nsIPresContext* aPresContext, nsIContent* aConten { nsresult rv = nsXULTreeGroupFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow); + mLayingOut = PR_FALSE; + float p2t; aPresContext->GetScaledPixelsToTwips(&p2t); mOnePixel = NSIntPixelsToTwips(1, p2t); @@ -252,6 +254,13 @@ nsXULTreeOuterGroupFrame::Init(nsIPresContext* aPresContext, nsIContent* aConten } // Init +NS_IMETHODIMP +nsXULTreeOuterGroupFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState) +{ + nsresult rv = nsXULTreeGroupFrame::DoLayout(aBoxLayoutState); + return rv; +} + PRBool nsXULTreeOuterGroupFrame::IsFixedRowSize() { @@ -530,8 +539,13 @@ nsXULTreeOuterGroupFrame::InternalPositionChanged(PRBool aUp, PRInt32 aDelta) VerticalScroll(mCurrentIndex*mRowHeight); - nsBoxLayoutState state(mPresContext); - MarkDirtyChildren(state); + if (mLayingOut) { + PostReflowCallback(); + } + else { + nsBoxLayoutState state(mPresContext); + MarkDirtyChildren(state); + } return NS_OK; } @@ -926,7 +940,13 @@ nsXULTreeOuterGroupFrame::EnsureRowIsVisible(PRInt32 aRowIndex) InternalPositionChanged(up, delta); // This change has to happen immediately. - PostReflowCallback(); + if (mLayingOut) { + PostReflowCallback(); + } + else { + nsBoxLayoutState state(mPresContext); + MarkDirtyChildren(state); + } } void diff --git a/mozilla/layout/xul/base/src/nsXULTreeOuterGroupFrame.h b/mozilla/layout/xul/base/src/nsXULTreeOuterGroupFrame.h index d2e01a7bdbc..669daeea692 100644 --- a/mozilla/layout/xul/base/src/nsXULTreeOuterGroupFrame.h +++ b/mozilla/layout/xul/base/src/nsXULTreeOuterGroupFrame.h @@ -106,6 +106,8 @@ public: NS_IMETHOD Init(nsIPresContext* aPresContext, nsIContent* aContent, nsIFrame* aParent, nsIStyleContext* aContext, nsIFrame* aPrevInFlow); + NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState); + // nsIReflowCallback NS_IMETHOD ReflowFinished(nsIPresShell* aPresShell, PRBool* aFlushFlag); @@ -139,6 +141,8 @@ public: void SetRowHeight(PRInt32 aRowHeight); PRBool IsFixedRowSize(); + void SetLayingOut(PRBool aLayingOut) { mLayingOut = aLayingOut; }; + nscoord GetYPosition(); nscoord GetAvailableHeight(); NS_IMETHOD GetNumberOfVisibleRows(PRInt32 *aResult) { @@ -223,6 +227,7 @@ protected: nsTreeLayoutState mTreeLayoutState; PRBool mReflowCallbackPosted; + PRBool mLayingOut; }; // class nsXULTreeOuterGroupFrame