
We don't actually do anything with these yet, but now the values will be there for the selector engine to look at when it feels ready. :^)
46 lines
921 B
C++
46 lines
921 B
C++
#pragma once
|
|
|
|
#include <AK/String.h>
|
|
#include <AK/Vector.h>
|
|
#include <LibHTML/CSS/Specificity.h>
|
|
|
|
class Selector {
|
|
public:
|
|
struct Component {
|
|
enum class Type {
|
|
Invalid,
|
|
TagName,
|
|
Id,
|
|
Class,
|
|
};
|
|
Type type { Type::Invalid };
|
|
|
|
enum class PseudoClass {
|
|
None,
|
|
Link,
|
|
Hover,
|
|
};
|
|
PseudoClass pseudo_class { PseudoClass::None };
|
|
|
|
enum class Relation {
|
|
None,
|
|
ImmediateChild,
|
|
Descendant,
|
|
AdjacentSibling,
|
|
GeneralSibling,
|
|
};
|
|
Relation relation { Relation::None };
|
|
|
|
String value;
|
|
};
|
|
|
|
explicit Selector(Vector<Component>&&);
|
|
~Selector();
|
|
|
|
const Vector<Component>& components() const { return m_components; }
|
|
|
|
Specificity specificity() const;
|
|
|
|
private:
|
|
Vector<Component> m_components;
|
|
};
|