diff --git a/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp b/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp index 3554d1e5be6..703d66e2c29 100644 --- a/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTreeCellFrame.cpp @@ -318,7 +318,8 @@ void nsTreeCellFrame::Hover(nsIPresContext& aPresContext, PRBool isHover, PRBool NS_IF_RELEASE(pParentContent); } -// XXX This method will go away. +// XXX This method will go away. I think it can +// actually go away now... ? NS_IMETHODIMP nsTreeCellFrame::AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, @@ -333,3 +334,10 @@ nsTreeCellFrame::AttributeChanged(nsIPresContext* aPresContext, return NS_OK; } + +NS_IMETHODIMP +nsTreeCellFrame::DeleteFrame(nsIPresContext& aPresContext) +{ + mTreeFrame->RemoveFromSelection(this); + return nsTableCellFrame::DeleteFrame(aPresContext); +} diff --git a/mozilla/layout/xul/base/src/nsTreeCellFrame.h b/mozilla/layout/xul/base/src/nsTreeCellFrame.h index 6e8852cff7d..2eec3e2f7f8 100644 --- a/mozilla/layout/xul/base/src/nsTreeCellFrame.h +++ b/mozilla/layout/xul/base/src/nsTreeCellFrame.h @@ -44,6 +44,8 @@ public: const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus); + NS_IMETHOD DeleteFrame(nsIPresContext& aPresContext); + NS_IMETHOD AttributeChanged(nsIPresContext* aPresContext, nsIContent* aChild, diff --git a/mozilla/layout/xul/base/src/nsTreeFrame.cpp b/mozilla/layout/xul/base/src/nsTreeFrame.cpp index b02fe9acc79..c19caf3200c 100644 --- a/mozilla/layout/xul/base/src/nsTreeFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTreeFrame.cpp @@ -160,6 +160,21 @@ void nsTreeFrame::ClearSelection(nsIPresContext& aPresContext) mSelectedItems.Clear(); } +void +nsTreeFrame::RemoveFromSelection(nsTreeCellFrame* frame) +{ + PRInt32 count = mSelectedItems.Count(); + for (PRInt32 i = 0; i < count; i++) + { + // Remove the tree cell from the selection. + nsTreeCellFrame* theFrame = (nsTreeCellFrame*)mSelectedItems[i]; + if (theFrame == frame) { + mSelectedItems.RemoveElementAt(i); + break; + } + } +} + void nsTreeFrame::MoveUp(nsIPresContext& aPresContext, nsTreeCellFrame* pFrame) { PRInt32 rowIndex; diff --git a/mozilla/layout/xul/base/src/nsTreeFrame.h b/mozilla/layout/xul/base/src/nsTreeFrame.h index ba6d45f3b96..3eb9b362bcc 100644 --- a/mozilla/layout/xul/base/src/nsTreeFrame.h +++ b/mozilla/layout/xul/base/src/nsTreeFrame.h @@ -31,6 +31,7 @@ public: void ClearSelection(nsIPresContext& presContext); void ToggleSelection(nsIPresContext& presContext, nsTreeCellFrame* pFrame); void RangedSelection(nsIPresContext& aPresContext, nsTreeCellFrame* pEndFrame); + void RemoveFromSelection(nsTreeCellFrame* frame); void MoveUp(nsIPresContext& aPresContext, nsTreeCellFrame* pFrame); void MoveDown(nsIPresContext& aPresContext, nsTreeCellFrame* pFrame); @@ -47,4 +48,4 @@ protected: protected: // Data Members nsVoidArray mSelectedItems; // The selected cell frames. -}; // class nsTableFrame +}; // class nsTreeFrame