mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +00:00
LibWeb: Add position tracking information to HTML tokens
This commit is contained in:
parent
fd982f6562
commit
aa7939bc6c
4 changed files with 108 additions and 21 deletions
|
@ -164,12 +164,30 @@ public:
|
|||
|
||||
String to_string() const;
|
||||
|
||||
const auto& start_position() const { return m_start_position; }
|
||||
const auto& end_position() const { return m_end_position; }
|
||||
|
||||
const auto& attributes() const
|
||||
{
|
||||
VERIFY(is_start_tag() || is_end_tag());
|
||||
return m_tag.attributes;
|
||||
}
|
||||
|
||||
private:
|
||||
struct Position {
|
||||
size_t line { 0 };
|
||||
size_t column { 0 };
|
||||
};
|
||||
|
||||
struct AttributeBuilder {
|
||||
StringBuilder prefix_builder;
|
||||
StringBuilder local_name_builder;
|
||||
StringBuilder namespace_builder;
|
||||
StringBuilder value_builder;
|
||||
Position name_start_position;
|
||||
Position value_start_position;
|
||||
Position name_end_position;
|
||||
Position value_end_position;
|
||||
};
|
||||
|
||||
Type m_type { Type::Invalid };
|
||||
|
@ -201,6 +219,9 @@ private:
|
|||
struct {
|
||||
StringBuilder data;
|
||||
} m_comment_or_character;
|
||||
|
||||
Position m_start_position;
|
||||
Position m_end_position;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue