diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-24 19:15:16 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-24 23:54:22 +0200 |
commit | 96cc1138c0cff274c6516b92c5a81c944c476b90 (patch) | |
tree | 979994e2bd38180c868793f2198f128a5d05ef6a /Libraries | |
parent | 92fd140cb2c9f142e035d3cf675cc432839ea6af (diff) | |
download | serenity-96cc1138c0cff274c6516b92c5a81c944c476b90.zip |
LibWeb: Remove tokenizer's premature character buffering optimization
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibWeb/Parser/HTMLTokenizer.cpp | 14 | ||||
-rw-r--r-- | Libraries/LibWeb/Parser/HTMLTokenizer.h | 1 |
2 files changed, 2 insertions, 13 deletions
diff --git a/Libraries/LibWeb/Parser/HTMLTokenizer.cpp b/Libraries/LibWeb/Parser/HTMLTokenizer.cpp index a5680b7a7e..5c46e36249 100644 --- a/Libraries/LibWeb/Parser/HTMLTokenizer.cpp +++ b/Libraries/LibWeb/Parser/HTMLTokenizer.cpp @@ -134,10 +134,9 @@ Optional<HTMLToken> HTMLTokenizer::next_token() } ANYTHING_ELSE { - if (m_current_token.type() != HTMLToken::Type::Character) - create_new_token(HTMLToken::Type::Character); + create_new_token(HTMLToken::Type::Character); m_current_token.m_comment_or_character.data.append(current_input_character.value()); - continue; + return m_current_token; } } END_STATE @@ -749,7 +748,6 @@ bool HTMLTokenizer::next_few_characters_are(const StringView& string) const void HTMLTokenizer::create_new_token(HTMLToken::Type type) { - flush_current_character_or_comment_if_needed(); m_current_token = {}; m_current_token.m_type = type; } @@ -761,7 +759,6 @@ HTMLTokenizer::HTMLTokenizer(const StringView& input) void HTMLTokenizer::will_switch_to([[maybe_unused]] State new_state) { - flush_current_character_or_comment_if_needed(); #ifdef TOKENIZER_TRACE dbg() << "[" << state_name(m_state) << "] Switch to " << state_name(new_state); #endif @@ -769,16 +766,9 @@ void HTMLTokenizer::will_switch_to([[maybe_unused]] State new_state) void HTMLTokenizer::will_reconsume_in([[maybe_unused]] State new_state) { - flush_current_character_or_comment_if_needed(); #ifdef TOKENIZER_TRACE dbg() << "[" << state_name(m_state) << "] Reconsume in " << state_name(new_state); #endif } -void HTMLTokenizer::flush_current_character_or_comment_if_needed() -{ - //if (m_current_token.type() == HTMLToken::Type::Character || m_current_token.type() == HTMLToken::Type::Comment) - // emit_current_token(); -} - } diff --git a/Libraries/LibWeb/Parser/HTMLTokenizer.h b/Libraries/LibWeb/Parser/HTMLTokenizer.h index 17b795baa5..b01b0e200e 100644 --- a/Libraries/LibWeb/Parser/HTMLTokenizer.h +++ b/Libraries/LibWeb/Parser/HTMLTokenizer.h @@ -147,7 +147,6 @@ private: void will_switch_to(State); void will_reconsume_in(State); - void flush_current_character_or_comment_if_needed(); State m_state { State::Data }; State m_return_state { State::Data }; |