mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:08:13 +00:00
LibWeb: Remove tokenizer's premature character buffering optimization
This commit is contained in:
parent
92fd140cb2
commit
96cc1138c0
2 changed files with 2 additions and 13 deletions
|
@ -134,10 +134,9 @@ Optional<HTMLToken> HTMLTokenizer::next_token()
|
||||||
}
|
}
|
||||||
ANYTHING_ELSE
|
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());
|
m_current_token.m_comment_or_character.data.append(current_input_character.value());
|
||||||
continue;
|
return m_current_token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
END_STATE
|
END_STATE
|
||||||
|
@ -749,7 +748,6 @@ bool HTMLTokenizer::next_few_characters_are(const StringView& string) const
|
||||||
|
|
||||||
void HTMLTokenizer::create_new_token(HTMLToken::Type type)
|
void HTMLTokenizer::create_new_token(HTMLToken::Type type)
|
||||||
{
|
{
|
||||||
flush_current_character_or_comment_if_needed();
|
|
||||||
m_current_token = {};
|
m_current_token = {};
|
||||||
m_current_token.m_type = type;
|
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)
|
void HTMLTokenizer::will_switch_to([[maybe_unused]] State new_state)
|
||||||
{
|
{
|
||||||
flush_current_character_or_comment_if_needed();
|
|
||||||
#ifdef TOKENIZER_TRACE
|
#ifdef TOKENIZER_TRACE
|
||||||
dbg() << "[" << state_name(m_state) << "] Switch to " << state_name(new_state);
|
dbg() << "[" << state_name(m_state) << "] Switch to " << state_name(new_state);
|
||||||
#endif
|
#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)
|
void HTMLTokenizer::will_reconsume_in([[maybe_unused]] State new_state)
|
||||||
{
|
{
|
||||||
flush_current_character_or_comment_if_needed();
|
|
||||||
#ifdef TOKENIZER_TRACE
|
#ifdef TOKENIZER_TRACE
|
||||||
dbg() << "[" << state_name(m_state) << "] Reconsume in " << state_name(new_state);
|
dbg() << "[" << state_name(m_state) << "] Reconsume in " << state_name(new_state);
|
||||||
#endif
|
#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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,6 @@ private:
|
||||||
|
|
||||||
void will_switch_to(State);
|
void will_switch_to(State);
|
||||||
void will_reconsume_in(State);
|
void will_reconsume_in(State);
|
||||||
void flush_current_character_or_comment_if_needed();
|
|
||||||
|
|
||||||
State m_state { State::Data };
|
State m_state { State::Data };
|
||||||
State m_return_state { State::Data };
|
State m_return_state { State::Data };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue