bug 809871 - patch 1/3 - nsTreeColumns should store nsTreeBodyFrame* r=mats

This commit is contained in:
Trevor Saunders 2012-11-18 07:37:19 -05:00
Родитель 8ba333026a
Коммит db56ef4064
4 изменённых файлов: 11 добавлений и 19 удалений

Просмотреть файл

@ -126,7 +126,7 @@ nsTreeBodyFrame::nsTreeBodyFrame(nsIPresShell* aPresShell, nsStyleContext* aCont
mHorizontalOverflow(false),
mReflowCallbackPosted(false)
{
mColumns = new nsTreeColumns(nullptr);
mColumns = new nsTreeColumns(this);
}
// Destructor
@ -326,7 +326,6 @@ nsTreeBodyFrame::EnsureBoxObject()
->GetCachedTreeBody();
ENSURE_TRUE(!innerTreeBoxObject || innerTreeBoxObject == this);
mTreeBoxObject = realTreeBoxObject;
mColumns->SetTree(mTreeBoxObject);
}
}
}

Просмотреть файл

@ -153,6 +153,9 @@ public:
nsITreeBoxObject* GetTreeBoxObject() const { return mTreeBoxObject; }
// Get the base element, <tree> or <select>
nsIContent* GetBaseElement();
bool GetVerticalOverflow() const { return mVerticalOverflow; }
bool GetHorizontalOverflow() const {return mHorizontalOverflow; }
@ -358,9 +361,6 @@ protected:
void EnsureView();
// Get the base element, <tree> or <select>
nsIContent* GetBaseElement();
nsresult GetCellWidth(int32_t aRow, nsTreeColumn* aCol,
nsRenderingContext* aRenderingContext,
nscoord& aDesiredSize, nscoord& aCurrentSize);

Просмотреть файл

@ -339,7 +339,7 @@ nsTreeColumn::Invalidate()
}
nsTreeColumns::nsTreeColumns(nsITreeBoxObject* aTree)
nsTreeColumns::nsTreeColumns(nsTreeBodyFrame* aTree)
: mTree(aTree),
mFirstColumn(nullptr)
{
@ -365,7 +365,7 @@ NS_IMPL_RELEASE(nsTreeColumns)
NS_IMETHODIMP
nsTreeColumns::GetTree(nsITreeBoxObject** _retval)
{
NS_IF_ADDREF(*_retval = mTree);
NS_IF_ADDREF(*_retval = mTree ? mTree->GetTreeBoxObject() : nullptr);
return NS_OK;
}
@ -552,10 +552,7 @@ nsTreeColumns::RestoreNaturalOrder()
if (!mTree)
return NS_OK;
nsCOMPtr<nsIBoxObject> boxObject = do_QueryInterface(mTree);
nsCOMPtr<nsIDOMElement> element;
boxObject->GetElement(getter_AddRefs(element));
nsCOMPtr<nsIContent> content = do_QueryInterface(element);
nsIContent* content = mTree->GetBaseElement();
// Strong ref, since we'll be setting attributes
nsCOMPtr<nsIContent> colsContent =
@ -594,11 +591,7 @@ void
nsTreeColumns::EnsureColumns()
{
if (mTree && !mFirstColumn) {
nsCOMPtr<nsIBoxObject> boxObject = do_QueryInterface(mTree);
nsCOMPtr<nsIDOMElement> treeElement;
boxObject->GetElement(getter_AddRefs(treeElement));
nsCOMPtr<nsIContent> treeContent = do_QueryInterface(treeElement);
nsIContent* treeContent = mTree->GetBaseElement();
nsIContent* colsContent =
nsTreeUtils::GetDescendantChild(treeContent, nsGkAtoms::treecols);
if (!colsContent)

Просмотреть файл

@ -117,7 +117,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsTreeColumn, NS_TREECOLUMN_IMPL_CID)
class nsTreeColumns MOZ_FINAL : public nsITreeColumns {
public:
nsTreeColumns(nsITreeBoxObject* aTree);
nsTreeColumns(nsTreeBodyFrame* aTree);
~nsTreeColumns();
NS_DECL_ISUPPORTS
@ -145,7 +145,7 @@ public:
friend class nsTreeBodyFrame;
protected:
void SetTree(nsITreeBoxObject* aTree) { mTree = aTree; }
void SetTree(nsTreeBodyFrame* aTree) { mTree = aTree; }
// Builds our cache of column info.
void EnsureColumns();
@ -154,7 +154,7 @@ protected:
nsTreeColumn* GetPrimaryColumn();
private:
nsITreeBoxObject* mTree;
nsTreeBodyFrame* mTree;
/**
* The first column in the list of columns. All of the columns are supposed