1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:57:34 +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:
Sam Atkins 2021-07-12 17:58:47 +01:00 committed by Andreas Kling
parent 776b1f4548
commit ffc81cbfad
8 changed files with 40 additions and 19 deletions

View file

@ -8,6 +8,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/NonnullRefPtrVector.h>
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <AK/Vector.h>
@ -64,8 +65,7 @@ public:
// Only used when "pseudo_class" is "NthChild" or "NthLastChild".
NthChildPattern nth_child_pattern;
// FIXME: This wants to be a Selector, rather than parsing it each time it is used.
String not_selector {};
NonnullRefPtrVector<Selector> not_selector {};
};
PseudoClass pseudo_class;