mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
LibWeb: Compress specificity into a 32-bit unsigned int
Instead of storing the three-part specificy for every selector, just mash them together into a 32-bit value instead. This saves both space and time, and matches the behavior of other browser engines.
This commit is contained in:
parent
8be74ea65c
commit
49dd4b7e8a
4 changed files with 6 additions and 68 deletions
|
@ -37,7 +37,7 @@ Selector::~Selector()
|
|||
{
|
||||
}
|
||||
|
||||
Specificity Selector::specificity() const
|
||||
u32 Selector::specificity() const
|
||||
{
|
||||
unsigned ids = 0;
|
||||
unsigned tag_names = 0;
|
||||
|
@ -61,7 +61,7 @@ Specificity Selector::specificity() const
|
|||
}
|
||||
}
|
||||
|
||||
return { ids, classes, tag_names };
|
||||
return ids * 0x10000 + classes * 0x100 + tag_names;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue