mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibWeb: Use Selectors instead of a String for :not() selectors
Rather than parsing the selector every time we want to check it, we now parse it once at the beginning. A bonus effect of this is that we now support a selector list in :not(), instead of just a single selector, though only when using the new parser.
This commit is contained in:
parent
776b1f4548
commit
ffc81cbfad
Notes:
sideshowbarker
2024-07-18 09:04:11 +09:00
Author: https://github.com/AtkinsSJ
Commit: ffc81cbfad
Pull-request: https://github.com/SerenityOS/serenity/pull/8723
Reviewed-by: https://github.com/kleinesfilmroellchen
8 changed files with 40 additions and 19 deletions
|
@ -393,7 +393,10 @@ void dump_selector(StringBuilder& builder, CSS::Selector const& selector)
|
|||
|
||||
builder.appendff(" pseudo_class={}", pseudo_class_description);
|
||||
if (pseudo_class.type == CSS::Selector::SimpleSelector::PseudoClass::Type::Not) {
|
||||
builder.appendff("({})", pseudo_class.not_selector);
|
||||
builder.append("(");
|
||||
for (auto& selector : pseudo_class.not_selector)
|
||||
dump_selector(builder, selector);
|
||||
builder.append(")");
|
||||
} else if ((pseudo_class.type == CSS::Selector::SimpleSelector::PseudoClass::Type::NthChild)
|
||||
|| (pseudo_class.type == CSS::Selector::SimpleSelector::PseudoClass::Type::NthLastChild)) {
|
||||
builder.appendff("(step={}, offset={})", pseudo_class.nth_child_pattern.step_size, pseudo_class.nth_child_pattern.offset);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue