Skip to content

Commit

Permalink
Fix floating-point number error to fix floating box layout
Browse files Browse the repository at this point in the history
Fix #583.
  • Loading branch information
liZe committed Mar 27, 2018
1 parent a859d8d commit 4e1fad3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions weasyprint/layout/inlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ def get_next_linebox(context, linebox, position_y, skip_stack,
line.margin_bottom = 0

line.translate(offset_x, offset_y)
# Avoid floating point errors, as position_y - top + top != position_y
# Removing this line breaks the position == linebox.position test below
# See https://github.com/Kozea/WeasyPrint/issues/583
line.position_y = position_y

if line.height <= candidate_height:
break
Expand Down

0 comments on commit 4e1fad3

Please sign in to comment.