mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-01 08:48:49 +00:00
LibWeb: Track the byte offset of an HTMLToken's position
We currently track the [line, column] position of every HTMLToken, as this is what is needed for LibGUI's syntax highlighting. Some non-LibGUI purposes (e.g. highlighting HTML with HTML) require a byte offset. Track both during tokenization.
This commit is contained in:
parent
ba4db899d4
commit
fea440055a
Notes:
sideshowbarker
2024-07-16 21:30:46 +09:00
Author: https://github.com/trflynn89
Commit: fea440055a
Pull-request: https://github.com/SerenityOS/serenity/pull/20824
Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 2 additions and 0 deletions
|
@ -223,6 +223,7 @@ void HTMLTokenizer::skip(size_t count)
|
|||
} else {
|
||||
m_source_positions.last().column++;
|
||||
}
|
||||
m_source_positions.last().byte_offset += m_utf8_iterator.underlying_code_point_length_in_bytes();
|
||||
}
|
||||
++m_utf8_iterator;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue