ladybird/Libraries/LibHTML/CSS/Selector.h
Andreas Kling 605a225b53 LibHTML: Parse the :link and :hover CSS pseudo-classes
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. :^)
2019-10-14 17:31:52 +02:00

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;
};