diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index e30b8bbe2f91..66ad9ccb3677 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -4270,32 +4270,6 @@ nsHTMLEditor::SelectAll() #pragma mark - #endif - -NS_IMETHODIMP nsHTMLEditor::GetLayoutObject(nsIDOMNode *aNode, nsISupports **aLayoutObject) -{ - nsresult result = NS_ERROR_FAILURE; // we return an error unless we get the index - if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED; - nsCOMPtr ps = do_QueryReferent(mPresShellWeak); - if (!ps) return NS_ERROR_NOT_INITIALIZED; - - if ((nsnull!=aNode)) - { // get the content interface - nsCOMPtr nodeAsContent( do_QueryInterface(aNode) ); - if (nodeAsContent) - { // get the frame from the content interface - //Note: frames are not ref counted, so don't use an nsCOMPtr - *aLayoutObject = nsnull; - result = ps->GetLayoutObjectFor(nodeAsContent, aLayoutObject); - } - } - else { - result = NS_ERROR_NULL_POINTER; - } - - return result; -} - - // this will NOT find aAttribute unless aAttribute has a non-null value // so singleton attributes like will not be matched! void nsHTMLEditor::IsTextPropertySetByContent(nsIDOMNode *aNode, diff --git a/editor/libeditor/html/nsHTMLEditor.h b/editor/libeditor/html/nsHTMLEditor.h index acb1e13ca8a2..cea936928b23 100644 --- a/editor/libeditor/html/nsHTMLEditor.h +++ b/editor/libeditor/html/nsHTMLEditor.h @@ -458,14 +458,6 @@ protected: mCSSAware = ((aFlags & (eEditorNoCSSMask | eEditorMailMask)) == 0); } - /** returns the layout object (nsIFrame in the real world) for aNode - * @param aNode the content to get a frame for - * @param aLayoutObject the "primary frame" for aNode, if one exists. May be null - * @return NS_OK whether a frame is found or not - * an error if some serious error occurs - */ - NS_IMETHOD GetLayoutObject(nsIDOMNode *aInNode, nsISupports **aOutLayoutObject); - // Return TRUE if aElement is a table-related elemet and caret was set PRBool SetCaretInTableCell(nsIDOMElement* aElement); PRBool IsElementInBody(nsIDOMElement* aElement); diff --git a/editor/libeditor/html/nsTableEditor.cpp b/editor/libeditor/html/nsTableEditor.cpp index ed94642f4e75..5cb19c7a07c2 100644 --- a/editor/libeditor/html/nsTableEditor.cpp +++ b/editor/libeditor/html/nsTableEditor.cpp @@ -45,6 +45,8 @@ #include "nsIDOMNode.h" #include "nsIDOMNodeList.h" #include "nsIDOMRange.h" +#include "nsIFrame.h" +#include "nsIPresShell.h" #include "nsISelection.h" #include "nsISelectionPrivate.h" #include "nsLayoutCID.h" @@ -2718,9 +2720,14 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell, return NS_ERROR_FAILURE; } - nsISupports *layoutObject=nsnull; // frames are not ref counted, so don't use an nsCOMPtr - res = nsHTMLEditor::GetLayoutObject(aCell, &layoutObject); - if (NS_FAILED(res)) return res; + if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED; + nsCOMPtr ps = do_QueryReferent(mPresShellWeak); + if (!ps) return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr nodeAsContent( do_QueryInterface(aCell) ); + if (!nodeAsContent) return NS_ERROR_FAILURE; + // frames are not ref counted, so don't use an nsCOMPtr + nsIFrame *layoutObject = ps->GetPrimaryFrameFor(nodeAsContent); if (!layoutObject) return NS_ERROR_FAILURE; nsITableCellLayout *cellLayoutObject=nsnull; // again, frames are not ref-counted @@ -2734,14 +2741,17 @@ NS_IMETHODIMP nsHTMLEditor::GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **tableLayoutObject) { *tableLayoutObject=nsnull; - if (!aTable) - return NS_ERROR_NOT_INITIALIZED; - + if (!aTable) return NS_ERROR_NOT_INITIALIZED; + if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED; + nsCOMPtr ps = do_QueryReferent(mPresShellWeak); + if (!ps) return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr nodeAsContent( do_QueryInterface(aTable) ); + if (!nodeAsContent) return NS_ERROR_FAILURE; // frames are not ref counted, so don't use an nsCOMPtr - nsISupports *layoutObject=nsnull; - nsresult res = GetLayoutObject(aTable, &layoutObject); - if (NS_FAILED(res)) return res; + nsIFrame *layoutObject = ps->GetPrimaryFrameFor(nodeAsContent); if (!layoutObject) return NS_ERROR_FAILURE; + return layoutObject->QueryInterface(NS_GET_IID(nsITableLayout), (void**)(tableLayoutObject)); } diff --git a/editor/libeditor/text/nsPlaintextEditor.cpp b/editor/libeditor/text/nsPlaintextEditor.cpp index 3bac68e44927..e42e84383844 100644 --- a/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/editor/libeditor/text/nsPlaintextEditor.cpp @@ -1810,31 +1810,6 @@ nsPlaintextEditor::SelectEntireDocument(nsISelection *aSelection) #pragma mark - #endif - -NS_IMETHODIMP nsPlaintextEditor::GetLayoutObject(nsIDOMNode *aNode, nsISupports **aLayoutObject) -{ - nsCOMPtr ps = do_QueryReferent(mPresShellWeak); - if (!ps) return NS_ERROR_NOT_INITIALIZED; - - nsresult result = NS_ERROR_NULL_POINTER; - if (aNode) - { // get the content interface - nsCOMPtr nodeAsContent( do_QueryInterface(aNode) ); - if (nodeAsContent) - { // get the frame from the content interface - //Note: frames are not ref counted, so don't use an nsCOMPtr - *aLayoutObject = nsnull; - result = ps->GetLayoutObjectFor(nodeAsContent, aLayoutObject); - } - } - - return result; -} - -#ifdef XP_MAC -#pragma mark - -#endif - nsresult nsPlaintextEditor::SetAttributeOrEquivalent(nsIDOMElement * aElement, const nsAString & aAttribute, diff --git a/editor/libeditor/text/nsPlaintextEditor.h b/editor/libeditor/text/nsPlaintextEditor.h index 888b3fd70177..7cb52b2d8673 100644 --- a/editor/libeditor/text/nsPlaintextEditor.h +++ b/editor/libeditor/text/nsPlaintextEditor.h @@ -173,13 +173,6 @@ protected: // Create the event listeners for the editor to install. virtual nsresult CreateEventListeners(); - /** returns the layout object (nsIFrame in the real world) for aNode - * @param aNode the content to get a frame for - * @param aLayoutObject the "primary frame" for aNode, if one exists. May be null - * @return NS_OK whether a frame is found or not - * an error if some serious error occurs - */ - NS_IMETHOD GetLayoutObject(nsIDOMNode *aInNode, nsISupports **aOutLayoutObject); // Helpers for output routines NS_IMETHOD GetAndInitDocEncoder(const nsAString& aFormatType, PRUint32 aFlags, diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index cbcfed03bce7..af3b5723289e 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -103,10 +103,10 @@ typedef short SelectionType; typedef PRUint32 nsFrameState; -// 23e048f6-49bb-4ac4-b900-c63865363ad3 +// 134e504f-4fd1-4590-9f5d-899afee63d0f #define NS_IPRESSHELL_IID \ -{ 0x23e048f6, 0x49bb, 0x4ac4, \ - { 0xb9, 0x00, 0xc6, 0x38, 0x65, 0x36, 0x3a, 0xd3 } } +{ 0x134e504f, 0x4fd1, 0x4590, \ + { 0x9f, 0x5d, 0x89, 0x9a, 0xfe, 0xe6, 0x3d, 0x0f } } // Constants for ScrollContentIntoView() function #define NS_PRESSHELL_SCROLL_TOP 0 @@ -346,15 +346,6 @@ public: */ virtual NS_HIDDEN_(nsIFrame*) GetRealPrimaryFrameFor(nsIContent* aContent) const = 0; - /** - * Returns a layout object associated with the primary frame for the content object. - * - * @param aContent the content object for which we seek a layout object - * @param aResult the resulting layout object as an nsISupports, if found. - */ - NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent, - nsISupports** aResult) const = 0; - /** * Gets the placeholder frame associated with the specified frame. This is * a helper frame that forwards the request to the frame manager. diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 3c4d636d3899..402cdeb96d75 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -814,8 +814,6 @@ public: virtual NS_HIDDEN_(nsIFrame*) GetPrimaryFrameFor(nsIContent* aContent) const; virtual NS_HIDDEN_(nsIFrame*) GetRealPrimaryFrameFor(nsIContent* aContent) const; - NS_IMETHOD GetLayoutObjectFor(nsIContent* aContent, - nsISupports** aResult) const; NS_IMETHOD GetPlaceholderFrameFor(nsIFrame* aFrame, nsIFrame** aPlaceholderFrame) const; NS_IMETHOD FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty, @@ -4903,24 +4901,6 @@ PresShell::GetRealPrimaryFrameFor(nsIContent* aContent) const return nsPlaceholderFrame::GetRealFrameFor(primaryFrame); } -NS_IMETHODIMP -PresShell::GetLayoutObjectFor(nsIContent* aContent, - nsISupports** aResult) const -{ - nsresult result = NS_ERROR_NULL_POINTER; - if ((nsnull!=aResult) && (nsnull!=aContent)) - { - *aResult = nsnull; - nsIFrame *primaryFrame = GetPrimaryFrameFor(aContent); - if (primaryFrame) - { - result = primaryFrame->QueryInterface(NS_GET_IID(nsISupports), - (void**)aResult); - } - } - return result; -} - NS_IMETHODIMP PresShell::GetPlaceholderFrameFor(nsIFrame* aFrame, nsIFrame** aResult) const