1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:07:35 +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

@ -95,9 +95,6 @@ static inline bool matches_attribute(CSS::Selector::SimpleSelector::Attribute co
return element.attribute(attribute.name).starts_with(attribute.value);
case CSS::Selector::SimpleSelector::Attribute::MatchType::EndsWithString:
return element.attribute(attribute.name).ends_with(attribute.value);
case CSS::Selector::SimpleSelector::Attribute::MatchType::None:
VERIFY_NOT_REACHED();
break;
}
return false;
@ -124,8 +121,6 @@ static inline DOM::Element const* next_sibling_with_same_tag_name(DOM::Element c
static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoClass const& pseudo_class, DOM::Element const& element)
{
switch (pseudo_class.type) {
case CSS::Selector::SimpleSelector::PseudoClass::Type::None:
break;
case CSS::Selector::SimpleSelector::PseudoClass::Type::Link:
return element.is_link();
case CSS::Selector::SimpleSelector::PseudoClass::Type::Visited: