Commit c96d45b5 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Remove using directives ("using namespace x") from renderer/core/html/parser/.

Bug: 82078
Change-Id: I0b56a851bafdd9894bf8ccd44bf9a765f7170498
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1869828
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarYoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709075}
parent 2e57c5a4
...@@ -69,8 +69,6 @@ ...@@ -69,8 +69,6 @@
namespace blink { namespace blink {
using namespace html_names;
static const unsigned kMaximumHTMLParserDOMTreeDepth = 512; static const unsigned kMaximumHTMLParserDOMTreeDepth = 512;
static inline void SetAttributes(Element* element, static inline void SetAttributes(Element* element,
...@@ -86,11 +84,16 @@ static inline void SetAttributes(Element* element, ...@@ -86,11 +84,16 @@ static inline void SetAttributes(Element* element,
} }
static bool HasImpliedEndTag(const HTMLStackItem* item) { static bool HasImpliedEndTag(const HTMLStackItem* item) {
return item->HasTagName(kDdTag) || item->HasTagName(kDtTag) || return item->HasTagName(html_names::kDdTag) ||
item->HasTagName(kLiTag) || item->HasTagName(kOptionTag) || item->HasTagName(html_names::kDtTag) ||
item->HasTagName(kOptgroupTag) || item->HasTagName(kPTag) || item->HasTagName(html_names::kLiTag) ||
item->HasTagName(kRbTag) || item->HasTagName(kRpTag) || item->HasTagName(html_names::kOptionTag) ||
item->HasTagName(kRtTag) || item->HasTagName(kRTCTag); item->HasTagName(html_names::kOptgroupTag) ||
item->HasTagName(html_names::kPTag) ||
item->HasTagName(html_names::kRbTag) ||
item->HasTagName(html_names::kRpTag) ||
item->HasTagName(html_names::kRtTag) ||
item->HasTagName(html_names::kRTCTag);
} }
static bool ShouldUseLengthLimit(const ContainerNode& node) { static bool ShouldUseLengthLimit(const ContainerNode& node) {
...@@ -671,14 +674,14 @@ void HTMLConstructionSite::InsertCommentOnHTMLHtmlElement( ...@@ -671,14 +674,14 @@ void HTMLConstructionSite::InsertCommentOnHTMLHtmlElement(
void HTMLConstructionSite::InsertHTMLHeadElement(AtomicHTMLToken* token) { void HTMLConstructionSite::InsertHTMLHeadElement(AtomicHTMLToken* token) {
DCHECK(!ShouldFosterParent()); DCHECK(!ShouldFosterParent());
head_ = MakeGarbageCollected<HTMLStackItem>( head_ = MakeGarbageCollected<HTMLStackItem>(
CreateElement(token, xhtmlNamespaceURI), token); CreateElement(token, html_names::xhtmlNamespaceURI), token);
AttachLater(CurrentNode(), head_->GetElement()); AttachLater(CurrentNode(), head_->GetElement());
open_elements_.PushHTMLHeadElement(head_); open_elements_.PushHTMLHeadElement(head_);
} }
void HTMLConstructionSite::InsertHTMLBodyElement(AtomicHTMLToken* token) { void HTMLConstructionSite::InsertHTMLBodyElement(AtomicHTMLToken* token) {
DCHECK(!ShouldFosterParent()); DCHECK(!ShouldFosterParent());
Element* body = CreateElement(token, xhtmlNamespaceURI); Element* body = CreateElement(token, html_names::xhtmlNamespaceURI);
AttachLater(CurrentNode(), body); AttachLater(CurrentNode(), body);
open_elements_.PushHTMLBodyElement( open_elements_.PushHTMLBodyElement(
MakeGarbageCollected<HTMLStackItem>(body, token)); MakeGarbageCollected<HTMLStackItem>(body, token));
...@@ -689,7 +692,7 @@ void HTMLConstructionSite::InsertHTMLBodyElement(AtomicHTMLToken* token) { ...@@ -689,7 +692,7 @@ void HTMLConstructionSite::InsertHTMLBodyElement(AtomicHTMLToken* token) {
void HTMLConstructionSite::InsertHTMLFormElement(AtomicHTMLToken* token, void HTMLConstructionSite::InsertHTMLFormElement(AtomicHTMLToken* token,
bool is_demoted) { bool is_demoted) {
auto* form_element = auto* form_element =
To<HTMLFormElement>(CreateElement(token, xhtmlNamespaceURI)); To<HTMLFormElement>(CreateElement(token, html_names::xhtmlNamespaceURI));
if (!OpenElements()->HasTemplateInHTMLScope()) if (!OpenElements()->HasTemplateInHTMLScope())
form_ = form_element; form_ = form_element;
if (is_demoted) { if (is_demoted) {
...@@ -701,7 +704,7 @@ void HTMLConstructionSite::InsertHTMLFormElement(AtomicHTMLToken* token, ...@@ -701,7 +704,7 @@ void HTMLConstructionSite::InsertHTMLFormElement(AtomicHTMLToken* token,
} }
void HTMLConstructionSite::InsertHTMLElement(AtomicHTMLToken* token) { void HTMLConstructionSite::InsertHTMLElement(AtomicHTMLToken* token) {
Element* element = CreateElement(token, xhtmlNamespaceURI); Element* element = CreateElement(token, html_names::xhtmlNamespaceURI);
AttachLater(CurrentNode(), element); AttachLater(CurrentNode(), element);
open_elements_.Push(MakeGarbageCollected<HTMLStackItem>(element, token)); open_elements_.Push(MakeGarbageCollected<HTMLStackItem>(element, token));
} }
...@@ -712,7 +715,8 @@ void HTMLConstructionSite::InsertSelfClosingHTMLElementDestroyingToken( ...@@ -712,7 +715,8 @@ void HTMLConstructionSite::InsertSelfClosingHTMLElementDestroyingToken(
// Normally HTMLElementStack is responsible for calling finishParsingChildren, // Normally HTMLElementStack is responsible for calling finishParsingChildren,
// but self-closing elements are never in the element stack so the stack // but self-closing elements are never in the element stack so the stack
// doesn't get a chance to tell them that we're done parsing their children. // doesn't get a chance to tell them that we're done parsing their children.
AttachLater(CurrentNode(), CreateElement(token, xhtmlNamespaceURI), true); AttachLater(CurrentNode(),
CreateElement(token, html_names::xhtmlNamespaceURI), true);
// FIXME: Do we want to acknowledge the token's self-closing flag? // FIXME: Do we want to acknowledge the token's self-closing flag?
// http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#acknowledge-self-closing-flag // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#acknowledge-self-closing-flag
} }
...@@ -1066,11 +1070,11 @@ bool HTMLConstructionSite::InQuirksMode() { ...@@ -1066,11 +1070,11 @@ bool HTMLConstructionSite::InQuirksMode() {
void HTMLConstructionSite::FindFosterSite(HTMLConstructionSiteTask& task) { void HTMLConstructionSite::FindFosterSite(HTMLConstructionSiteTask& task) {
// 2.1 // 2.1
HTMLElementStack::ElementRecord* last_template = HTMLElementStack::ElementRecord* last_template =
open_elements_.Topmost(kTemplateTag.LocalName()); open_elements_.Topmost(html_names::kTemplateTag.LocalName());
// 2.2 // 2.2
HTMLElementStack::ElementRecord* last_table = HTMLElementStack::ElementRecord* last_table =
open_elements_.Topmost(kTableTag.LocalName()); open_elements_.Topmost(html_names::kTableTag.LocalName());
// 2.3 // 2.3
if (last_template && (!last_table || last_template->IsAbove(last_table))) { if (last_template && (!last_table || last_template->IsAbove(last_table))) {
......
...@@ -70,8 +70,6 @@ ...@@ -70,8 +70,6 @@
namespace blink { namespace blink {
using namespace html_names;
// This is a direct transcription of step 4 from: // This is a direct transcription of step 4 from:
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#fragment-case // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#fragment-case
static HTMLTokenizer::State TokenizerStateForContextElement( static HTMLTokenizer::State TokenizerStateForContextElement(
...@@ -83,18 +81,22 @@ static HTMLTokenizer::State TokenizerStateForContextElement( ...@@ -83,18 +81,22 @@ static HTMLTokenizer::State TokenizerStateForContextElement(
const QualifiedName& context_tag = context_element->TagQName(); const QualifiedName& context_tag = context_element->TagQName();
if (context_tag.Matches(kTitleTag) || context_tag.Matches(kTextareaTag)) if (context_tag.Matches(html_names::kTitleTag) ||
context_tag.Matches(html_names::kTextareaTag))
return HTMLTokenizer::kRCDATAState; return HTMLTokenizer::kRCDATAState;
if (context_tag.Matches(kStyleTag) || context_tag.Matches(kXmpTag) || if (context_tag.Matches(html_names::kStyleTag) ||
context_tag.Matches(kIFrameTag) || context_tag.Matches(kNoembedTag) || context_tag.Matches(html_names::kXmpTag) ||
(context_tag.Matches(kNoscriptTag) && options.script_enabled) || context_tag.Matches(html_names::kIFrameTag) ||
context_tag.Matches(kNoframesTag)) context_tag.Matches(html_names::kNoembedTag) ||
(context_tag.Matches(html_names::kNoscriptTag) &&
options.script_enabled) ||
context_tag.Matches(html_names::kNoframesTag))
return report_errors ? HTMLTokenizer::kRAWTEXTState return report_errors ? HTMLTokenizer::kRAWTEXTState
: HTMLTokenizer::kPLAINTEXTState; : HTMLTokenizer::kPLAINTEXTState;
if (context_tag.Matches(kScriptTag)) if (context_tag.Matches(html_names::kScriptTag))
return report_errors ? HTMLTokenizer::kScriptDataState return report_errors ? HTMLTokenizer::kScriptDataState
: HTMLTokenizer::kPLAINTEXTState; : HTMLTokenizer::kPLAINTEXTState;
if (context_tag.Matches(kPlaintextTag)) if (context_tag.Matches(html_names::kPlaintextTag))
return HTMLTokenizer::kPLAINTEXTState; return HTMLTokenizer::kPLAINTEXTState;
return HTMLTokenizer::kDataState; return HTMLTokenizer::kDataState;
} }
......
...@@ -36,19 +36,22 @@ ...@@ -36,19 +36,22 @@
namespace blink { namespace blink {
using namespace html_names;
namespace { namespace {
inline bool IsRootNode(HTMLStackItem* item) { inline bool IsRootNode(HTMLStackItem* item) {
return item->IsDocumentFragmentNode() || item->HasTagName(kHTMLTag); return item->IsDocumentFragmentNode() ||
item->HasTagName(html_names::kHTMLTag);
} }
inline bool IsScopeMarker(HTMLStackItem* item) { inline bool IsScopeMarker(HTMLStackItem* item) {
return item->HasTagName(kAppletTag) || item->HasTagName(kCaptionTag) || return item->HasTagName(html_names::kAppletTag) ||
item->HasTagName(kMarqueeTag) || item->HasTagName(kObjectTag) || item->HasTagName(html_names::kCaptionTag) ||
item->HasTagName(kTableTag) || item->HasTagName(kTdTag) || item->HasTagName(html_names::kMarqueeTag) ||
item->HasTagName(kThTag) || item->HasTagName(mathml_names::kMiTag) || item->HasTagName(html_names::kObjectTag) ||
item->HasTagName(html_names::kTableTag) ||
item->HasTagName(html_names::kTdTag) ||
item->HasTagName(html_names::kThTag) ||
item->HasTagName(mathml_names::kMiTag) ||
item->HasTagName(mathml_names::kMoTag) || item->HasTagName(mathml_names::kMoTag) ||
item->HasTagName(mathml_names::kMnTag) || item->HasTagName(mathml_names::kMnTag) ||
item->HasTagName(mathml_names::kMsTag) || item->HasTagName(mathml_names::kMsTag) ||
...@@ -57,28 +60,29 @@ inline bool IsScopeMarker(HTMLStackItem* item) { ...@@ -57,28 +60,29 @@ inline bool IsScopeMarker(HTMLStackItem* item) {
item->HasTagName(svg_names::kForeignObjectTag) || item->HasTagName(svg_names::kForeignObjectTag) ||
item->HasTagName(svg_names::kDescTag) || item->HasTagName(svg_names::kDescTag) ||
item->HasTagName(svg_names::kTitleTag) || item->HasTagName(svg_names::kTitleTag) ||
item->HasTagName(kTemplateTag) || IsRootNode(item); item->HasTagName(html_names::kTemplateTag) || IsRootNode(item);
} }
inline bool IsListItemScopeMarker(HTMLStackItem* item) { inline bool IsListItemScopeMarker(HTMLStackItem* item) {
return IsScopeMarker(item) || item->HasTagName(kOlTag) || return IsScopeMarker(item) || item->HasTagName(html_names::kOlTag) ||
item->HasTagName(kUlTag); item->HasTagName(html_names::kUlTag);
} }
inline bool IsTableScopeMarker(HTMLStackItem* item) { inline bool IsTableScopeMarker(HTMLStackItem* item) {
return item->HasTagName(kTableTag) || item->HasTagName(kTemplateTag) || return item->HasTagName(html_names::kTableTag) ||
IsRootNode(item); item->HasTagName(html_names::kTemplateTag) || IsRootNode(item);
} }
inline bool IsTableBodyScopeMarker(HTMLStackItem* item) { inline bool IsTableBodyScopeMarker(HTMLStackItem* item) {
return item->HasTagName(kTbodyTag) || item->HasTagName(kTfootTag) || return item->HasTagName(html_names::kTbodyTag) ||
item->HasTagName(kTheadTag) || item->HasTagName(kTemplateTag) || item->HasTagName(html_names::kTfootTag) ||
IsRootNode(item); item->HasTagName(html_names::kTheadTag) ||
item->HasTagName(html_names::kTemplateTag) || IsRootNode(item);
} }
inline bool IsTableRowScopeMarker(HTMLStackItem* item) { inline bool IsTableRowScopeMarker(HTMLStackItem* item) {
return item->HasTagName(kTrTag) || item->HasTagName(kTemplateTag) || return item->HasTagName(html_names::kTrTag) ||
IsRootNode(item); item->HasTagName(html_names::kTemplateTag) || IsRootNode(item);
} }
inline bool IsForeignContentScopeMarker(HTMLStackItem* item) { inline bool IsForeignContentScopeMarker(HTMLStackItem* item) {
...@@ -88,11 +92,12 @@ inline bool IsForeignContentScopeMarker(HTMLStackItem* item) { ...@@ -88,11 +92,12 @@ inline bool IsForeignContentScopeMarker(HTMLStackItem* item) {
} }
inline bool IsButtonScopeMarker(HTMLStackItem* item) { inline bool IsButtonScopeMarker(HTMLStackItem* item) {
return IsScopeMarker(item) || item->HasTagName(kButtonTag); return IsScopeMarker(item) || item->HasTagName(html_names::kButtonTag);
} }
inline bool IsSelectScopeMarker(HTMLStackItem* item) { inline bool IsSelectScopeMarker(HTMLStackItem* item) {
return !item->HasTagName(kOptgroupTag) && !item->HasTagName(kOptionTag); return !item->HasTagName(html_names::kOptgroupTag) &&
!item->HasTagName(html_names::kOptionTag);
} }
} // namespace } // namespace
...@@ -267,7 +272,7 @@ void HTMLElementStack::PushRootNode(HTMLStackItem* root_item) { ...@@ -267,7 +272,7 @@ void HTMLElementStack::PushRootNode(HTMLStackItem* root_item) {
} }
void HTMLElementStack::PushHTMLHtmlElement(HTMLStackItem* item) { void HTMLElementStack::PushHTMLHtmlElement(HTMLStackItem* item) {
DCHECK(item->HasTagName(kHTMLTag)); DCHECK(item->HasTagName(html_names::kHTMLTag));
PushRootNodeCommon(item); PushRootNodeCommon(item);
} }
...@@ -293,9 +298,9 @@ void HTMLElementStack::PushHTMLBodyElement(HTMLStackItem* item) { ...@@ -293,9 +298,9 @@ void HTMLElementStack::PushHTMLBodyElement(HTMLStackItem* item) {
} }
void HTMLElementStack::Push(HTMLStackItem* item) { void HTMLElementStack::Push(HTMLStackItem* item) {
DCHECK(!item->HasTagName(kHTMLTag)); DCHECK(!item->HasTagName(html_names::kHTMLTag));
DCHECK(!item->HasTagName(kHeadTag)); DCHECK(!item->HasTagName(html_names::kHeadTag));
DCHECK(!item->HasTagName(kBodyTag)); DCHECK(!item->HasTagName(html_names::kBodyTag));
DCHECK(root_node_); DCHECK(root_node_);
PushCommon(item); PushCommon(item);
} }
...@@ -305,9 +310,9 @@ void HTMLElementStack::InsertAbove(HTMLStackItem* item, ...@@ -305,9 +310,9 @@ void HTMLElementStack::InsertAbove(HTMLStackItem* item,
DCHECK(item); DCHECK(item);
DCHECK(record_below); DCHECK(record_below);
DCHECK(top_); DCHECK(top_);
DCHECK(!item->HasTagName(kHTMLTag)); DCHECK(!item->HasTagName(html_names::kHTMLTag));
DCHECK(!item->HasTagName(kHeadTag)); DCHECK(!item->HasTagName(html_names::kHeadTag));
DCHECK(!item->HasTagName(kBodyTag)); DCHECK(!item->HasTagName(html_names::kBodyTag));
DCHECK(root_node_); DCHECK(root_node_);
if (record_below == top_) { if (record_below == top_) {
Push(item); Push(item);
...@@ -466,7 +471,8 @@ bool HTMLElementStack::InSelectScope(const QualifiedName& tag_name) const { ...@@ -466,7 +471,8 @@ bool HTMLElementStack::InSelectScope(const QualifiedName& tag_name) const {
} }
bool HTMLElementStack::HasTemplateInHTMLScope() const { bool HTMLElementStack::HasTemplateInHTMLScope() const {
return InScopeCommon<IsRootNode>(top_.Get(), kTemplateTag.LocalName()); return InScopeCommon<IsRootNode>(top_.Get(),
html_names::kTemplateTag.LocalName());
} }
Element* HTMLElementStack::HtmlElement() const { Element* HTMLElementStack::HtmlElement() const {
...@@ -497,9 +503,9 @@ void HTMLElementStack::PushCommon(HTMLStackItem* item) { ...@@ -497,9 +503,9 @@ void HTMLElementStack::PushCommon(HTMLStackItem* item) {
} }
void HTMLElementStack::PopCommon() { void HTMLElementStack::PopCommon() {
DCHECK(!TopStackItem()->HasTagName(kHTMLTag)); DCHECK(!TopStackItem()->HasTagName(html_names::kHTMLTag));
DCHECK(!TopStackItem()->HasTagName(kHeadTag) || !head_element_); DCHECK(!TopStackItem()->HasTagName(html_names::kHeadTag) || !head_element_);
DCHECK(!TopStackItem()->HasTagName(kBodyTag) || !body_element_); DCHECK(!TopStackItem()->HasTagName(html_names::kBodyTag) || !body_element_);
Top()->FinishParsingChildren(); Top()->FinishParsingChildren();
top_ = top_->ReleaseNext(); top_ = top_->ReleaseNext();
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
namespace blink { namespace blink {
using namespace html_names;
HTMLMetaCharsetParser::HTMLMetaCharsetParser() HTMLMetaCharsetParser::HTMLMetaCharsetParser()
: tokenizer_(std::make_unique<HTMLTokenizer>(HTMLParserOptions(nullptr))), : tokenizer_(std::make_unique<HTMLTokenizer>(HTMLParserOptions(nullptr))),
assumed_codec_(NewTextCodec(Latin1Encoding())), assumed_codec_(NewTextCodec(Latin1Encoding())),
...@@ -94,22 +92,22 @@ bool HTMLMetaCharsetParser::CheckForMetaCharset(const char* data, ...@@ -94,22 +92,22 @@ bool HTMLMetaCharsetParser::CheckForMetaCharset(const char* data,
AttemptStaticStringCreation(token_.GetName(), kLikely8Bit); AttemptStaticStringCreation(token_.GetName(), kLikely8Bit);
if (!end) { if (!end) {
tokenizer_->UpdateStateFor(tag_name); tokenizer_->UpdateStateFor(tag_name);
if (ThreadSafeMatch(tag_name, kMetaTag) && ProcessMeta()) { if (ThreadSafeMatch(tag_name, html_names::kMetaTag) && ProcessMeta()) {
done_checking_ = true; done_checking_ = true;
return true; return true;
} }
} }
if (!ThreadSafeMatch(tag_name, kScriptTag) && if (!ThreadSafeMatch(tag_name, html_names::kScriptTag) &&
!ThreadSafeMatch(tag_name, kNoscriptTag) && !ThreadSafeMatch(tag_name, html_names::kNoscriptTag) &&
!ThreadSafeMatch(tag_name, kStyleTag) && !ThreadSafeMatch(tag_name, html_names::kStyleTag) &&
!ThreadSafeMatch(tag_name, kLinkTag) && !ThreadSafeMatch(tag_name, html_names::kLinkTag) &&
!ThreadSafeMatch(tag_name, kMetaTag) && !ThreadSafeMatch(tag_name, html_names::kMetaTag) &&
!ThreadSafeMatch(tag_name, kObjectTag) && !ThreadSafeMatch(tag_name, html_names::kObjectTag) &&
!ThreadSafeMatch(tag_name, kTitleTag) && !ThreadSafeMatch(tag_name, html_names::kTitleTag) &&
!ThreadSafeMatch(tag_name, kBaseTag) && !ThreadSafeMatch(tag_name, html_names::kBaseTag) &&
(end || !ThreadSafeMatch(tag_name, kHTMLTag)) && (end || !ThreadSafeMatch(tag_name, html_names::kHTMLTag)) &&
(end || !ThreadSafeMatch(tag_name, kHeadTag))) { (end || !ThreadSafeMatch(tag_name, html_names::kHeadTag))) {
in_head_section_ = false; in_head_section_ = false;
} }
} }
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
namespace blink { namespace blink {
using namespace html_names;
template <typename CharType> template <typename CharType>
static String StripLeadingAndTrailingHTMLSpaces(String string, static String StripLeadingAndTrailingHTMLSpaces(String string,
const CharType* characters, const CharType* characters,
...@@ -380,14 +378,15 @@ WTF::TextEncoding EncodingFromMetaAttributes( ...@@ -380,14 +378,15 @@ WTF::TextEncoding EncodingFromMetaAttributes(
const String& attribute_name = html_attribute.first; const String& attribute_name = html_attribute.first;
const AtomicString& attribute_value = AtomicString(html_attribute.second); const AtomicString& attribute_value = AtomicString(html_attribute.second);
if (ThreadSafeMatch(attribute_name, kHttpEquivAttr)) { if (ThreadSafeMatch(attribute_name, html_names::kHttpEquivAttr)) {
if (DeprecatedEqualIgnoringCase(attribute_value, "content-type")) if (DeprecatedEqualIgnoringCase(attribute_value, "content-type"))
got_pragma = true; got_pragma = true;
} else if (ThreadSafeMatch(attribute_name, kCharsetAttr)) { } else if (ThreadSafeMatch(attribute_name, html_names::kCharsetAttr)) {
has_charset = true; has_charset = true;
charset = attribute_value; charset = attribute_value;
mode = MetaAttribute::kCharset; mode = MetaAttribute::kCharset;
} else if (!has_charset && ThreadSafeMatch(attribute_name, kContentAttr)) { } else if (!has_charset &&
ThreadSafeMatch(attribute_name, html_names::kContentAttr)) {
charset = ExtractCharset(attribute_value); charset = ExtractCharset(attribute_value);
if (charset.length()) if (charset.length())
mode = MetaAttribute::kPragma; mode = MetaAttribute::kPragma;
......
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
namespace blink { namespace blink {
using namespace html_names;
static inline UChar ToLowerCase(UChar cc) { static inline UChar ToLowerCase(UChar cc) {
DCHECK(IsASCIIAlpha(cc)); DCHECK(IsASCIIAlpha(cc));
return cc | 0x20; return cc | 0x20;
...@@ -603,7 +601,7 @@ bool HTMLTokenizer::NextToken(SegmentedString& source, HTMLToken& token) { ...@@ -603,7 +601,7 @@ bool HTMLTokenizer::NextToken(SegmentedString& source, HTMLToken& token) {
HTML_BEGIN_STATE(kScriptDataDoubleEscapeStartState) { HTML_BEGIN_STATE(kScriptDataDoubleEscapeStartState) {
if (IsTokenizerWhitespace(cc) || cc == '/' || cc == '>') { if (IsTokenizerWhitespace(cc) || cc == '/' || cc == '>') {
BufferCharacter(cc); BufferCharacter(cc);
if (TemporaryBufferIs(kScriptTag.LocalName())) if (TemporaryBufferIs(html_names::kScriptTag.LocalName()))
HTML_ADVANCE_TO(kScriptDataDoubleEscapedState); HTML_ADVANCE_TO(kScriptDataDoubleEscapedState);
else else
HTML_ADVANCE_TO(kScriptDataEscapedState); HTML_ADVANCE_TO(kScriptDataEscapedState);
...@@ -683,7 +681,7 @@ bool HTMLTokenizer::NextToken(SegmentedString& source, HTMLToken& token) { ...@@ -683,7 +681,7 @@ bool HTMLTokenizer::NextToken(SegmentedString& source, HTMLToken& token) {
HTML_BEGIN_STATE(kScriptDataDoubleEscapeEndState) { HTML_BEGIN_STATE(kScriptDataDoubleEscapeEndState) {
if (IsTokenizerWhitespace(cc) || cc == '/' || cc == '>') { if (IsTokenizerWhitespace(cc) || cc == '/' || cc == '>') {
BufferCharacter(cc); BufferCharacter(cc);
if (TemporaryBufferIs(kScriptTag.LocalName())) if (TemporaryBufferIs(html_names::kScriptTag.LocalName()))
HTML_ADVANCE_TO(kScriptDataEscapedState); HTML_ADVANCE_TO(kScriptDataEscapedState);
else else
HTML_ADVANCE_TO(kScriptDataDoubleEscapedState); HTML_ADVANCE_TO(kScriptDataDoubleEscapedState);
...@@ -1454,19 +1452,20 @@ String HTMLTokenizer::BufferedCharacters() const { ...@@ -1454,19 +1452,20 @@ String HTMLTokenizer::BufferedCharacters() const {
} }
void HTMLTokenizer::UpdateStateFor(const String& tag_name) { void HTMLTokenizer::UpdateStateFor(const String& tag_name) {
if (ThreadSafeMatch(tag_name, kTextareaTag) || if (ThreadSafeMatch(tag_name, html_names::kTextareaTag) ||
ThreadSafeMatch(tag_name, kTitleTag)) ThreadSafeMatch(tag_name, html_names::kTitleTag))
SetState(HTMLTokenizer::kRCDATAState); SetState(HTMLTokenizer::kRCDATAState);
else if (ThreadSafeMatch(tag_name, kPlaintextTag)) else if (ThreadSafeMatch(tag_name, html_names::kPlaintextTag))
SetState(HTMLTokenizer::kPLAINTEXTState); SetState(HTMLTokenizer::kPLAINTEXTState);
else if (ThreadSafeMatch(tag_name, kScriptTag)) else if (ThreadSafeMatch(tag_name, html_names::kScriptTag))
SetState(HTMLTokenizer::kScriptDataState); SetState(HTMLTokenizer::kScriptDataState);
else if (ThreadSafeMatch(tag_name, kStyleTag) || else if (ThreadSafeMatch(tag_name, html_names::kStyleTag) ||
ThreadSafeMatch(tag_name, kIFrameTag) || ThreadSafeMatch(tag_name, html_names::kIFrameTag) ||
ThreadSafeMatch(tag_name, kXmpTag) || ThreadSafeMatch(tag_name, html_names::kXmpTag) ||
ThreadSafeMatch(tag_name, kNoembedTag) || ThreadSafeMatch(tag_name, html_names::kNoembedTag) ||
ThreadSafeMatch(tag_name, kNoframesTag) || ThreadSafeMatch(tag_name, html_names::kNoframesTag) ||
(ThreadSafeMatch(tag_name, kNoscriptTag) && options_.script_enabled)) (ThreadSafeMatch(tag_name, html_names::kNoscriptTag) &&
options_.script_enabled))
SetState(HTMLTokenizer::kRAWTEXTState); SetState(HTMLTokenizer::kRAWTEXTState);
} }
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
namespace blink { namespace blink {
using namespace html_names;
TextDocumentParser::TextDocumentParser(HTMLDocument& document, TextDocumentParser::TextDocumentParser(HTMLDocument& document,
ParserSynchronizationPolicy sync_policy) ParserSynchronizationPolicy sync_policy)
: HTMLDocumentParser(document, sync_policy), : HTMLDocumentParser(document, sync_policy),
...@@ -55,10 +53,10 @@ void TextDocumentParser::InsertFakePreElement() { ...@@ -55,10 +53,10 @@ void TextDocumentParser::InsertFakePreElement() {
// fake bytes through the front-end of the parser to avoid distrubing the // fake bytes through the front-end of the parser to avoid distrubing the
// line/column number calculations. // line/column number calculations.
Vector<Attribute> attributes; Vector<Attribute> attributes;
attributes.push_back( attributes.push_back(Attribute(
Attribute(kStyleAttr, "word-wrap: break-word; white-space: pre-wrap;")); html_names::kStyleAttr, "word-wrap: break-word; white-space: pre-wrap;"));
AtomicHTMLToken fake_pre(HTMLToken::kStartTag, kPreTag.LocalName(), AtomicHTMLToken fake_pre(HTMLToken::kStartTag,
attributes); html_names::kPreTag.LocalName(), attributes);
TreeBuilder()->ConstructTree(&fake_pre); TreeBuilder()->ConstructTree(&fake_pre);
// The document could have been detached by an extension while the // The document could have been detached by an extension while the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment