diff options
Diffstat (limited to 'parser/html/nsHtml5TreeBuilder.cpp')
-rw-r--r-- | parser/html/nsHtml5TreeBuilder.cpp | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/parser/html/nsHtml5TreeBuilder.cpp b/parser/html/nsHtml5TreeBuilder.cpp index ec84c391e..cea78839c 100644 --- a/parser/html/nsHtml5TreeBuilder.cpp +++ b/parser/html/nsHtml5TreeBuilder.cpp @@ -1,7 +1,8 @@ /* * Copyright (c) 2007 Henri Sivonen * Copyright (c) 2007-2015 Mozilla Foundation - * Copyright (c) 2020 Moonchild Productions + * Copyright (c) 2018-2020 Moonchild Productions + * Copyright (c) 2020 Binary Outcast * Portions of comments Copyright 2004-2008 Apple Computer, Inc., Mozilla * Foundation, and Opera Software ASA. * @@ -131,12 +132,7 @@ nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self) formPointer = getFormPointerForContext(contextNode); if (nsHtml5Atoms::title == contextName || nsHtml5Atoms::textarea == contextName) { tokenizer->setState(NS_HTML5TOKENIZER_RCDATA); - } else if (nsHtml5Atoms::style == contextName || - nsHtml5Atoms::xmp == contextName || - nsHtml5Atoms::iframe == contextName || - nsHtml5Atoms::noembed == contextName || - nsHtml5Atoms::noframes == contextName || - (scriptingEnabled && nsHtml5Atoms::noscript == contextName)) { + } else if (nsHtml5Atoms::style == contextName || nsHtml5Atoms::xmp == contextName || nsHtml5Atoms::iframe == contextName || nsHtml5Atoms::noembed == contextName || nsHtml5Atoms::noframes == contextName || (scriptingEnabled && nsHtml5Atoms::noscript == contextName)) { tokenizer->setState(NS_HTML5TOKENIZER_RAWTEXT); } else if (nsHtml5Atoms::plaintext == contextName) { tokenizer->setState(NS_HTML5TOKENIZER_PLAINTEXT); @@ -160,10 +156,7 @@ nsHtml5TreeBuilder::startTokenization(nsHtml5Tokenizer* self) } void -nsHtml5TreeBuilder::doctype(nsIAtom* name, - nsHtml5String publicIdentifier, - nsHtml5String systemIdentifier, - bool forceQuirks) +nsHtml5TreeBuilder::doctype(nsIAtom* name, nsHtml5String publicIdentifier, nsHtml5String systemIdentifier, bool forceQuirks) { needToDropLF = false; if (!isInForeign() && mode == NS_HTML5TREE_BUILDER_INITIAL) { @@ -2000,8 +1993,7 @@ nsHtml5TreeBuilder::isSpecialParentInForeign(nsHtml5StackNode* stackNode) } nsHtml5String -nsHtml5TreeBuilder::extractCharsetFromContent(nsHtml5String attributeValue, - nsHtml5TreeBuilder* tb) +nsHtml5TreeBuilder::extractCharsetFromContent(nsHtml5String attributeValue, nsHtml5TreeBuilder* tb) { int32_t charsetState = NS_HTML5TREE_BUILDER_CHARSET_INITIAL; int32_t start = -1; @@ -2190,8 +2182,7 @@ nsHtml5TreeBuilder::extractCharsetFromContent(nsHtml5String attributeValue, if (end == -1) { end = buffer.length; } - charset = - nsHtml5Portability::newStringFromBuffer(buffer, start, end - start, tb); + charset = nsHtml5Portability::newStringFromBuffer(buffer, start, end - start, tb); } return charset; } @@ -2199,8 +2190,7 @@ nsHtml5TreeBuilder::extractCharsetFromContent(nsHtml5String attributeValue, void nsHtml5TreeBuilder::checkMetaCharset(nsHtml5HtmlAttributes* attributes) { - nsHtml5String charset = - attributes->getValue(nsHtml5AttributeName::ATTR_CHARSET); + nsHtml5String charset = attributes->getValue(nsHtml5AttributeName::ATTR_CHARSET); if (charset) { if (tokenizer->internalEncodingDeclaration(charset)) { requestSuspension(); @@ -2211,11 +2201,9 @@ nsHtml5TreeBuilder::checkMetaCharset(nsHtml5HtmlAttributes* attributes) if (!nsHtml5Portability::lowerCaseLiteralEqualsIgnoreAsciiCaseString("content-type", attributes->getValue(nsHtml5AttributeName::ATTR_HTTP_EQUIV))) { return; } - nsHtml5String content = - attributes->getValue(nsHtml5AttributeName::ATTR_CONTENT); + nsHtml5String content = attributes->getValue(nsHtml5AttributeName::ATTR_CONTENT); if (content) { - nsHtml5String extract = - nsHtml5TreeBuilder::extractCharsetFromContent(content, this); + nsHtml5String extract = nsHtml5TreeBuilder::extractCharsetFromContent(content, this); if (extract) { if (tokenizer->internalEncodingDeclaration(extract)) { requestSuspension(); @@ -3222,11 +3210,7 @@ nsHtml5TreeBuilder::isSecondOnStackBody() } void -nsHtml5TreeBuilder::documentModeInternal( - nsHtml5DocumentMode m, - nsHtml5String publicIdentifier, - nsHtml5String systemIdentifier, - bool html4SpecificAdditionalErrorChecks) +nsHtml5TreeBuilder::documentModeInternal(nsHtml5DocumentMode m, nsHtml5String publicIdentifier, nsHtml5String systemIdentifier, bool html4SpecificAdditionalErrorChecks) { if (isSrcdocDocument) { quirks = false; @@ -3238,8 +3222,7 @@ nsHtml5TreeBuilder::documentModeInternal( } bool -nsHtml5TreeBuilder::isAlmostStandards(nsHtml5String publicIdentifier, - nsHtml5String systemIdentifier) +nsHtml5TreeBuilder::isAlmostStandards(nsHtml5String publicIdentifier, nsHtml5String systemIdentifier) { if (nsHtml5Portability::lowerCaseLiteralEqualsIgnoreAsciiCaseString("-//w3c//dtd xhtml 1.0 transitional//en", publicIdentifier)) { return true; @@ -3259,10 +3242,7 @@ nsHtml5TreeBuilder::isAlmostStandards(nsHtml5String publicIdentifier, } bool -nsHtml5TreeBuilder::isQuirky(nsIAtom* name, - nsHtml5String publicIdentifier, - nsHtml5String systemIdentifier, - bool forceQuirks) +nsHtml5TreeBuilder::isQuirky(nsIAtom* name, nsHtml5String publicIdentifier, nsHtml5String systemIdentifier, bool forceQuirks) { if (forceQuirks) { return true; @@ -4073,8 +4053,7 @@ nsHtml5TreeBuilder::appendToCurrentNodeAndPushElementMayFosterMathML(nsHtml5Elem bool nsHtml5TreeBuilder::annotationXmlEncodingPermitsHtml(nsHtml5HtmlAttributes* attributes) { - nsHtml5String encoding = - attributes->getValue(nsHtml5AttributeName::ATTR_ENCODING); + nsHtml5String encoding = attributes->getValue(nsHtml5AttributeName::ATTR_ENCODING); if (!encoding) { return false; } |