1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-29 22:32:08 +00:00

LibWeb: Change HTMLToken::m_doctype into named DoctypeData struct

This is in preparation for an upcoming storage change of HTMLToken. In
contrast to the other token types, the accessor can hand out a mutable
reference to allow users to change parts of the DoctypeData easily.
This commit is contained in:
Max Wipfli 2021-07-15 00:03:50 +02:00 committed by Ali Mohammad Pur
parent 918bde98b1
commit 8b31e41692
4 changed files with 92 additions and 79 deletions

View file

@ -47,6 +47,17 @@ public:
Position value_end_position;
};
struct DoctypeData {
// NOTE: "Missing" is a distinct state from the empty string.
String name;
String public_identifier;
String system_identifier;
bool missing_name { true };
bool missing_public_identifier { true };
bool missing_system_identifier { true };
bool force_quirks { false };
};
static HTMLToken make_character(u32 code_point)
{
HTMLToken token;
@ -252,6 +263,18 @@ public:
});
}
DoctypeData const& doctype_data() const
{
VERIFY(is_doctype());
return m_doctype;
}
DoctypeData& doctype_data()
{
VERIFY(is_doctype());
return m_doctype;
}
Type type() const { return m_type; }
String to_string() const;
@ -263,17 +286,7 @@ private:
Type m_type { Type::Invalid };
// Type::DOCTYPE
struct {
// NOTE: "Missing" is a distinct state from the empty string.
String name;
bool missing_name { true };
String public_identifier;
bool missing_public_identifier { true };
String system_identifier;
bool missing_system_identifier { true };
bool force_quirks { false };
} m_doctype;
DoctypeData m_doctype;
// Type::StartTag
// Type::EndTag