summaryrefslogtreecommitdiff
path: root/src/select/hash.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-12-07 15:08:21 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-12-07 15:08:21 +0000
commite3372335ec1628e1d6ef1a4fd63b11bb47f2e0e6 (patch)
tree288253f6dc28adca29b197dd450be4ba7b1631bc /src/select/hash.c
parent8af91a420df85e25f2b80c489154cb3df448e2e4 (diff)
downloadlibcss-e3372335ec1628e1d6ef1a4fd63b11bb47f2e0e6.tar.gz
libcss-e3372335ec1628e1d6ef1a4fd63b11bb47f2e0e6.tar.bz2
Just match against universal string intern instead of checking strings length/data.
Diffstat (limited to 'src/select/hash.c')
-rw-r--r--src/select/hash.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/select/hash.c b/src/select/hash.c
index ee91fc2..79c324b 100644
--- a/src/select/hash.c
+++ b/src/select/hash.c
@@ -95,10 +95,9 @@ static css_error _iterate_universal(
* \return true iff chain head doesn't fail to match element name
*/
static inline bool _chain_good_for_element_name(const css_selector *selector,
- const css_qname *qname)
+ const css_qname *qname, const lwc_string *uni)
{
- if (lwc_string_length(selector->data.qname.name) != 1 ||
- lwc_string_data(selector->data.qname.name)[0] != '*') {
+ if (selector->data.qname.name != uni) {
bool match;
if (lwc_string_caseless_isequal(
selector->data.qname.name, qname->name,
@@ -486,7 +485,8 @@ css_error css__selector_hash_find_by_class(css_selector_hash *hash,
req->node_bloom) &&
_chain_good_for_element_name(
head->sel,
- &(req->qname)) &&
+ &(req->qname),
+ req->uni) &&
_rule_good_for_media(
head->sel->rule,
req->media)) {
@@ -565,7 +565,8 @@ css_error css__selector_hash_find_by_id(css_selector_hash *hash,
req->node_bloom) &&
_chain_good_for_element_name(
head->sel,
- &req->qname) &&
+ &req->qname,
+ req->uni) &&
_rule_good_for_media(
head->sel->rule,
req->media)) {
@@ -1018,7 +1019,8 @@ css_error _iterate_classes(
req->node_bloom) &&
_chain_good_for_element_name(
head->sel,
- &(req->qname)) &&
+ &(req->qname),
+ req->uni) &&
_rule_good_for_media(
head->sel->rule,
req->media)) {
@@ -1078,7 +1080,8 @@ css_error _iterate_ids(
req->node_bloom) &&
_chain_good_for_element_name(
head->sel,
- &req->qname) &&
+ &req->qname,
+ req->uni) &&
_rule_good_for_media(
head->sel->rule,
req->media)) {