mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 14:05:15 +00:00
Things were getting a little crowded in the project root, so this patch moves the Lib*/ directories into Libraries/.
35 lines
682 B
C++
35 lines
682 B
C++
#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 };
|
|
}
|