Bug 1445140 part 3. Pass a DocumentType to nsIContentSerializer::AppendDoctype. r=mystor

MozReview-Commit-ID: 5UjRSP6MoDI
This commit is contained in:
Boris Zbarsky 2018-03-13 16:24:01 -04:00
parent 27d1556d72
commit 7bbb9b0ced
5 changed files with 12 additions and 12 deletions

View File

@ -24,7 +24,6 @@
#include "nsIDOMText.h"
#include "nsIDOMComment.h"
#include "nsIDOMProcessingInstruction.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMNodeList.h"
#include "nsRange.h"
#include "nsIDOMRange.h"
@ -45,6 +44,7 @@
#include "nsTArray.h"
#include "nsIFrame.h"
#include "nsStringBuffer.h"
#include "mozilla/dom/DocumentType.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ShadowRoot.h"
#include "nsLayoutUtils.h"
@ -430,7 +430,7 @@ nsDocumentEncoder::SerializeNodeStart(nsINode* aNode,
}
case nsINode::DOCUMENT_TYPE_NODE:
{
mSerializer->AppendDoctype(static_cast<nsIContent*>(node), aStr);
mSerializer->AppendDoctype(static_cast<DocumentType*>(node), aStr);
break;
}
}

View File

@ -16,6 +16,7 @@ class nsIDocument;
namespace mozilla {
class Encoding;
namespace dom {
class DocumentType;
class Element;
} // namespace dom
} // namespace mozilla
@ -51,7 +52,7 @@ class nsIContentSerializer : public nsISupports {
NS_IMETHOD AppendComment(nsIContent* aComment, int32_t aStartOffset,
int32_t aEndOffset, nsAString& aStr) = 0;
NS_IMETHOD AppendDoctype(nsIContent *aDoctype,
NS_IMETHOD AppendDoctype(mozilla::dom::DocumentType* aDoctype,
nsAString& aStr) = 0;
NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement,

View File

@ -29,6 +29,7 @@ class nsIContent;
namespace mozilla {
namespace dom {
class DocumentType;
class Element;
} // namespace dom
} // namespace mozilla
@ -60,7 +61,7 @@ public:
nsAString& aStr) override { return NS_OK; }
NS_IMETHOD AppendComment(nsIContent* aComment, int32_t aStartOffset,
int32_t aEndOffset, nsAString& aStr) override { return NS_OK; }
NS_IMETHOD AppendDoctype(nsIContent *aDoctype,
NS_IMETHOD AppendDoctype(mozilla::dom::DocumentType* aDoctype,
nsAString& aStr) override { return NS_OK; }
NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement,
mozilla::dom::Element* aOriginalElement,

View File

@ -15,7 +15,6 @@
#include "nsGkAtoms.h"
#include "nsIDOMProcessingInstruction.h"
#include "nsIDOMComment.h"
#include "nsIDOMDocumentType.h"
#include "nsIContent.h"
#include "nsIContentInlines.h"
#include "nsIDocument.h"
@ -29,6 +28,7 @@
#include "nsCRT.h"
#include "nsContentUtils.h"
#include "nsAttrName.h"
#include "mozilla/dom/DocumentType.h"
#include "mozilla/dom/Element.h"
#include "mozilla/intl/LineBreaker.h"
#include "nsParserConstants.h"
@ -360,19 +360,17 @@ nsXMLContentSerializer::AppendComment(nsIContent* aComment,
}
NS_IMETHODIMP
nsXMLContentSerializer::AppendDoctype(nsIContent* aDocType,
nsXMLContentSerializer::AppendDoctype(DocumentType* aDocType,
nsAString& aStr)
{
nsCOMPtr<nsIDOMDocumentType> docType = do_QueryInterface(aDocType);
NS_ENSURE_ARG(docType);
nsresult rv;
nsAutoString name, publicId, systemId;
rv = docType->GetName(name);
rv = aDocType->GetName(name);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
rv = docType->GetPublicId(publicId);
rv = aDocType->GetPublicId(publicId);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
rv = docType->GetSystemId(systemId);
rv = aDocType->GetSystemId(systemId);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
NS_ENSURE_TRUE(MaybeAddNewlineForRootNode(aStr), NS_ERROR_OUT_OF_MEMORY);

View File

@ -58,7 +58,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
NS_IMETHOD AppendComment(nsIContent* aComment, int32_t aStartOffset,
int32_t aEndOffset, nsAString& aStr) override;
NS_IMETHOD AppendDoctype(nsIContent *aDoctype,
NS_IMETHOD AppendDoctype(mozilla::dom::DocumentType* aDoctype,
nsAString& aStr) override;
NS_IMETHOD AppendElementStart(mozilla::dom::Element* aElement,