1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-29 17:25:10 +00:00

LibWeb: Add position tracking information to HTML tokens

This commit is contained in:
Ali Mohammad Pur 2021-05-20 23:11:41 +04:30 committed by Andreas Kling
parent fd982f6562
commit aa7939bc6c
4 changed files with 108 additions and 21 deletions

View file

@ -117,6 +117,7 @@ public:
String source() const { return m_decoded_input; }
private:
void skip(size_t count);
Optional<u32> next_code_point();
Optional<u32> peek_code_point(size_t offset) const;
bool consume_next_if_match(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive);
@ -141,6 +142,9 @@ private:
bool consumed_as_part_of_an_attribute() const;
void restore_to(const Utf8CodepointIterator& new_iterator);
auto& nth_last_position(size_t n = 0) { return m_source_positions.at(m_source_positions.size() - 1 - n); }
State m_state { State::Data };
State m_return_state { State::Data };
@ -165,6 +169,8 @@ private:
u32 m_character_reference_code { 0 };
bool m_blocked { false };
Vector<HTMLToken::Position> m_source_positions;
};
}