diff options
Diffstat (limited to 'parser/html/nsHtml5TreeBuilder.cpp')
-rw-r--r-- | parser/html/nsHtml5TreeBuilder.cpp | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/parser/html/nsHtml5TreeBuilder.cpp b/parser/html/nsHtml5TreeBuilder.cpp index f694116ba9..457c7deb11 100644 --- a/parser/html/nsHtml5TreeBuilder.cpp +++ b/parser/html/nsHtml5TreeBuilder.cpp @@ -34,7 +34,7 @@ #include "nsIAtom.h" #include "nsHtml5AtomTable.h" #include "nsITimer.h" -#include "nsString.h" +#include "nsHtml5String.h" #include "nsNameSpaceManager.h" #include "nsIContent.h" #include "nsTraceRefcnt.h" @@ -154,13 +154,16 @@ nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self) } void -nsHtml5TreeBuilder::doctype(nsIAtom* name, nsString* publicIdentifier, nsString* systemIdentifier, bool forceQuirks) +nsHtml5TreeBuilder::doctype(nsIAtom* name, + nsHtml5String publicIdentifier, + nsHtml5String systemIdentifier, + bool forceQuirks) { needToDropLF = false; if (!isInForeign() && mode == NS_HTML5TREE_BUILDER_INITIAL) { - nsString* emptyString = nsHtml5Portability::newEmptyString(); + nsHtml5String emptyString = nsHtml5Portability::newEmptyString(); appendDoctypeToDocument(!name ? nsHtml5Atoms::emptystring : name, !publicIdentifier ? emptyString : publicIdentifier, !systemIdentifier ? emptyString : systemIdentifier); - nsHtml5Portability::releaseString(emptyString); + emptyString.Release(); if (isQuirky(name, publicIdentifier, systemIdentifier, forceQuirks)) { errQuirkyDoctype(); documentModeInternal(QUIRKS_MODE, publicIdentifier, systemIdentifier, false); @@ -1990,8 +1993,9 @@ nsHtml5TreeBuilder::isSpecialParentInForeign(nsHtml5StackNode* stackNode) return (kNameSpaceID_XHTML == ns) || (stackNode->isHtmlIntegrationPoint()) || ((kNameSpaceID_MathML == ns) && (stackNode->getGroup() == NS_HTML5TREE_BUILDER_MI_MO_MN_MS_MTEXT)); } -nsString* -nsHtml5TreeBuilder::extractCharsetFromContent(nsString* attributeValue, nsHtml5TreeBuilder* tb) +nsHtml5String +nsHtml5TreeBuilder::extractCharsetFromContent(nsHtml5String attributeValue, + nsHtml5TreeBuilder* tb) { int32_t charsetState = NS_HTML5TREE_BUILDER_CHARSET_INITIAL; int32_t start = -1; @@ -2175,12 +2179,13 @@ nsHtml5TreeBuilder::extractCharsetFromContent(nsString* attributeValue, nsHtml5T } } charsetloop_end: ; - nsString* charset = nullptr; + nsHtml5String charset = nullptr; if (start != -1) { if (end == -1) { end = buffer.length; } - charset = nsHtml5Portability::newStringFromBuffer(buffer, start, end - start, tb); + charset = + nsHtml5Portability::newStringFromBuffer(buffer, start, end - start, tb); } return charset; } @@ -2188,7 +2193,8 @@ nsHtml5TreeBuilder::extractCharsetFromContent(nsString* attributeValue, nsHtml5T void nsHtml5TreeBuilder::checkMetaCharset(nsHtml5HtmlAttributes* attributes) { - nsString* charset = attributes->getValue(nsHtml5AttributeName::ATTR_CHARSET); + nsHtml5String charset = + attributes->getValue(nsHtml5AttributeName::ATTR_CHARSET); if (charset) { if (tokenizer->internalEncodingDeclaration(charset)) { requestSuspension(); @@ -2199,15 +2205,17 @@ nsHtml5TreeBuilder::checkMetaCharset(nsHtml5HtmlAttributes* attributes) if (!nsHtml5Portability::lowerCaseLiteralEqualsIgnoreAsciiCaseString("content-type", attributes->getValue(nsHtml5AttributeName::ATTR_HTTP_EQUIV))) { return; } - nsString* content = attributes->getValue(nsHtml5AttributeName::ATTR_CONTENT); + nsHtml5String content = + attributes->getValue(nsHtml5AttributeName::ATTR_CONTENT); if (content) { - nsString* extract = nsHtml5TreeBuilder::extractCharsetFromContent(content, this); + nsHtml5String extract = + nsHtml5TreeBuilder::extractCharsetFromContent(content, this); if (extract) { if (tokenizer->internalEncodingDeclaration(extract)) { requestSuspension(); } } - nsHtml5Portability::releaseString(extract); + extract.Release(); } } @@ -3208,7 +3216,11 @@ nsHtml5TreeBuilder::isSecondOnStackBody() } void -nsHtml5TreeBuilder::documentModeInternal(nsHtml5DocumentMode m, nsString* publicIdentifier, nsString* systemIdentifier, bool html4SpecificAdditionalErrorChecks) +nsHtml5TreeBuilder::documentModeInternal( + nsHtml5DocumentMode m, + nsHtml5String publicIdentifier, + nsHtml5String systemIdentifier, + bool html4SpecificAdditionalErrorChecks) { if (isSrcdocDocument) { quirks = false; @@ -3220,7 +3232,8 @@ nsHtml5TreeBuilder::documentModeInternal(nsHtml5DocumentMode m, nsString* public } bool -nsHtml5TreeBuilder::isAlmostStandards(nsString* publicIdentifier, nsString* systemIdentifier) +nsHtml5TreeBuilder::isAlmostStandards(nsHtml5String publicIdentifier, + nsHtml5String systemIdentifier) { if (nsHtml5Portability::lowerCaseLiteralEqualsIgnoreAsciiCaseString("-//w3c//dtd xhtml 1.0 transitional//en", publicIdentifier)) { return true; @@ -3240,7 +3253,10 @@ nsHtml5TreeBuilder::isAlmostStandards(nsString* publicIdentifier, nsString* syst } bool -nsHtml5TreeBuilder::isQuirky(nsIAtom* name, nsString* publicIdentifier, nsString* systemIdentifier, bool forceQuirks) +nsHtml5TreeBuilder::isQuirky(nsIAtom* name, + nsHtml5String publicIdentifier, + nsHtml5String systemIdentifier, + bool forceQuirks) { if (forceQuirks) { return true; @@ -4051,7 +4067,8 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterMathML(nsHtml5Elem bool nsHtml5TreeBuilder::annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attributes) { - nsString* encoding = attributes->getValue(nsHtml5AttributeName::ATTR_ENCODING); + nsHtml5String encoding = + attributes->getValue(nsHtml5AttributeName::ATTR_ENCODING); if (!encoding) { return false; } |