forked from mirrors/gecko-dev
Bug 1463981 part 2. Remove use of nsIDOMNode in editor xpidl. r=masayuki
This commit is contained in:
parent
8f50a01cba
commit
0f8f7f6fba
13 changed files with 64 additions and 69 deletions
|
|
@ -1396,7 +1396,7 @@ EditorBase::CreateNodeWithTransaction(
|
|||
AutoActionListenerArray listeners(mActionListeners);
|
||||
for (auto& listener : listeners) {
|
||||
listener->DidCreateNode(nsDependentAtomString(&aTagName),
|
||||
GetAsDOMNode(newElement), rv);
|
||||
newElement, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1455,7 +1455,7 @@ EditorBase::InsertNodeWithTransaction(
|
|||
if (!mActionListeners.IsEmpty()) {
|
||||
AutoActionListenerArray listeners(mActionListeners);
|
||||
for (auto& listener : listeners) {
|
||||
listener->DidInsertNode(aContentToInsert.AsDOMNode(), rv);
|
||||
listener->DidInsertNode(&aContentToInsert, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1535,8 +1535,7 @@ EditorBase::SplitNodeWithTransaction(
|
|||
if (!mActionListeners.IsEmpty()) {
|
||||
AutoActionListenerArray listeners(mActionListeners);
|
||||
for (auto& listener : listeners) {
|
||||
listener->DidSplitNode(aStartOfRightNode.GetContainerAsDOMNode(),
|
||||
GetAsDOMNode(newNode));
|
||||
listener->DidSplitNode(aStartOfRightNode.GetContainer(), newNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1614,8 +1613,7 @@ EditorBase::JoinNodesWithTransaction(nsINode& aLeftNode,
|
|||
if (!mActionListeners.IsEmpty()) {
|
||||
AutoActionListenerArray listeners(mActionListeners);
|
||||
for (auto& listener : listeners) {
|
||||
listener->DidJoinNodes(aLeftNode.AsDOMNode(), aRightNode.AsDOMNode(),
|
||||
parent->AsDOMNode(), rv);
|
||||
listener->DidJoinNodes(&aLeftNode, &aRightNode, parent, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1663,7 +1661,7 @@ EditorBase::DeleteNodeWithTransaction(nsINode& aNode)
|
|||
if (!mActionListeners.IsEmpty()) {
|
||||
AutoActionListenerArray listeners(mActionListeners);
|
||||
for (auto& listener : listeners) {
|
||||
listener->DidDeleteNode(aNode.AsDOMNode(), rv);
|
||||
listener->DidDeleteNode(&aNode, rv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -854,11 +854,10 @@ HTMLEditor::NodeIsBlockStatic(const nsINode* aElement)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::NodeIsBlock(nsIDOMNode* aNode,
|
||||
HTMLEditor::NodeIsBlock(nsINode* aNode,
|
||||
bool* aIsBlock)
|
||||
{
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
|
||||
*aIsBlock = IsBlockNode(node);
|
||||
*aIsBlock = IsBlockNode(aNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
@ -2870,7 +2869,7 @@ HTMLEditor::GetLinkedObjects(nsIArray** aNodeList)
|
|||
|
||||
// loop through the content iterator for each content node
|
||||
while (!iter->IsDone()) {
|
||||
nsCOMPtr<nsIDOMNode> node (do_QueryInterface(iter->GetCurrentNode()));
|
||||
nsCOMPtr<nsINode> node = iter->GetCurrentNode();
|
||||
if (node) {
|
||||
// Let nsURIRefObject make the hard decisions:
|
||||
nsCOMPtr<nsIURIRefObject> refObject;
|
||||
|
|
|
|||
|
|
@ -1034,7 +1034,7 @@ protected: // Shouldn't be used by friend classes
|
|||
*/
|
||||
nsresult InsertAsPlaintextQuotation(const nsAString& aQuotedText,
|
||||
bool aAddCites,
|
||||
nsIDOMNode** aNodeInserted);
|
||||
nsINode** aNodeInserted);
|
||||
|
||||
nsresult InsertObject(const nsACString& aType, nsISupports* aObject,
|
||||
bool aIsSafe,
|
||||
|
|
|
|||
|
|
@ -177,13 +177,12 @@ HTMLEditor::InsertHTMLWithContext(const nsAString& aInputString,
|
|||
const nsAString& aInfoStr,
|
||||
const nsAString& aFlavor,
|
||||
nsIDocument* aSourceDoc,
|
||||
nsIDOMNode* aDestNode,
|
||||
nsINode* aDestNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDeleteSelection)
|
||||
{
|
||||
nsCOMPtr<nsINode> destNode = do_QueryInterface(aDestNode);
|
||||
return DoInsertHTMLWithContext(aInputString, aContextStr, aInfoStr,
|
||||
aFlavor, aSourceDoc, destNode, aDestOffset,
|
||||
aFlavor, aSourceDoc, aDestNode, aDestOffset,
|
||||
aDeleteSelection,
|
||||
/* trusted input */ true,
|
||||
/* clear style */ false);
|
||||
|
|
@ -1741,7 +1740,7 @@ HTMLEditor::InsertTextWithQuotations(const nsAString& aStringToInsert)
|
|||
// If no newline found, lineStart is now strEnd and we can finish up,
|
||||
// inserting from curHunk to lineStart then returning.
|
||||
const nsAString &curHunk = Substring(hunkStart, lineStart);
|
||||
nsCOMPtr<nsIDOMNode> dummyNode;
|
||||
nsCOMPtr<nsINode> dummyNode;
|
||||
if (curHunkIsQuoted) {
|
||||
rv = InsertAsPlaintextQuotation(curHunk, false,
|
||||
getter_AddRefs(dummyNode));
|
||||
|
|
@ -1764,7 +1763,7 @@ HTMLEditor::InsertTextWithQuotations(const nsAString& aStringToInsert)
|
|||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::InsertAsQuotation(const nsAString& aQuotedText,
|
||||
nsIDOMNode** aNodeInserted)
|
||||
nsINode** aNodeInserted)
|
||||
{
|
||||
if (IsPlaintextEditor()) {
|
||||
return InsertAsPlaintextQuotation(aQuotedText, true, aNodeInserted);
|
||||
|
|
@ -1782,7 +1781,7 @@ HTMLEditor::InsertAsQuotation(const nsAString& aQuotedText,
|
|||
nsresult
|
||||
HTMLEditor::InsertAsPlaintextQuotation(const nsAString& aQuotedText,
|
||||
bool aAddCites,
|
||||
nsIDOMNode** aNodeInserted)
|
||||
nsINode** aNodeInserted)
|
||||
{
|
||||
// get selection
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
|
|
@ -1847,7 +1846,7 @@ HTMLEditor::InsertAsPlaintextQuotation(const nsAString& aQuotedText,
|
|||
// don't need to know the inserted node.
|
||||
|
||||
if (aNodeInserted && NS_SUCCEEDED(rv)) {
|
||||
*aNodeInserted = GetAsDOMNode(newNode);
|
||||
*aNodeInserted = newNode;
|
||||
NS_IF_ADDREF(*aNodeInserted);
|
||||
}
|
||||
|
||||
|
|
@ -1877,7 +1876,7 @@ NS_IMETHODIMP
|
|||
HTMLEditor::InsertAsCitedQuotation(const nsAString& aQuotedText,
|
||||
const nsAString& aCitation,
|
||||
bool aInsertHTML,
|
||||
nsIDOMNode** aNodeInserted)
|
||||
nsINode** aNodeInserted)
|
||||
{
|
||||
// Don't let anyone insert html into a "plaintext" editor:
|
||||
if (IsPlaintextEditor()) {
|
||||
|
|
@ -1927,7 +1926,7 @@ HTMLEditor::InsertAsCitedQuotation(const nsAString& aQuotedText,
|
|||
}
|
||||
|
||||
if (aNodeInserted && NS_SUCCEEDED(rv)) {
|
||||
*aNodeInserted = GetAsDOMNode(newNode);
|
||||
*aNodeInserted = newNode;
|
||||
NS_IF_ADDREF(*aNodeInserted);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
#include "nsDOMAttributeMap.h"
|
||||
#include "nsError.h"
|
||||
#include "nsID.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "nsString.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
|
@ -86,8 +86,11 @@ HTMLURIRefObject::GetNextURI(nsAString& aURI)
|
|||
{
|
||||
NS_ENSURE_TRUE(mNode, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsCOMPtr<dom::Element> element = do_QueryInterface(mNode);
|
||||
NS_ENSURE_TRUE(element, NS_ERROR_INVALID_ARG);
|
||||
if (NS_WARN_IF(!mNode->IsElement())) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
RefPtr<dom::Element> element = mNode->AsElement();
|
||||
|
||||
// Loop over attribute list:
|
||||
if (!mAttrsInited) {
|
||||
|
|
@ -231,17 +234,16 @@ HTMLURIRefObject::RewriteAllURIs(const nsAString& aOldPat,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLURIRefObject::GetNode(nsIDOMNode** aNode)
|
||||
HTMLURIRefObject::GetNode(nsINode** aNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(mNode, NS_ERROR_NOT_INITIALIZED);
|
||||
NS_ENSURE_TRUE(aNode, NS_ERROR_NULL_POINTER);
|
||||
*aNode = mNode.get();
|
||||
NS_ADDREF(*aNode);
|
||||
*aNode = do_AddRef(mNode).take();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLURIRefObject::SetNode(nsIDOMNode* aNode)
|
||||
HTMLURIRefObject::SetNode(nsINode* aNode)
|
||||
{
|
||||
mNode = aNode;
|
||||
nsAutoString dummyURI;
|
||||
|
|
@ -258,7 +260,7 @@ HTMLURIRefObject::SetNode(nsIDOMNode* aNode)
|
|||
|
||||
} // namespace mozilla
|
||||
|
||||
nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsIDOMNode* aNode)
|
||||
nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsINode* aNode)
|
||||
{
|
||||
RefPtr<mozilla::HTMLURIRefObject> refObject = new mozilla::HTMLURIRefObject();
|
||||
nsresult rv = refObject->SetNode(aNode);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
}
|
||||
|
||||
class nsDOMAttributeMap;
|
||||
class nsIDOMNode;
|
||||
class nsINode;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ public:
|
|||
protected:
|
||||
virtual ~HTMLURIRefObject();
|
||||
|
||||
nsCOMPtr<nsIDOMNode> mNode;
|
||||
nsCOMPtr<nsINode> mNode;
|
||||
uint32_t mCurAttrIndex;
|
||||
uint32_t mAttributeCnt;
|
||||
bool mAttrsInited;
|
||||
|
|
@ -44,6 +44,6 @@ protected:
|
|||
|
||||
} // namespace mozilla
|
||||
|
||||
nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsIDOMNode* aNode);
|
||||
nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsINode* aNode);
|
||||
|
||||
#endif // #ifndef HTMLURIRefObject_h
|
||||
|
|
|
|||
|
|
@ -800,7 +800,7 @@ TextEditor::DeleteSelectionWithTransaction(EDirection aDirection,
|
|||
}
|
||||
} else {
|
||||
for (auto& listener : mActionListeners) {
|
||||
listener->DidDeleteNode(deleteNode->AsDOMNode(), rv);
|
||||
listener->DidDeleteNode(deleteNode, rv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1824,7 +1824,7 @@ TextEditor::PasteAsQuotation(int32_t aSelectionType)
|
|||
|
||||
NS_IMETHODIMP
|
||||
TextEditor::InsertAsQuotation(const nsAString& aQuotedText,
|
||||
nsIDOMNode** aNodeInserted)
|
||||
nsINode** aNodeInserted)
|
||||
{
|
||||
// Protect the edit rules object from dying
|
||||
RefPtr<TextEditRules> rules(mRules);
|
||||
|
|
@ -1878,7 +1878,7 @@ NS_IMETHODIMP
|
|||
TextEditor::InsertAsCitedQuotation(const nsAString& aQuotedText,
|
||||
const nsAString& aCitation,
|
||||
bool aInsertHTML,
|
||||
nsIDOMNode** aNodeInserted)
|
||||
nsINode** aNodeInserted)
|
||||
{
|
||||
return InsertAsQuotation(aQuotedText, aNodeInserted);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "domstubs.idl"
|
||||
|
||||
webidl CharacterData;
|
||||
webidl Node;
|
||||
webidl Selection;
|
||||
|
||||
/*
|
||||
|
|
@ -35,7 +36,7 @@ interface nsIEditActionListener : nsISupports
|
|||
* @param aResult The result of the create node operation.
|
||||
*/
|
||||
void DidCreateNode(in DOMString aTag,
|
||||
in nsIDOMNode aNewNode,
|
||||
in Node aNewNode,
|
||||
in nsresult aResult);
|
||||
|
||||
/**
|
||||
|
|
@ -43,7 +44,7 @@ interface nsIEditActionListener : nsISupports
|
|||
* @param aNode The DOM Node to insert.
|
||||
* @param aResult The result of the insert node operation.
|
||||
*/
|
||||
void DidInsertNode(in nsIDOMNode aNode,
|
||||
void DidInsertNode(in Node aNode,
|
||||
in nsresult aResult);
|
||||
|
||||
/**
|
||||
|
|
@ -51,7 +52,7 @@ interface nsIEditActionListener : nsISupports
|
|||
* @param aChild The node to delete
|
||||
* @param aResult The result of the delete node operation.
|
||||
*/
|
||||
void DidDeleteNode(in nsIDOMNode aChild, in nsresult aResult);
|
||||
void DidDeleteNode(in Node aChild, in nsresult aResult);
|
||||
|
||||
/**
|
||||
* Called after the editor splits a node.
|
||||
|
|
@ -60,8 +61,8 @@ interface nsIEditActionListener : nsISupports
|
|||
* @param aNewLeftNode The new node resulting from the split, becomes
|
||||
* the previous sibling of aExistingRightNode.
|
||||
*/
|
||||
void DidSplitNode(in nsIDOMNode aExistingRightNode,
|
||||
in nsIDOMNode aNewLeftNode);
|
||||
void DidSplitNode(in Node aExistingRightNode,
|
||||
in Node aNewLeftNode);
|
||||
|
||||
/**
|
||||
* Called after the editor joins 2 nodes.
|
||||
|
|
@ -72,10 +73,10 @@ interface nsIEditActionListener : nsISupports
|
|||
* @param aParent The parent of aRightNode
|
||||
* @param aResult The result of the join operation.
|
||||
*/
|
||||
void DidJoinNodes(in nsIDOMNode aLeftNode,
|
||||
in nsIDOMNode aRightNode,
|
||||
in nsIDOMNode aParent,
|
||||
in nsresult aResult);
|
||||
void DidJoinNodes(in Node aLeftNode,
|
||||
in Node aRightNode,
|
||||
in Node aParent,
|
||||
in nsresult aResult);
|
||||
|
||||
/**
|
||||
* Called after the editor inserts text.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@
|
|||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIArray;
|
||||
interface nsIDOMNode;
|
||||
|
||||
webidl Node;
|
||||
|
||||
[scriptable, builtinclass, uuid(fdf23301-4a94-11d3-9ce4-9960496c41bc)]
|
||||
|
||||
|
|
@ -25,7 +26,7 @@ interface nsIEditorMailSupport : nsISupports
|
|||
* @param aQuotedText The actual text to be quoted
|
||||
* @return The node which was inserted
|
||||
*/
|
||||
nsIDOMNode insertAsQuotation(in AString aQuotedText);
|
||||
Node insertAsQuotation(in AString aQuotedText);
|
||||
|
||||
/**
|
||||
* Inserts a plaintext string at the current location,
|
||||
|
|
@ -57,9 +58,9 @@ interface nsIEditorMailSupport : nsISupports
|
|||
* @param aInsertHTML Insert as html? (vs plaintext)
|
||||
* @return The node which was inserted
|
||||
*/
|
||||
nsIDOMNode insertAsCitedQuotation(in AString aQuotedText,
|
||||
in AString aCitation,
|
||||
in boolean aInsertHTML);
|
||||
Node insertAsCitedQuotation(in AString aQuotedText,
|
||||
in AString aCitation,
|
||||
in boolean aInsertHTML);
|
||||
|
||||
/**
|
||||
* Rewrap the selected part of the document, re-quoting if necessary.
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
*
|
||||
* @param aNode the node to test
|
||||
*/
|
||||
boolean nodeIsBlock(in nsIDOMNode node);
|
||||
boolean nodeIsBlock(in Node node);
|
||||
|
||||
/**
|
||||
* Insert some HTML source at the current location
|
||||
|
|
@ -171,7 +171,7 @@ interface nsIHTMLEditor : nsISupports
|
|||
in AString aInfoStr,
|
||||
in AString aFlavor,
|
||||
in Document aSourceDoc,
|
||||
in nsIDOMNode aDestinationNode,
|
||||
in Node aDestinationNode,
|
||||
in long aDestinationOffset,
|
||||
in boolean aDeleteSelection);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMNode;
|
||||
|
||||
webidl Element;
|
||||
webidl Node;
|
||||
webidl Range;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
|
||||
interface nsIDOMNode;
|
||||
webidl Node;
|
||||
|
||||
/** A class which can represent any node which points to an
|
||||
* external URI, e.g. <a>, <img>, <script> etc,
|
||||
|
|
@ -19,7 +19,7 @@ interface nsIDOMNode;
|
|||
|
||||
interface nsIURIRefObject : nsISupports
|
||||
{
|
||||
attribute nsIDOMNode node;
|
||||
attribute Node node;
|
||||
|
||||
/**
|
||||
* Go back to the beginning of the attribute list.
|
||||
|
|
|
|||
|
|
@ -3157,52 +3157,49 @@ TextServicesDocument::FindWordBounds(nsTArray<OffsetEntry*>* aOffsetTable,
|
|||
*/
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextServicesDocument::DidInsertNode(nsIDOMNode* aNode,
|
||||
TextServicesDocument::DidInsertNode(nsINode* aNode,
|
||||
nsresult aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextServicesDocument::DidDeleteNode(nsIDOMNode* aChild,
|
||||
TextServicesDocument::DidDeleteNode(nsINode* aChild,
|
||||
nsresult aResult)
|
||||
{
|
||||
if (NS_WARN_IF(NS_FAILED(aResult))) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsINode> child = do_QueryInterface(aChild);
|
||||
DidDeleteNode(child);
|
||||
DidDeleteNode(aChild);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextServicesDocument::DidSplitNode(nsIDOMNode* aExistingRightNode,
|
||||
nsIDOMNode* aNewLeftNode)
|
||||
TextServicesDocument::DidSplitNode(nsINode* aExistingRightNode,
|
||||
nsINode* aNewLeftNode)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextServicesDocument::DidJoinNodes(nsIDOMNode* aLeftNode,
|
||||
nsIDOMNode* aRightNode,
|
||||
nsIDOMNode* aParent,
|
||||
TextServicesDocument::DidJoinNodes(nsINode* aLeftNode,
|
||||
nsINode* aRightNode,
|
||||
nsINode* aParent,
|
||||
nsresult aResult)
|
||||
{
|
||||
if (NS_WARN_IF(NS_FAILED(aResult))) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsINode> leftNode = do_QueryInterface(aLeftNode);
|
||||
nsCOMPtr<nsINode> rightNode = do_QueryInterface(aRightNode);
|
||||
if (NS_WARN_IF(!leftNode) || NS_WARN_IF(!rightNode)) {
|
||||
if (NS_WARN_IF(!aLeftNode) || NS_WARN_IF(!aRightNode)) {
|
||||
return NS_OK;
|
||||
}
|
||||
DidJoinNodes(*leftNode, *rightNode);
|
||||
DidJoinNodes(*aLeftNode, *aRightNode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TextServicesDocument::DidCreateNode(const nsAString& aTag,
|
||||
nsIDOMNode* aNewNode,
|
||||
nsINode* aNewNode,
|
||||
nsresult aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
|
|
|
|||
Loading…
Reference in a new issue