diff --git a/mozilla/layout/xul/base/src/nsBoxObject.h b/mozilla/layout/xul/base/src/nsBoxObject.h index 0661ad80514..204ea0c847c 100644 --- a/mozilla/layout/xul/base/src/nsBoxObject.h +++ b/mozilla/layout/xul/base/src/nsBoxObject.h @@ -35,6 +35,9 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ +#ifndef nsBoxObject_h___ +#define nsBoxObject_h___ + #include "nsCOMPtr.h" #include "nsIBoxObject.h" #include "nsPIBoxObject.h" @@ -86,3 +89,5 @@ protected: nsIContent* mContent; // [WEAK] nsWeakPtr mPresShell; }; + +#endif diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp index 9f783d23547..26ee609f766 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeBoxObject.cpp @@ -36,6 +36,7 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ +#include "nsTreeBoxObject.h" #include "nsCOMPtr.h" #include "nsPresContext.h" #include "nsIPresShell.h" @@ -51,32 +52,6 @@ #include "nsContentUtils.h" #include "nsDOMError.h" -class nsTreeBoxObject : public nsPITreeBoxObject, public nsBoxObject -{ -public: - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSITREEBOXOBJECT - - nsTreeBoxObject(); - ~nsTreeBoxObject(); - - // Override SetPropertyAsSupports for security check - NS_IMETHOD SetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports* aValue); - - nsITreeBoxObject* GetTreeBody(); - - //NS_PIBOXOBJECT interfaces - NS_IMETHOD Init(nsIContent* aContent, nsIPresShell* aPresShell); - NS_IMETHOD SetDocument(nsIDocument* aDocument); - NS_IMETHOD InvalidatePresentationStuff(); - - // nsPITreeBoxObject - virtual void ClearCachedTreeBody(); - -protected: - nsITreeBoxObject* mTreeBody; -}; - /* Implementation file */ NS_IMPL_ISUPPORTS_INHERITED2(nsTreeBoxObject, nsBoxObject, nsITreeBoxObject, nsPITreeBoxObject) diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeBoxObject.h b/mozilla/layout/xul/base/src/tree/src/nsTreeBoxObject.h index 15fbc30b537..d76be4fb3aa 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeBoxObject.h +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeBoxObject.h @@ -22,7 +22,7 @@ * Contributor(s): * Dave Hyatt (Original Author) * Brian Ryner - * Nate Nielsen + * Daniel Holbert * * Alternatively, the contents of this file may be used under the terms of * either of the GNU General Public License Version 2 or later (the "GPL"), @@ -37,15 +37,13 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ - #ifndef nsTreeBoxObject_h___ #define nsTreeBoxObject_h___ #include "nsBoxObject.h" -#include "nsITreeView.h" -#include "nsITreeBoxObject.h" +#include "nsPITreeBoxObject.h" -class nsTreeBoxObject : public nsITreeBoxObject, public nsBoxObject +class nsTreeBoxObject : public nsPITreeBoxObject, public nsBoxObject { public: NS_DECL_ISUPPORTS_INHERITED @@ -54,16 +52,22 @@ public: nsTreeBoxObject(); ~nsTreeBoxObject(); + // Override SetPropertyAsSupports for security check + NS_IMETHOD SetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports* aValue); + nsITreeBoxObject* GetTreeBody(); nsITreeBoxObject* GetCachedTreeBody() { return mTreeBody; } //NS_PIBOXOBJECT interfaces - virtual void Clear(); - virtual void ClearCachedValues(); + NS_IMETHOD Init(nsIContent* aContent, nsIPresShell* aPresShell); + NS_IMETHOD SetDocument(nsIDocument* aDocument); + NS_IMETHOD InvalidatePresentationStuff(); + + // nsPITreeBoxObject + virtual void ClearCachedTreeBody(); protected: nsITreeBoxObject* mTreeBody; - nsCOMPtr mView; }; #endif diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp index 8375d980f55..009dcdb804f 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.cpp @@ -45,6 +45,7 @@ #include "nsINameSpaceManager.h" #include "nsIDOMNSDocument.h" #include "nsIDocument.h" +#include "nsTreeBoxObject.h" #include "nsIBoxObject.h" #include "nsITreeColumns.h" #include "nsIDOMElement.h" @@ -115,10 +116,10 @@ nsTreeColFrame::Init(nsPresContext* aPresContext, return rv; } -NS_IMETHODIMP -nsTreeColFrame::Destroy(nsPresContext* aPresContext) +NS_IMETHODIMP +nsTreeColFrame::Destroy(nsPresContext* aPresContext) { - InvalidateColumns(); + InvalidateColumns(PR_FALSE); return nsBoxFrame::Destroy(aPresContext); } @@ -231,12 +232,21 @@ nsTreeColFrame::GetTreeBoxObject() } void -nsTreeColFrame::InvalidateColumns() +nsTreeColFrame::InvalidateColumns(PRBool aCanWalkFrameTree) { nsITreeBoxObject* treeBoxObject = GetTreeBoxObject(); if (treeBoxObject) { nsCOMPtr columns; - treeBoxObject->GetColumns(getter_AddRefs(columns)); + + if (aCanWalkFrameTree) { + treeBoxObject->GetColumns(getter_AddRefs(columns)); + } else { + nsITreeBoxObject* body = + static_cast(treeBoxObject)->GetCachedTreeBody(); + if (body) { + body->GetColumns(getter_AddRefs(columns)); + } + } if (columns) columns->InvalidateColumns(); diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.h b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.h index 9a120420174..e10261ed675 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.h +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeColFrame.h @@ -89,5 +89,5 @@ protected: * Helper method that gets the nsITreeColumns object this column belongs to * and calls InvalidateColumns() on it. */ - void InvalidateColumns(); + void InvalidateColumns(PRBool aCanWalkFrameTree = PR_TRUE); };