1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00:00

LibWeb: Parse :before and :after pseudo-elements

Note that this is the old CSS2 syntax, we don't support the CSS3 syntax
just yet. Also we don't actually implement the pseudo-elements, this is
really just to make the selectors distinct from the same ones without
these pseudo-elements.
This commit is contained in:
Andreas Kling 2020-12-01 15:40:20 +01:00
parent eef30bb05e
commit bbcc71fec4
3 changed files with 21 additions and 0 deletions

View file

@ -502,6 +502,7 @@ public:
return CSS::Selector::SimpleSelector {
type,
CSS::Selector::SimpleSelector::PseudoClass::None,
CSS::Selector::SimpleSelector::PseudoElement::None,
String(),
CSS::Selector::SimpleSelector::AttributeMatchType::None,
String(),
@ -537,6 +538,7 @@ public:
CSS::Selector::SimpleSelector simple_selector {
type,
CSS::Selector::SimpleSelector::PseudoClass::None,
CSS::Selector::SimpleSelector::PseudoElement::None,
value,
CSS::Selector::SimpleSelector::AttributeMatchType::None,
String(),
@ -639,6 +641,10 @@ public:
simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::Empty;
else if (pseudo_name.equals_ignoring_case("root"))
simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::Root;
else if (pseudo_name.equals_ignoring_case("before"))
simple_selector.pseudo_element = CSS::Selector::SimpleSelector::PseudoElement::Before;
else if (pseudo_name.equals_ignoring_case("after"))
simple_selector.pseudo_element = CSS::Selector::SimpleSelector::PseudoElement::After;
}
if (index == index_at_start) {