From e30aa0ecb30af69531ae4de8675a093768f2d9a7 Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Tue, 28 Sep 1999 00:57:46 +0000 Subject: [PATCH] Fixing tree widget updating problem. git-svn-id: svn://10.0.0.236/trunk@49171 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/xul/base/src/nsTreeCellFrame.cpp | 20 ++++++++++++++++++- mozilla/layout/xul/base/src/nsTreeCellFrame.h | 9 +++++++-- .../xul/base/src/nsTreeRowGroupFrame.cpp | 5 +++-- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp b/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp index 3d423d379af..a6ec6b4dcb1 100644 --- a/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp @@ -80,7 +80,7 @@ NS_NewTreeCellFrame (nsIFrame** aNewFrame) // Constructor nsTreeCellFrame::nsTreeCellFrame() -:nsTableCellFrame() { mAllowEvents = PR_FALSE; mIsHeader = PR_FALSE; } +:nsTableCellFrame() { mAllowEvents = PR_FALSE; mIsHeader = PR_FALSE; mAnonymousContent = nsnull; } // Destructor nsTreeCellFrame::~nsTreeCellFrame() @@ -136,6 +136,24 @@ nsTreeCellFrame::Init(nsIPresContext& aPresContext, return rv; } +NS_IMETHODIMP nsTreeCellFrame::AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + nsIAtom* aAttribute, + PRInt32 aHint) +{ + nsresult rv = nsTableCellFrame::AttributeChanged(aPresContext, aChild, aAttribute, aHint); + if (mAnonymousContent && (aAttribute == nsHTMLAtoms::align || aAttribute == nsXULAtoms::crop + || aAttribute == nsHTMLAtoms::value)) + { + nsAutoString value; + // XXX should check if attribute has been removed + mContent->GetAttribute(kNameSpaceID_None, aAttribute, value); + mAnonymousContent->SetAttribute(kNameSpaceID_None, aAttribute, value, PR_TRUE); + } + return rv; +} + + nsTableFrame* nsTreeCellFrame::GetTreeFrame() { return mTreeFrame; diff --git a/mozilla/layout/xul/base/src/nsTreeCellFrame.h b/mozilla/layout/xul/base/src/nsTreeCellFrame.h index e4ea96de057..91f1fcec42d 100644 --- a/mozilla/layout/xul/base/src/nsTreeCellFrame.h +++ b/mozilla/layout/xul/base/src/nsTreeCellFrame.h @@ -27,6 +27,10 @@ class nsTreeCellFrame : public nsTableCellFrame public: friend nsresult NS_NewTreeCellFrame(nsIFrame** aNewFrame); + NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, + nsIContent* aChild, + nsIAtom* aAttribute, + PRInt32 aHint); NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint, // Overridden to capture events nsIFrame** aFrame); @@ -56,11 +60,11 @@ public: nsTableFrame* GetTreeFrame(); void SetAllowEvents(PRBool allowEvents) { mAllowEvents = allowEvents; }; - + void SetAnonymousContent(nsIContent* aAnonymousContent) { mAnonymousContent = aAnonymousContent; }; void ToggleOpenClose(); void Open(); void Close(); - + protected: nsTreeCellFrame(); virtual ~nsTreeCellFrame(); @@ -90,4 +94,5 @@ protected: PRBool mIsHeader; // Whether or not we're a column header nsTreeFrame* mTreeFrame; // Our parent tree frame. PRBool mAllowEvents; // Whether we let events go through. + nsIContent* mAnonymousContent; // Our anonymous titledbutton [WEAK ref] }; // class nsTableCellFrame diff --git a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp index 69f6730cd1e..d5bd1c7f076 100644 --- a/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTreeRowGroupFrame.cpp @@ -289,7 +289,8 @@ nsTreeRowGroupFrame::FindRowContentAtIndex(PRInt32& aIndex, nsIContent* aParent, void nsTreeRowGroupFrame::FindPreviousRowContent(PRInt32& aDelta, nsIContent* aUpwardHint, - nsIContent* aDownwardHint, nsIContent** aResult) + nsIContent* aDownwardHint, + nsIContent** aResult) { // Init to nsnull. *aResult = nsnull; @@ -372,7 +373,7 @@ nsTreeRowGroupFrame::FindPreviousRowContent(PRInt32& aDelta, nsIContent* aUpward // Hopeless. It ain't in there. return; } - else // We didn't find it here. We need to go up to our parent, using ourselves as a hint. + else if (!aDownwardHint) // We didn't find it here. We need to go up to our parent, using ourselves as a hint. FindPreviousRowContent(aDelta, parentContent, nsnull, aResult); // Bail. There's nothing else we can do.