Skip to content

Commit

Permalink
fix Kozea#1007 Make 'inherit' value work correctly for shorthand prop…
Browse files Browse the repository at this point in the history
…erties

* skip shorthand expansion for 'inherit' tokens, hereby applying parent styles
  • Loading branch information
ckepper committed Dec 13, 2021
1 parent c22b211 commit 5aceebb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/test_css_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ def test_spacing_invalid(rule):
('text-decoration-line: overline', {'text_decoration_line': {'overline'}}),
('text-decoration-line: overline blink line-through', {
'text_decoration_line': {'blink', 'line-through', 'overline'}}),
('text-decoration: none', {
'text_decoration_line': 'none',
'text_decoration_color': 'currentColor',
'text_decoration_style': 'solid'}),
('text-decoration: inherit', { 'text_decoration': 'inherit'}),
))
def test_decoration_line(rule, result):
assert expand_to_dict(rule) == result
Expand Down
6 changes: 5 additions & 1 deletion weasyprint/css/validation/expanders.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,11 @@ def expand_text_decoration(base_url, name, tokens):

for token in tokens:
keyword = get_keyword(token)
if keyword in (

if keyword == 'inherit':
yield 'text_decoration', tokens[0].lower_value
return
elif keyword in (
'none', 'underline', 'overline', 'line-through', 'blink'):
text_decoration_line.add(keyword)
elif keyword in ('solid', 'double', 'dotted', 'dashed', 'wavy'):
Expand Down

0 comments on commit 5aceebb

Please sign in to comment.