blob: 8e7d30c506a16c4f981c7741e4acd7f707ae7209 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#include <LibHTML/CSS/Selector.h>
Selector::Selector(Vector<Component>&& components)
: m_components(move(components))
{
}
Selector::~Selector()
{
}
Specificity Selector::specificity() const
{
unsigned ids = 0;
unsigned tag_names = 0;
unsigned classes = 0;
for (auto& component : m_components) {
switch (component.type) {
case Component::Type::Id:
++ids;
break;
case Component::Type::Class:
++classes;
break;
case Component::Type::TagName:
++tag_names;
break;
default:
break;
}
}
return { ids, classes, tag_names };
}
|