mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:38:10 +00:00
LibWeb: Use an Optional<String> to track the last HTML start tag
Using an HTMLToken object here is unnecessary because the only attribute we're interested in is the tag_name.
This commit is contained in:
parent
d92548c5b0
commit
d9e52997e2
2 changed files with 4 additions and 4 deletions
|
@ -2649,16 +2649,16 @@ void HTMLTokenizer::switch_to(Badge<HTMLDocumentParser>, State new_state)
|
||||||
void HTMLTokenizer::will_emit(HTMLToken& token)
|
void HTMLTokenizer::will_emit(HTMLToken& token)
|
||||||
{
|
{
|
||||||
if (token.is_start_tag())
|
if (token.is_start_tag())
|
||||||
m_last_emitted_start_tag = token;
|
m_last_emitted_start_tag_name = token.tag_name();
|
||||||
token.m_end_position = nth_last_position(0);
|
token.m_end_position = nth_last_position(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HTMLTokenizer::current_end_tag_token_is_appropriate() const
|
bool HTMLTokenizer::current_end_tag_token_is_appropriate() const
|
||||||
{
|
{
|
||||||
VERIFY(m_current_token.is_end_tag());
|
VERIFY(m_current_token.is_end_tag());
|
||||||
if (!m_last_emitted_start_tag.is_start_tag())
|
if (!m_last_emitted_start_tag_name.has_value())
|
||||||
return false;
|
return false;
|
||||||
return m_current_token.tag_name() == m_last_emitted_start_tag.tag_name();
|
return m_current_token.tag_name() == m_last_emitted_start_tag_name.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HTMLTokenizer::consumed_as_part_of_an_attribute() const
|
bool HTMLTokenizer::consumed_as_part_of_an_attribute() const
|
||||||
|
|
|
@ -164,7 +164,7 @@ private:
|
||||||
|
|
||||||
HTMLToken m_current_token;
|
HTMLToken m_current_token;
|
||||||
|
|
||||||
HTMLToken m_last_emitted_start_tag;
|
Optional<String> m_last_emitted_start_tag_name;
|
||||||
|
|
||||||
bool m_has_emitted_eof { false };
|
bool m_has_emitted_eof { false };
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue