Skip to content

Commit

Permalink
Ignore overflow_wrap: break-word when calculating min-content width
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Mar 5, 2018
1 parent 957ffe7 commit 63db508
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion weasyprint/layout/preferred.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ def inline_line_widths(context, box, outer, is_line_start, minimum,
_, _, new_resume_at, width, _, _ = (
text.split_first_line(
child_text[resume_at:], child.style, context,
max_width, child.justification_spacing))
max_width, child.justification_spacing,
minimum=True))
lines.append(width)
if first_line:
break
Expand Down
5 changes: 3 additions & 2 deletions weasyprint/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,8 @@ def add_attr(start, end, spacing):
return layout


def split_first_line(text, style, context, max_width, justification_spacing):
def split_first_line(text, style, context, max_width, justification_spacing,
minimum=False):
"""Fit as much as possible in the available width for one line of text.
Return ``(layout, length, resume_at, width, height, baseline)``.
Expand Down Expand Up @@ -1122,7 +1123,7 @@ def split_first_line(text, style, context, max_width, justification_spacing):
first_line_width, _ = get_size(first_line, style)
space = max_width - first_line_width
# If we can break words and the first line is too long
if overflow_wrap == 'break-word' and space < 0:
if not minimum and overflow_wrap == 'break-word' and space < 0:
# Is it really OK to remove hyphenation for word-break ?
hyphenated = False
# TODO: Modify code to preserve W3C condition:
Expand Down

0 comments on commit 63db508

Please sign in to comment.