mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03: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
Notes:
sideshowbarker
2024-07-18 17:38:54 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/1822d6b8ac1 Pull-request: https://github.com/SerenityOS/serenity/pull/7333 Issue: https://github.com/SerenityOS/serenity/issues/7331
@ -203,9 +203,9 @@ Optional<u32> HTMLTokenizer::next_code_point()
|
||||
|
||||
void HTMLTokenizer::skip(size_t count)
|
||||
{
|
||||
m_prev_utf8_iterator = m_utf8_iterator;
|
||||
m_source_positions.append(m_source_positions.last());
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
m_prev_utf8_iterator = m_utf8_iterator;
|
||||
auto code_point = *m_utf8_iterator;
|
||||
if (code_point == '\n') {
|
||||
m_source_positions.last().column = 0;
|
||||
@ -2687,6 +2687,7 @@ void HTMLTokenizer::restore_to(const Utf8CodepointIterator& new_iterator)
|
||||
TODO();
|
||||
}
|
||||
}
|
||||
m_utf8_iterator = new_iterator;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user