From 982414f78611800c166a51b0496508cd106e384e Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Sun, 1 Aug 1999 18:26:45 +0000 Subject: [PATCH] Added QueryInterfaces so nsITableCellLayout and nsITableLayout can get to cell and table frames. Don't use macros because frames aren't refcounted. --- layout/html/table/src/nsTableCellFrame.cpp | 15 ++++++++++++++- layout/html/table/src/nsTableFrame.cpp | 17 ++++++++++++++++- layout/html/table/src/nsTableOuterFrame.cpp | 17 ++++++++++++++++- layout/tables/nsTableCellFrame.cpp | 15 ++++++++++++++- layout/tables/nsTableFrame.cpp | 17 ++++++++++++++++- layout/tables/nsTableOuterFrame.cpp | 17 ++++++++++++++++- 6 files changed, 92 insertions(+), 6 deletions(-) diff --git a/layout/html/table/src/nsTableCellFrame.cpp b/layout/html/table/src/nsTableCellFrame.cpp index f8b80ee1b54e..494d89299f51 100644 --- a/layout/html/table/src/nsTableCellFrame.cpp +++ b/layout/html/table/src/nsTableCellFrame.cpp @@ -1010,8 +1010,21 @@ NS_METHOD nsTableCellFrame::DidSetStyleContext(nsIPresContext* aPresContext) /* ----- global methods ----- */ +NS_IMPL_ADDREF_INHERITED(nsTableCellFrame, nsHTMLContainerFrame) +NS_IMPL_RELEASE_INHERITED(nsTableCellFrame, nsHTMLContainerFrame) -NS_IMPL_ISUPPORTS_INHERITED(nsTableCellFrame, nsHTMLContainerFrame, nsITableCellLayout) +nsresult nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + if (aIID.Equals(nsITableCellLayout::GetIID())) { + *aInstancePtr = (void*)this; + return NS_OK; + } else { + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); + } +} nsresult NS_NewTableCellFrame(nsIFrame** aNewFrame) diff --git a/layout/html/table/src/nsTableFrame.cpp b/layout/html/table/src/nsTableFrame.cpp index 24d4b31b2952..93c1393a5cf0 100644 --- a/layout/html/table/src/nsTableFrame.cpp +++ b/layout/html/table/src/nsTableFrame.cpp @@ -292,7 +292,22 @@ nsTableFrame::nsTableFrame() mBorderEdges.mOutsideEdge=PR_TRUE; } -NS_IMPL_ISUPPORTS_INHERITED(nsTableFrame, nsHTMLContainerFrame, nsITableLayout) +NS_IMPL_ADDREF_INHERITED(nsTableFrame, nsHTMLContainerFrame) +NS_IMPL_RELEASE_INHERITED(nsTableFrame, nsHTMLContainerFrame) + +nsresult nsTableFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + if (aIID.Equals(nsITableLayout::GetIID())) + { // note there is no addref here, frames are not addref'd + *aInstancePtr = (void*)(nsITableLayout*)this; + return NS_OK; + } else { + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); + } +} NS_IMETHODIMP nsTableFrame::Init(nsIPresContext& aPresContext, diff --git a/layout/html/table/src/nsTableOuterFrame.cpp b/layout/html/table/src/nsTableOuterFrame.cpp index 1a19172161ca..99cd8dd6d9a3 100644 --- a/layout/html/table/src/nsTableOuterFrame.cpp +++ b/layout/html/table/src/nsTableOuterFrame.cpp @@ -174,7 +174,22 @@ struct OuterTableReflowState { /* ----------- nsTableOuterFrame ---------- */ -NS_IMPL_ISUPPORTS_INHERITED(nsTableOuterFrame, nsHTMLContainerFrame, nsITableLayout) +NS_IMPL_ADDREF_INHERITED(nsTableOuterFrame, nsHTMLContainerFrame) +NS_IMPL_RELEASE_INHERITED(nsTableOuterFrame, nsHTMLContainerFrame) + +nsresult nsTableOuterFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + if (aIID.Equals(nsITableLayout::GetIID())) + { // note there is no addref here, frames are not addref'd + *aInstancePtr = (void*)(nsITableLayout*)this; + return NS_OK; + } else { + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); + } +} NS_IMETHODIMP nsTableOuterFrame::SetInitialChildList(nsIPresContext& aPresContext, nsIAtom* aListName, diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index f8b80ee1b54e..494d89299f51 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -1010,8 +1010,21 @@ NS_METHOD nsTableCellFrame::DidSetStyleContext(nsIPresContext* aPresContext) /* ----- global methods ----- */ +NS_IMPL_ADDREF_INHERITED(nsTableCellFrame, nsHTMLContainerFrame) +NS_IMPL_RELEASE_INHERITED(nsTableCellFrame, nsHTMLContainerFrame) -NS_IMPL_ISUPPORTS_INHERITED(nsTableCellFrame, nsHTMLContainerFrame, nsITableCellLayout) +nsresult nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + if (aIID.Equals(nsITableCellLayout::GetIID())) { + *aInstancePtr = (void*)this; + return NS_OK; + } else { + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); + } +} nsresult NS_NewTableCellFrame(nsIFrame** aNewFrame) diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 24d4b31b2952..93c1393a5cf0 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -292,7 +292,22 @@ nsTableFrame::nsTableFrame() mBorderEdges.mOutsideEdge=PR_TRUE; } -NS_IMPL_ISUPPORTS_INHERITED(nsTableFrame, nsHTMLContainerFrame, nsITableLayout) +NS_IMPL_ADDREF_INHERITED(nsTableFrame, nsHTMLContainerFrame) +NS_IMPL_RELEASE_INHERITED(nsTableFrame, nsHTMLContainerFrame) + +nsresult nsTableFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + if (aIID.Equals(nsITableLayout::GetIID())) + { // note there is no addref here, frames are not addref'd + *aInstancePtr = (void*)(nsITableLayout*)this; + return NS_OK; + } else { + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); + } +} NS_IMETHODIMP nsTableFrame::Init(nsIPresContext& aPresContext, diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp index 1a19172161ca..99cd8dd6d9a3 100644 --- a/layout/tables/nsTableOuterFrame.cpp +++ b/layout/tables/nsTableOuterFrame.cpp @@ -174,7 +174,22 @@ struct OuterTableReflowState { /* ----------- nsTableOuterFrame ---------- */ -NS_IMPL_ISUPPORTS_INHERITED(nsTableOuterFrame, nsHTMLContainerFrame, nsITableLayout) +NS_IMPL_ADDREF_INHERITED(nsTableOuterFrame, nsHTMLContainerFrame) +NS_IMPL_RELEASE_INHERITED(nsTableOuterFrame, nsHTMLContainerFrame) + +nsresult nsTableOuterFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr) +{ + if (NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + if (aIID.Equals(nsITableLayout::GetIID())) + { // note there is no addref here, frames are not addref'd + *aInstancePtr = (void*)(nsITableLayout*)this; + return NS_OK; + } else { + return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr); + } +} NS_IMETHODIMP nsTableOuterFrame::SetInitialChildList(nsIPresContext& aPresContext, nsIAtom* aListName,