1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

LibWeb: Implement :nth-child pseudo-class

This commit is contained in:
miere43 2021-05-08 23:19:25 +03:00 committed by Andreas Kling
parent 1e0e8b27c0
commit aa83539d7b
6 changed files with 161 additions and 36 deletions

View file

@ -36,6 +36,7 @@ public:
Root,
FirstOfType,
LastOfType,
NthChild,
};
PseudoClass pseudo_class { PseudoClass::None };
@ -59,6 +60,17 @@ public:
AttributeMatchType attribute_match_type { AttributeMatchType::None };
FlyString attribute_name;
String attribute_value;
struct NthChildPattern {
int step_size = 0;
int offset = 0;
static NthChildPattern parse(const StringView& args);
};
// FIXME: We don't need this field on every single SimpleSelector, but it's also annoying to malloc it somewhere.
// Only used when "pseudo_class" == PseudoClass::NthChild.
NthChildPattern nth_child_pattern;
};
struct ComplexSelector {