Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: sky/engine/core/html/parser/BackgroundHTMLParser.cpp

Issue 814173005: The Sky parser should yield before start tags (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/engine/core/html/parser/BackgroundHTMLParser.cpp
diff --git a/sky/engine/core/html/parser/BackgroundHTMLParser.cpp b/sky/engine/core/html/parser/BackgroundHTMLParser.cpp
index 18366001badcf6cd7a339a991c57f352b2d627ee..b852e80c3f80ac0b48e1388d03c7d9fbd1e5f099 100644
--- a/sky/engine/core/html/parser/BackgroundHTMLParser.cpp
+++ b/sky/engine/core/html/parser/BackgroundHTMLParser.cpp
@@ -60,7 +60,8 @@ base::WeakPtr<BackgroundHTMLParser> BackgroundHTMLParser::create(PassOwnPtr<Back
}
BackgroundHTMLParser::BackgroundHTMLParser(PassOwnPtr<Configuration> config)
- : m_token(adoptPtr(new HTMLToken))
+ : m_state(InitialState)
+ , m_token(adoptPtr(new HTMLToken))
, m_tokenizer(HTMLTokenizer::create())
, m_parser(config->parser)
, m_pendingTokens(adoptPtr(new CompactHTMLTokenStream))
@@ -116,8 +117,20 @@ bool BackgroundHTMLParser::updateTokenizerState(const CompactHTMLToken& token)
{
if (token.type() == HTMLToken::StartTag) {
const String& tagName = token.data();
+
if (threadSafeMatch(tagName, HTMLNames::scriptTag) || threadSafeMatch(tagName, HTMLNames::styleTag))
m_tokenizer->setState(HTMLTokenizer::RawDataState);
+
+ if (threadSafeMatch(tagName, HTMLNames::importTag)) {
+ m_state = DidSeeImportState;
+ return true;
+ }
+
+ if (m_state == InitialState)
+ return true;
+
+ m_state = InitialState;
+ return false;
}
return token.type() != HTMLToken::EndTag || !threadSafeMatch(token.data(), HTMLNames::scriptTag);
« no previous file with comments | « sky/engine/core/html/parser/BackgroundHTMLParser.h ('k') | sky/engine/core/html/parser/HTMLDocumentParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698