1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

LibWeb: Remove now-unused null values from Selector enums

Now that we use a Variant for the SimpleSelector's data, we don't need
to instantiate empty structs or variables for the types that aren't
used, and so we can remove `PseudoElement::None`,
`PsuedoClass::Type::None` and `Attribute::MatchType::None`.

Also, we now always initialize a SimpleSelector with a type, so
`SimpleSelector::Type::Invalid` can go too.
This commit is contained in:
Sam Atkins 2022-03-22 12:58:36 +00:00 committed by Andreas Kling
parent cbe2eaebab
commit 31b24c2b29
4 changed files with 3 additions and 30 deletions

View file

@ -333,9 +333,6 @@ void dump_selector(StringBuilder& builder, CSS::Selector const& selector)
auto& simple_selector = relative_selector.simple_selectors[i];
char const* type_description = "Unknown";
switch (simple_selector.type) {
case CSS::Selector::SimpleSelector::Type::Invalid:
type_description = "Invalid";
break;
case CSS::Selector::SimpleSelector::Type::Universal:
type_description = "Universal";
break;
@ -378,9 +375,6 @@ void dump_selector(StringBuilder& builder, CSS::Selector const& selector)
case CSS::Selector::SimpleSelector::PseudoClass::Type::Active:
pseudo_class_description = "Active";
break;
case CSS::Selector::SimpleSelector::PseudoClass::Type::None:
pseudo_class_description = "None";
break;
case CSS::Selector::SimpleSelector::PseudoClass::Type::Root:
pseudo_class_description = "Root";
break;
@ -479,9 +473,6 @@ void dump_selector(StringBuilder& builder, CSS::Selector const& selector)
if (simple_selector.type == CSS::Selector::SimpleSelector::Type::PseudoElement) {
char const* pseudo_element_description = "";
switch (simple_selector.pseudo_element()) {
case CSS::Selector::PseudoElement::None:
pseudo_element_description = "NONE";
break;
case CSS::Selector::PseudoElement::Before:
pseudo_element_description = "before";
break;
@ -507,9 +498,6 @@ void dump_selector(StringBuilder& builder, CSS::Selector const& selector)
char const* attribute_match_type_description = "";
switch (attribute.match_type) {
case CSS::Selector::SimpleSelector::Attribute::MatchType::None:
attribute_match_type_description = "NONE";
break;
case CSS::Selector::SimpleSelector::Attribute::MatchType::HasAttribute:
attribute_match_type_description = "HasAttribute";
break;