Skip to content

Commit

Permalink
Copy styles for split boxes
Browse files Browse the repository at this point in the history
This fixes blocks split between pages and inlines boxes split by block boxes.

Increases memory usage, related to #70.
  • Loading branch information
liZe committed Aug 17, 2017
1 parent a475489 commit d4357e5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions weasyprint/formatting_structure/boxes.py
Expand Up @@ -62,6 +62,7 @@
import itertools

from ..compat import unichr, xrange
from ..css.properties import Dimension

# The *Box classes have many attributes and methods, but that's the way it is
# pylint: disable=R0904,R0902
Expand Down Expand Up @@ -299,11 +300,16 @@ def enumerate_skip(self, skip_num=0):

def _reset_spacing(self, side):
"""Set to 0 the margin, padding and border of ``side``."""
self.style['margin_%s' % side] = Dimension(0, 'px')
self.style['padding_%s' % side] = Dimension(0, 'px')
self.style['border_%s_width' % side] = 0
setattr(self, 'margin_%s' % side, 0)
setattr(self, 'padding_%s' % side, 0)
setattr(self, 'border_%s_width' % side, 0)

def _remove_decoration(self, start, end):
if start or end:
self.style = self.style.copy()
if start:
self._reset_spacing('top')
if end:
Expand Down Expand Up @@ -409,6 +415,8 @@ class InlineLevelBox(Box):
"""
def _remove_decoration(self, start, end):
if start or end:
self.style = self.style.copy()
ltr = self.style.direction == 'ltr'
if start:
self._reset_spacing('left' if ltr else 'right')
Expand Down

0 comments on commit d4357e5

Please sign in to comment.