mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Use a Variant for SimpleSelector's contents
This reduces SimpleSelector's size from 112 bytes to 80 bytes. :^)
This commit is contained in:
parent
218a9af6b3
commit
c0db19f63c
Notes:
sideshowbarker
2024-07-17 16:55:40 +09:00
Author: https://github.com/AtkinsSJ
Commit: c0db19f63c
Pull-request: https://github.com/SerenityOS/serenity/pull/13193
6 changed files with 96 additions and 77 deletions
|
@ -301,15 +301,15 @@ static inline bool matches(CSS::Selector::SimpleSelector const& component, DOM::
|
|||
case CSS::Selector::SimpleSelector::Type::Universal:
|
||||
return true;
|
||||
case CSS::Selector::SimpleSelector::Type::Id:
|
||||
return component.value == element.attribute(HTML::AttributeNames::id);
|
||||
return component.name() == element.attribute(HTML::AttributeNames::id);
|
||||
case CSS::Selector::SimpleSelector::Type::Class:
|
||||
return element.has_class(component.value);
|
||||
return element.has_class(component.name());
|
||||
case CSS::Selector::SimpleSelector::Type::TagName:
|
||||
return component.value == element.local_name();
|
||||
return component.name() == element.local_name();
|
||||
case CSS::Selector::SimpleSelector::Type::Attribute:
|
||||
return matches_attribute(component.attribute, element);
|
||||
return matches_attribute(component.attribute(), element);
|
||||
case CSS::Selector::SimpleSelector::Type::PseudoClass:
|
||||
return matches_pseudo_class(component.pseudo_class, element);
|
||||
return matches_pseudo_class(component.pseudo_class(), element);
|
||||
case CSS::Selector::SimpleSelector::Type::PseudoElement:
|
||||
// Pseudo-element matching/not-matching is handled in the top level matches().
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue