Skip to content

Commit

Permalink
#1007 Make 'inherit' value work correctly for word-wrap and `overfl…
Browse files Browse the repository at this point in the history
…ow-wrap` properties
  • Loading branch information
ckepper authored and liZe committed Dec 21, 2021
1 parent b18b67a commit bc22f29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions tests/test_css_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,8 @@ def test_overflow_wrap():
'overflow_wrap': 'normal'}
assert expand_to_dict('overflow-wrap: break-word') == {
'overflow_wrap': 'break-word'}
assert expand_to_dict('overflow-wrap: inherit') == {
'overflow_wrap': 'inherit'}
assert_invalid('overflow-wrap: none')
assert_invalid('overflow-wrap: normal, break-word')

Expand All @@ -874,6 +876,8 @@ def test_expand_word_wrap():
'overflow_wrap': 'normal'}
assert expand_to_dict('word-wrap: break-word') == {
'overflow_wrap': 'break-word'}
assert expand_to_dict('word-wrap: inherit') == {
'overflow_wrap': 'inherit'}
assert_invalid('word-wrap: none')
assert_invalid('word-wrap: normal, break-word')

Expand Down
8 changes: 5 additions & 3 deletions weasyprint/css/validation/expanders.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,17 +526,19 @@ def expand_font(name, tokens):


@expander('word-wrap')
def expand_word_wrap(base_url, name, tokens):
@generic_expander('overflow-wrap')
def expand_word_wrap(name, tokens):
"""Expand the ``word-wrap`` legacy property.
See http://http://www.w3.org/TR/css3-text/#overflow-wrap
See http://www.w3.org/TR/css3-text/#overflow-wrap
"""
keyword = overflow_wrap(tokens)
if keyword is None:
raise InvalidValues

yield 'overflow-wrap', keyword
if len(tokens) == 1:
yield 'overflow-wrap', tokens


@expander('flex')
Expand Down

0 comments on commit bc22f29

Please sign in to comment.