diff options
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/CustomElementRegistry.cpp | 10 | ||||
-rw-r--r-- | dom/base/nsContentUtils.cpp | 5 | ||||
-rw-r--r-- | dom/base/nsDocument.cpp | 1 | ||||
-rw-r--r-- | dom/base/nsDocumentEncoder.cpp | 22 | ||||
-rw-r--r-- | dom/base/nsHTMLContentSerializer.cpp | 22 | ||||
-rwxr-xr-x | dom/base/nsXHTMLContentSerializer.cpp | 28 | ||||
-rw-r--r-- | dom/base/nsXMLContentSerializer.cpp | 13 |
7 files changed, 27 insertions, 74 deletions
diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 99452df650..e4d4c0670f 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -11,7 +11,7 @@ #include "mozilla/dom/HTMLElementBinding.h" #include "mozilla/dom/WebComponentsBinding.h" #include "mozilla/dom/DocGroup.h" -#include "nsIParserService.h" +#include "nsHTMLTags.h" #include "jsapi.h" namespace mozilla { @@ -588,14 +588,8 @@ CustomElementRegistry::Define(const nsAString& aName, return; } - nsIParserService* ps = nsContentUtils::GetParserService(); - if (!ps) { - aRv.Throw(NS_ERROR_UNEXPECTED); - return; - } - // bgsound and multicol are unknown html element. - int32_t tag = ps->HTMLCaseSensitiveAtomTagToId(extendsAtom); + int32_t tag = nsHTMLTags::CaseSensitiveAtomTagToId(extendsAtom); if (tag == eHTMLTag_userdefined || tag == eHTMLTag_bgsound || tag == eHTMLTag_multicol) { diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index f4828b162c..a68f5ef87d 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -102,6 +102,7 @@ #include "nsHostObjectProtocolHandler.h" #include "nsHtml5Module.h" #include "nsHtml5StringParser.h" +#include "nsHTMLTags.h" #include "nsIAddonPolicyService.h" #include "nsIAnonymousContentCreator.h" #include "nsIAsyncVerifyRedirectCallback.h" @@ -501,6 +502,8 @@ nsContentUtils::Init() return NS_OK; } + nsHTMLTags::AddRefTable(); + sNameSpaceManager = nsNameSpaceManager::GetInstance(); NS_ENSURE_TRUE(sNameSpaceManager, NS_ERROR_OUT_OF_MEMORY); @@ -1927,6 +1930,8 @@ nsContentUtils::Shutdown() { sInitialized = false; + nsHTMLTags::ReleaseTable(); + NS_IF_RELEASE(sContentPolicyService); sTriedToGetContentPolicy = false; uint32_t i; diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 130580fad1..87d860c6ae 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -116,7 +116,6 @@ #include "nsBidiUtils.h" -#include "nsIParserService.h" #include "nsContentCreatorFunctions.h" #include "nsIScriptContext.h" diff --git a/dom/base/nsDocumentEncoder.cpp b/dom/base/nsDocumentEncoder.cpp index de41a7331d..2f5c3dc0a3 100644 --- a/dom/base/nsDocumentEncoder.cpp +++ b/dom/base/nsDocumentEncoder.cpp @@ -32,7 +32,6 @@ #include "nsIDOMDocument.h" #include "nsGkAtoms.h" #include "nsIContent.h" -#include "nsIParserService.h" #include "nsIScriptContext.h" #include "nsIScriptGlobalObject.h" #include "nsIScriptSecurityManager.h" @@ -40,6 +39,7 @@ #include "nsISelectionPrivate.h" #include "nsITransferable.h" // for kUnicodeMime #include "nsContentUtils.h" +#include "nsElementTable.h" #include "nsNodeUtils.h" #include "nsUnicharUtils.h" #include "nsReadableUtils.h" @@ -1741,9 +1741,6 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t rv = GetNodeLocation(node, address_of(parent), &offset); NS_ENSURE_SUCCESS(rv, rv); if (offset == -1) return NS_OK; // we hit generated content; STOP - nsIParserService *parserService = nsContentUtils::GetParserService(); - if (!parserService) - return NS_ERROR_OUT_OF_MEMORY; while ((IsFirstNode(node)) && (!IsRoot(parent)) && (parent != common)) { if (bResetPromotion) @@ -1751,11 +1748,8 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t nsCOMPtr<nsIContent> content = do_QueryInterface(parent); if (content && content->IsHTMLElement()) { - bool isBlock = false; - parserService->IsBlock(parserService->HTMLAtomTagToId( - content->NodeInfo()->NameAtom()), isBlock); - if (isBlock) - { + if (nsHTMLElement::IsBlock(nsHTMLTags::AtomTagToId( + content->NodeInfo()->NameAtom()))) { bResetPromotion = false; } } @@ -1824,9 +1818,6 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t rv = GetNodeLocation(node, address_of(parent), &offset); NS_ENSURE_SUCCESS(rv, rv); if (offset == -1) return NS_OK; // we hit generated content; STOP - nsIParserService *parserService = nsContentUtils::GetParserService(); - if (!parserService) - return NS_ERROR_OUT_OF_MEMORY; while ((IsLastNode(node)) && (!IsRoot(parent)) && (parent != common)) { if (bResetPromotion) @@ -1834,11 +1825,8 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, int32_t nsCOMPtr<nsIContent> content = do_QueryInterface(parent); if (content && content->IsHTMLElement()) { - bool isBlock = false; - parserService->IsBlock(parserService->HTMLAtomTagToId( - content->NodeInfo()->NameAtom()), isBlock); - if (isBlock) - { + if (nsHTMLElement::IsBlock(nsHTMLTags::AtomTagToId( + content->NodeInfo()->NameAtom()))) { bResetPromotion = false; } } diff --git a/dom/base/nsHTMLContentSerializer.cpp b/dom/base/nsHTMLContentSerializer.cpp index c135c4cf85..ea9c5a66ff 100644 --- a/dom/base/nsHTMLContentSerializer.cpp +++ b/dom/base/nsHTMLContentSerializer.cpp @@ -15,6 +15,7 @@ #include "nsIDOMElement.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsElementTable.h" #include "nsNameSpaceManager.h" #include "nsString.h" #include "nsUnicharUtils.h" @@ -347,20 +348,13 @@ nsHTMLContentSerializer::AppendElementEnd(Element* aElement, } if (ns == kNameSpaceID_XHTML) { - nsIParserService* parserService = nsContentUtils::GetParserService(); - - if (parserService) { - bool isContainer; - - parserService-> - IsContainer(parserService->HTMLCaseSensitiveAtomTagToId(name), - isContainer); - if (!isContainer) { - // Keep this in sync with the cleanup at the end of this method. - MOZ_ASSERT(name != nsGkAtoms::body); - MaybeLeaveFromPreContent(content); - return NS_OK; - } + bool isContainer = + nsHTMLElement::IsContainer(nsHTMLTags::CaseSensitiveAtomTagToId(name)); + if (!isContainer) { + // Keep this in sync with the cleanup at the end of this method. + MOZ_ASSERT(name != nsGkAtoms::body); + MaybeLeaveFromPreContent(content); + return NS_OK; } } diff --git a/dom/base/nsXHTMLContentSerializer.cpp b/dom/base/nsXHTMLContentSerializer.cpp index 0a39ef6636..aa330364b6 100755 --- a/dom/base/nsXHTMLContentSerializer.cpp +++ b/dom/base/nsXHTMLContentSerializer.cpp @@ -15,6 +15,7 @@ #include "nsIDOMElement.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsElementTable.h" #include "nsNameSpaceManager.h" #include "nsString.h" #include "nsUnicharUtils.h" @@ -27,7 +28,6 @@ #include "nsEscape.h" #include "nsITextToSubURI.h" #include "nsCRT.h" -#include "nsIParserService.h" #include "nsContentUtils.h" #include "nsLWBrkCIID.h" #include "nsIScriptElement.h" @@ -667,18 +667,7 @@ nsXHTMLContentSerializer::LineBreakBeforeOpen(int32_t aNamespaceID, nsIAtom* aNa aName == nsGkAtoms::html) { return true; } - else { - nsIParserService* parserService = nsContentUtils::GetParserService(); - - if (parserService) { - bool res; - parserService-> - IsBlock(parserService->HTMLCaseSensitiveAtomTagToId(aName), res); - return res; - } - } - - return mAddSpace; + return nsHTMLElement::IsBlock(nsHTMLTags::CaseSensitiveAtomTagToId(aName)); } bool @@ -761,18 +750,7 @@ nsXHTMLContentSerializer::LineBreakAfterClose(int32_t aNamespaceID, nsIAtom* aNa (aName == nsGkAtoms::div)) { return true; } - else { - nsIParserService* parserService = nsContentUtils::GetParserService(); - - if (parserService) { - bool res; - parserService-> - IsBlock(parserService->HTMLCaseSensitiveAtomTagToId(aName), res); - return res; - } - } - - return false; + return nsHTMLElement::IsBlock(nsHTMLTags::CaseSensitiveAtomTagToId(aName)); } diff --git a/dom/base/nsXMLContentSerializer.cpp b/dom/base/nsXMLContentSerializer.cpp index f12bb8fdc7..71a675e11b 100644 --- a/dom/base/nsXMLContentSerializer.cpp +++ b/dom/base/nsXMLContentSerializer.cpp @@ -19,7 +19,7 @@ #include "nsIContent.h" #include "nsIDocument.h" #include "nsIDocumentEncoder.h" -#include "nsIParserService.h" +#include "nsElementTable.h" #include "nsNameSpaceManager.h" #include "nsTextFragment.h" #include "nsString.h" @@ -994,14 +994,9 @@ ElementNeedsSeparateEndTag(Element* aElement, Element* aOriginalElement) // HTML container tags should have a separate end tag even if empty, per spec. // See // https://w3c.github.io/DOM-Parsing/#dfn-concept-xml-serialization-algorithm - bool isHTMLContainer = true; // Default in case we get no parser service. - nsIParserService* parserService = nsContentUtils::GetParserService(); - if (parserService) { - nsIAtom* localName = aElement->NodeInfo()->NameAtom(); - parserService->IsContainer( - parserService->HTMLCaseSensitiveAtomTagToId(localName), - isHTMLContainer); - } + nsIAtom* localName = aElement->NodeInfo()->NameAtom(); + bool isHTMLContainer = + nsHTMLElement::IsContainer(nsHTMLTags::CaseSensitiveAtomTagToId(localName)); return isHTMLContainer; } |