Bug 1455676 part 10. Remove use of nsIDOMNode from remaining xpidl. r=qdot

This commit is contained in:
Boris Zbarsky 2018-05-29 22:58:49 -04:00
Родитель 4cf7b4f9a1
Коммит 931b9e37ad
11 изменённых файлов: 39 добавлений и 90 удалений

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

@ -2242,9 +2242,9 @@ FragmentOrElement::GetMarkup(bool aIncludeSelf, nsAString& aMarkup)
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (aIncludeSelf) {
docEncoder->SetNativeNode(this);
docEncoder->SetNode(this);
} else {
docEncoder->SetNativeContainerNode(this);
docEncoder->SetContainerNode(this);
}
rv = docEncoder->EncodeToString(aMarkup);
MOZ_ASSERT(NS_SUCCEEDED(rv));

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

@ -501,7 +501,7 @@ static nsresult AppendDOMNode(nsITransferable *aTransferable,
nsIDocumentEncoder::OutputEncodeBasicEntities);
NS_ENSURE_SUCCESS(rv, rv);
rv = docEncoder->SetNativeNode(aDOMNode);
rv = docEncoder->SetNode(aDOMNode);
NS_ENSURE_SUCCESS(rv, rv);
// serialize to string

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

@ -59,7 +59,7 @@ SetUpEncoder(nsINode& aRoot, const nsAString& aCharset, ErrorResult& aRv)
// If we are working on the entire document we do not need to
// specify which part to serialize
if (!entireDocument) {
rv = encoder->SetNativeNode(&aRoot);
rv = encoder->SetNode(&aRoot);
}
if (NS_FAILED(rv)) {

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

@ -1363,7 +1363,7 @@ nsDOMWindowUtils::NodesFromRect(float aX, float aY,
}
NS_IMETHODIMP
nsDOMWindowUtils::GetTranslationNodes(nsIDOMNode* aRoot,
nsDOMWindowUtils::GetTranslationNodes(nsINode* aRoot,
nsITranslationNodeList** aRetVal)
{
NS_ENSURE_ARG_POINTER(aRetVal);
@ -1430,7 +1430,7 @@ nsDOMWindowUtils::GetTranslationNodes(nsIDOMNode* aRoot,
isTranslationRoot = !parentInList;
}
list->AppendElement(content->AsDOMNode(), isTranslationRoot);
list->AppendElement(content, isTranslationRoot);
--limit;
break;
}
@ -1828,7 +1828,7 @@ nsDOMWindowUtils::GetFullZoom(float* aFullZoom)
}
NS_IMETHODIMP
nsDOMWindowUtils::DispatchDOMEventViaPresShell(nsIDOMNode* aTarget,
nsDOMWindowUtils::DispatchDOMEventViaPresShell(nsINode* aTarget,
Event* aEvent,
bool aTrusted,
bool* aRetVal)
@ -2510,15 +2510,14 @@ nsDOMWindowUtils::GetAsyncPanZoomEnabled(bool *aResult)
}
NS_IMETHODIMP
nsDOMWindowUtils::SetAsyncScrollOffset(nsIDOMNode* aNode,
nsDOMWindowUtils::SetAsyncScrollOffset(Element* aElement,
float aX, float aY)
{
nsCOMPtr<Element> element = do_QueryInterface(aNode);
if (!element) {
if (!aElement) {
return NS_ERROR_INVALID_ARG;
}
FrameMetrics::ViewID viewId;
if (!nsLayoutUtils::FindIDFor(element, &viewId)) {
if (!nsLayoutUtils::FindIDFor(aElement, &viewId)) {
return NS_ERROR_UNEXPECTED;
}
nsIWidget* widget = GetWidget();
@ -2546,14 +2545,13 @@ nsDOMWindowUtils::SetAsyncScrollOffset(nsIDOMNode* aNode,
}
NS_IMETHODIMP
nsDOMWindowUtils::SetAsyncZoom(nsIDOMNode* aRootElement, float aValue)
nsDOMWindowUtils::SetAsyncZoom(Element* aRootElement, float aValue)
{
nsCOMPtr<Element> element = do_QueryInterface(aRootElement);
if (!element) {
if (!aRootElement) {
return NS_ERROR_INVALID_ARG;
}
FrameMetrics::ViewID viewId;
if (!nsLayoutUtils::FindIDFor(element, &viewId)) {
if (!nsLayoutUtils::FindIDFor(aRootElement, &viewId)) {
return NS_ERROR_UNEXPECTED;
}
nsIWidget* widget = GetWidget();
@ -3582,11 +3580,10 @@ nsDOMWindowUtils::GetIsParentWindowMainWidgetVisible(bool* aIsVisible)
}
NS_IMETHODIMP
nsDOMWindowUtils::IsNodeDisabledForEvents(nsIDOMNode* aNode, bool* aRetVal)
nsDOMWindowUtils::IsNodeDisabledForEvents(nsINode* aNode, bool* aRetVal)
{
*aRetVal = false;
nsCOMPtr<nsINode> n = do_QueryInterface(aNode);
nsINode* node = n;
nsINode* node = aNode;
while (node) {
if (node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) {
nsCOMPtr<nsIFormControl> fc = do_QueryInterface(node);
@ -4066,7 +4063,7 @@ nsDOMWindowUtils::TriggerDeviceReset()
}
NS_IMETHODIMP
nsDOMWindowUtils::ForceUseCounterFlush(nsIDOMNode *aNode)
nsDOMWindowUtils::ForceUseCounterFlush(nsINode *aNode)
{
NS_ENSURE_ARG_POINTER(aNode);
@ -4294,7 +4291,7 @@ NS_IMPL_ADDREF(nsTranslationNodeList)
NS_IMPL_RELEASE(nsTranslationNodeList)
NS_IMETHODIMP
nsTranslationNodeList::Item(uint32_t aIndex, nsIDOMNode** aRetVal)
nsTranslationNodeList::Item(uint32_t aIndex, nsINode** aRetVal)
{
NS_ENSURE_ARG_POINTER(aRetVal);
NS_IF_ADDREF(*aRetVal = mNodes.SafeElementAt(aIndex));

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

@ -44,7 +44,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSITRANSLATIONNODELIST
void AppendElement(nsIDOMNode* aElement, bool aIsRoot)
void AppendElement(nsINode* aElement, bool aIsRoot)
{
mNodes.AppendElement(aElement);
mNodeIsRoot.AppendElement(aIsRoot);
@ -54,7 +54,7 @@ public:
private:
~nsTranslationNodeList() {}
nsTArray<nsCOMPtr<nsIDOMNode> > mNodes;
nsTArray<nsCOMPtr<nsINode> > mNodes;
nsTArray<bool> mNodeIsRoot;
uint32_t mLength;
};

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

@ -294,15 +294,7 @@ nsDocumentEncoder::SetRange(nsRange* aRange)
}
NS_IMETHODIMP
nsDocumentEncoder::SetNode(nsIDOMNode* aNode)
{
mNodeIsContainer = false;
mNode = do_QueryInterface(aNode);
return NS_OK;
}
NS_IMETHODIMP
nsDocumentEncoder::SetNativeNode(nsINode* aNode)
nsDocumentEncoder::SetNode(nsINode* aNode)
{
mNodeIsContainer = false;
mNode = aNode;
@ -310,15 +302,7 @@ nsDocumentEncoder::SetNativeNode(nsINode* aNode)
}
NS_IMETHODIMP
nsDocumentEncoder::SetContainerNode(nsIDOMNode *aContainer)
{
mNodeIsContainer = true;
mNode = do_QueryInterface(aContainer);
return NS_OK;
}
NS_IMETHODIMP
nsDocumentEncoder::SetNativeContainerNode(nsINode* aContainer)
nsDocumentEncoder::SetContainerNode(nsINode* aContainer)
{
mNodeIsContainer = true;
mNode = aContainer;
@ -372,10 +356,8 @@ nsDocumentEncoder::SerializeNodeStart(nsINode* aNode,
aOriginalNode = aNode;
if (mNodeFixup) {
bool dummy;
nsCOMPtr<nsIDOMNode> domNodeIn = do_QueryInterface(aNode);
nsCOMPtr<nsIDOMNode> domNodeOut;
mNodeFixup->FixupNode(domNodeIn, &dummy, getter_AddRefs(domNodeOut));
fixedNodeKungfuDeathGrip = do_QueryInterface(domNodeOut);
mNodeFixup->FixupNode(aNode, &dummy,
getter_AddRefs(fixedNodeKungfuDeathGrip));
node = fixedNodeKungfuDeathGrip;
}
}
@ -471,10 +453,8 @@ nsDocumentEncoder::SerializeToStringRecursive(nsINode* aNode,
// Keep the node from FixupNode alive.
nsCOMPtr<nsINode> fixedNodeKungfuDeathGrip;
if (mNodeFixup) {
nsCOMPtr<nsIDOMNode> domNodeIn = do_QueryInterface(aNode);
nsCOMPtr<nsIDOMNode> domNodeOut;
mNodeFixup->FixupNode(domNodeIn, &serializeClonedChildren, getter_AddRefs(domNodeOut));
fixedNodeKungfuDeathGrip = do_QueryInterface(domNodeOut);
mNodeFixup->FixupNode(aNode, &serializeClonedChildren,
getter_AddRefs(fixedNodeKungfuDeathGrip));
maybeFixedNode = fixedNodeKungfuDeathGrip;
}

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

@ -5,12 +5,12 @@
#include "nsISupports.idl"
interface nsIDOMNode;
interface nsIOutputStream;
webidl Selection;
webidl Document;
webidl Node;
webidl Range;
webidl Selection;
%{ C++
class nsINode;
@ -33,7 +33,7 @@ interface nsIDocumentEncoderNodeFixup : nsISupports
* instead of the children of the original node.
* @return The resulting fixed up node.
*/
nsIDOMNode fixupNode(in nsIDOMNode aNode, out boolean aSerializeCloneKids);
Node fixupNode(in Node aNode, out boolean aSerializeCloneKids);
};
[scriptable, uuid(21f112df-d96f-47da-bfcb-5331273003d1)]
@ -265,8 +265,7 @@ interface nsIDocumentEncoder : nsISupports
* document or range or selection is encoded.
* @param aNode The node to encode.
*/
void setNode(in nsIDOMNode aNode);
[noscript] void setNativeNode(in nsINodePtr aNode);
void setNode(in Node aNode);
/**
* If the container is set to a non-null value, then its
@ -274,8 +273,7 @@ interface nsIDocumentEncoder : nsISupports
* document or range or selection or node is encoded.
* @param aContainer The node which child nodes will be encoded.
*/
void setContainerNode(in nsIDOMNode aContainer);
[noscript] void setNativeContainerNode(in nsINodePtr aContainer);
void setContainerNode(in Node aContainer);
/**
* Documents typically have an intrinsic character set,

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

@ -15,9 +15,6 @@ typedef unsigned long long DOMTimeStamp;
typedef double DOMHighResTimeStamp;
typedef unsigned long long nsViewID;
// Core
interface nsIDOMNode;
// Needed for raises() in our IDL
%{C++
namespace mozilla {

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

@ -31,7 +31,6 @@ native nscolor(nscolor);
interface nsIArray;
interface nsICycleCollectorListener;
interface nsIDOMNode;
interface nsIPreloadedStyleSheet;
interface nsITransferable;
interface nsIQueryContentEventResult;
@ -49,6 +48,7 @@ webidl DOMRect;
webidl Element;
webidl EventTarget;
webidl Event;
webidl Node;
webidl NodeList;
[scriptable, uuid(4d6732ca-9da7-4176-b8a1-8dde15cd0bf9)]
@ -780,7 +780,7 @@ interface nsIDOMWindowUtils : nsISupports {
*
* This method requires chrome privileges.
*/
nsITranslationNodeList getTranslationNodes(in nsIDOMNode aRoot);
nsITranslationNodeList getTranslationNodes(in Node aRoot);
/**
* Compare the two canvases, returning the number of differing pixels and
@ -936,7 +936,7 @@ interface nsIDOMWindowUtils : nsISupports {
* @note Event handlers won't get aEvent as parameter, but a similar event.
* Also, aEvent should not be reused.
*/
boolean dispatchDOMEventViaPresShell(in nsIDOMNode aTarget,
boolean dispatchDOMEventViaPresShell(in Node aTarget,
in Event aEvent,
in boolean aTrusted);
@ -1402,7 +1402,7 @@ interface nsIDOMWindowUtils : nsISupports {
* with that offset if async scrolling is enabled, and then the offset
* will be removed. Only call this while test-controlled refreshes is enabled.
*/
void setAsyncScrollOffset(in nsIDOMNode aNode, in float aX, in float aY);
void setAsyncScrollOffset(in Element aElement, in float aX, in float aY);
/**
* Set async zoom value. aRootElement should be the document element of our
@ -1410,7 +1410,7 @@ interface nsIDOMWindowUtils : nsISupports {
* existing zoom if async scrolling is enabled, and then the zoom will be
* removed. Only call this while test-controlled refreshes is enabled.
*/
void setAsyncZoom(in nsIDOMNode aRootElement, in float aValue);
void setAsyncZoom(in Element aRootElement, in float aValue);
/**
* Do a round-trip to the compositor to ensure any pending APZ repaint requests
@ -1682,7 +1682,7 @@ interface nsIDOMWindowUtils : nsISupports {
* may be disabled. Such cases are for example the existence of disabled
* attribute or -moz-user-input: none.
*/
boolean isNodeDisabledForEvents(in nsIDOMNode aNode);
boolean isNodeDisabledForEvents(in Node aNode);
/**
* Setting paintFlashing to true will flash newly painted area.
@ -1830,7 +1830,7 @@ interface nsIDOMWindowUtils : nsISupports {
* non-deterministic, we have this method here for more determinism when
* running tests.
*/
void forceUseCounterFlush(in nsIDOMNode aNode);
void forceUseCounterFlush(in Node aNode);
/**
* Enable or disable displayport suppression. This is intended to be used by
@ -1954,7 +1954,7 @@ interface nsIDOMWindowUtils : nsISupports {
[scriptable, uuid(c694e359-7227-4392-a138-33c0cc1f15a6)]
interface nsITranslationNodeList : nsISupports {
readonly attribute unsigned long length;
nsIDOMNode item(in unsigned long index);
Node item(in unsigned long index);
// A translation root is a block element, or an inline element
// which its parent is not a translation node.

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

@ -575,9 +575,6 @@ private:
return mParent->GetPersistFlags() & aFlag;
}
// Helper for XPCOM FixupNode.
nsresult FixupNode(nsINode *aNodeIn, bool *aSerializeCloneKids,
nsINode **aNodeOut);
nsresult GetNodeToFixup(nsINode* aNodeIn, nsINode** aNodeOut);
nsresult FixupURI(nsAString& aURI);
nsresult FixupAttribute(nsINode* aNode,
@ -831,26 +828,6 @@ PersistNodeFixup::FixupXMLStyleSheetLink(dom::ProcessingInstruction* aPI,
}
NS_IMETHODIMP
PersistNodeFixup::FixupNode(nsIDOMNode *aNodeIn,
bool *aSerializeCloneKids,
nsIDOMNode **aNodeOut)
{
nsCOMPtr<nsINode> nodeIn = do_QueryInterface(aNodeIn);
nsCOMPtr<nsINode> nodeOut;
nsresult rv = FixupNode(nodeIn, aSerializeCloneKids,
getter_AddRefs(nodeOut));
// FixupNode can return NS_OK and a null outparam, so check
// the actual value we got before dereferencing it.
if (nodeOut) {
NS_ADDREF(*aNodeOut = nodeOut->AsDOMNode());
} else {
*aNodeOut = nullptr;
}
return rv;
}
nsresult
PersistNodeFixup::FixupNode(nsINode* aNodeIn,
bool* aSerializeCloneKids,
nsINode** aNodeOut)

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

@ -1717,7 +1717,7 @@ TextEditor::GetAndInitDocEncoder(const nsAString& aFormatType,
return nullptr;
}
if (!rootElement->IsHTMLElement(nsGkAtoms::body)) {
rv = docEncoder->SetNativeContainerNode(rootElement);
rv = docEncoder->SetContainerNode(rootElement);
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}