Skip to content

Commit

Permalink
Remove key hashing
Browse files Browse the repository at this point in the history
  • Loading branch information
ssjkamei committed Aug 30, 2023
1 parent 623d121 commit c3002f9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions weasyprint/css/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"""

from collections import namedtuple
from hashlib import md5
from logging import DEBUG, WARNING

import cssselect2
Expand Down Expand Up @@ -141,8 +140,8 @@ def _set_cascaded_style(self, element, pseudo_type=None, style={}):
cascaded_styles[element] = {}
element_styles = cascaded_styles[element]
style_indexes = self._get_cascaded_style_indexes()
key_hash = md5(str(sorted(style.keys())).encode('utf8')).hexdigest()
style_index = style_indexes.setdefault(key_hash, {})
key_str = str(sorted(style.keys())).encode('utf8')
style_index = style_indexes.setdefault(key_str, {})
if style_index:
for i, values in sorted(style_index.items(), reverse=True):
if style == values:
Expand Down Expand Up @@ -1255,9 +1254,8 @@ def set_computed_style_key(self, element, pseudo_type=None, style_keys={}):
"""Set the computed style keys"""
styles = self.get_computed_styles()
key_indexes = self._get_computed_key_indexs()
key_hash = md5(
str(sorted(style_keys.keys())).encode('utf8')).hexdigest()
key_index = key_indexes.setdefault(key_hash, {})
key_str = str(sorted(style_keys.keys())).encode('utf8')
key_index = key_indexes.setdefault(key_str, {})
if key_index:
for i, values in sorted(key_index.items(), reverse=True):
if style_keys == values:
Expand Down

0 comments on commit c3002f9

Please sign in to comment.