mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 02:42:44 +00:00 
			
		
		
		
	 605a225b53
			
		
	
	
		605a225b53
		
	
	
	
	
		
			
			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;
 | |
| };
 |