style: Speed up selector matching with already-lowercase local name selectors

This makes relatively simple changes so that we check lowercase-ness of
local-name selectors first. If so, we don't need to check whether we're
an HTML element in an HTML document, which requires a fair bit of
pointer-chasing.

Differential Revision: https://phabricator.services.mozilla.com/D163627
This commit is contained in:
Emilio Cobos Álvarez 2022-12-03 11:25:09 +00:00 committed by Martin Robinson
parent dbba87d73e
commit b6d9b77a15
3 changed files with 47 additions and 46 deletions

View file

@ -365,7 +365,7 @@ where
ref lower_name,
} = *local_name;
let chosen_name = if element.is_html_element_in_html_document() {
let chosen_name = if name == lower_name || element.is_html_element_in_html_document() {
lower_name
} else {
name