Bug 391178 - Avoid walking frame tree when destroying nsTreeColFrame. r+sr=roc, a=dveditz
git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@252001 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* Contributor(s):
|
||||
* Dave Hyatt <hyatt@mozilla.org> (Original Author)
|
||||
* Brian Ryner <bryner@brianryner.com>
|
||||
* Nate Nielsen <nielsen@memberwebs.com>
|
||||
* Daniel Holbert <dholbert@mozilla.com>
|
||||
*
|
||||
* 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<nsITreeView> mView;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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<nsITreeColumns> columns;
|
||||
treeBoxObject->GetColumns(getter_AddRefs(columns));
|
||||
|
||||
if (aCanWalkFrameTree) {
|
||||
treeBoxObject->GetColumns(getter_AddRefs(columns));
|
||||
} else {
|
||||
nsITreeBoxObject* body =
|
||||
static_cast<nsTreeBoxObject*>(treeBoxObject)->GetCachedTreeBody();
|
||||
if (body) {
|
||||
body->GetColumns(getter_AddRefs(columns));
|
||||
}
|
||||
}
|
||||
|
||||
if (columns)
|
||||
columns->InvalidateColumns();
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user