mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:18:13 +00:00
LibWeb: Fix invalid behaviour of HTMLTokenizer::skip() and restore_to()
skip() is supposed to end up keeping the previous iterator only one index behind the current one, and restore_to() should actually do the restore instead of just removing the now-useless source positions. Fixes #7331.
This commit is contained in:
parent
09d09b79b6
commit
1822d6b8ac
1 changed files with 2 additions and 1 deletions
|
@ -203,9 +203,9 @@ Optional<u32> HTMLTokenizer::next_code_point()
|
||||||
|
|
||||||
void HTMLTokenizer::skip(size_t count)
|
void HTMLTokenizer::skip(size_t count)
|
||||||
{
|
{
|
||||||
m_prev_utf8_iterator = m_utf8_iterator;
|
|
||||||
m_source_positions.append(m_source_positions.last());
|
m_source_positions.append(m_source_positions.last());
|
||||||
for (size_t i = 0; i < count; ++i) {
|
for (size_t i = 0; i < count; ++i) {
|
||||||
|
m_prev_utf8_iterator = m_utf8_iterator;
|
||||||
auto code_point = *m_utf8_iterator;
|
auto code_point = *m_utf8_iterator;
|
||||||
if (code_point == '\n') {
|
if (code_point == '\n') {
|
||||||
m_source_positions.last().column = 0;
|
m_source_positions.last().column = 0;
|
||||||
|
@ -2687,6 +2687,7 @@ void HTMLTokenizer::restore_to(const Utf8CodepointIterator& new_iterator)
|
||||||
TODO();
|
TODO();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m_utf8_iterator = new_iterator;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue