mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:08:10 +00:00
LibWeb: Add a Vector::ensure_capacity() in collect_matching_rules()
Avoid some incremental Vector growth by pre-allocating enough capacity to cover the case where every single selector matches an element.
This commit is contained in:
parent
afc5fade05
commit
c1e6fc67a1
1 changed files with 1 additions and 0 deletions
|
@ -92,6 +92,7 @@ Vector<MatchingRule> StyleComputer::collect_matching_rules(DOM::Element const& e
|
|||
}
|
||||
|
||||
Vector<MatchingRule> matching_rules;
|
||||
matching_rules.ensure_capacity(rules_to_run.size());
|
||||
for (auto const& rule_to_run : rules_to_run) {
|
||||
auto const& selector = rule_to_run.rule->selectors()[rule_to_run.selector_index];
|
||||
if (SelectorEngine::matches(selector, element, pseudo_element))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue