Skip to content

Commit

Permalink
Remove RunningPlaceholder
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Sep 27, 2019
1 parent d9432a7 commit 0a403d9
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 41 deletions.
29 changes: 0 additions & 29 deletions weasyprint/formatting_structure/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,32 +719,3 @@ class InlineFlexBox(FlexContainerBox, InlineLevelBox):
It behaves as inline on the outside and as a flex container on the inside.
"""


class RunningPlaceholder(BlockBox):
"""A box to anchor a running element within the document flow"""
def __init__(self, identifier, style):
self.position_x = 0
self.position_y = 0
self.width = 0
self.height = 0
self.padding_left = 0
self.padding_right = 0
self.padding_top = 0
self.padding_bottom = 0
self.margin_left = 0
self.margin_right = 0
self.margin_top = 0
self.margin_bottom = 0
self.border_left_width = 0
self.border_right_width = 0
self.border_top_width = 0
self.border_bottom_width = 0
self.identifier = identifier
super(RunningPlaceholder, self).__init__(
None, dict(style, display='block', content=[('running', None)]),
children=[],
)

def translate(self, dx=0, dy=0, ignore_floats=False):
pass
4 changes: 1 addition & 3 deletions weasyprint/layout/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def __init__(self, enable_hinting, style_for, get_image_from_uri,
self._excluded_shapes_lists = []
self.excluded_shapes = None # Not initialized yet
self.string_set = defaultdict(lambda: defaultdict(lambda: list()))
self.running_elements = {}
self.current_page = None
self.forced_break = False

Expand All @@ -205,9 +206,6 @@ def __init__(self, enable_hinting, style_for, get_image_from_uri,
self.tables = {}
self.dictionaries = {}

# TODO: this is probably the wrong place to put this
self.running_elements = {}

def create_block_formatting_context(self):
self.excluded_shapes = []
self._excluded_shapes_lists.append(self.excluded_shapes)
Expand Down
7 changes: 1 addition & 6 deletions weasyprint/layout/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,9 @@ def block_container_layout(context, box, max_position_y, skip_stack,
resume_at = (index, None)
break
elif child.is_running():
placeholder = boxes.RunningPlaceholder(
child.style['position'][1], child.style,
)
placeholder.index = index
new_children.append(placeholder)
context.running_elements.setdefault(
child.style['position'][1], {}
)[placeholder] = child
)[context.current_page - 1] = child
continue

if isinstance(child, boxes.LineBox):
Expand Down
3 changes: 0 additions & 3 deletions weasyprint/layout/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,6 @@ def make_page(context, root_box, page_type, resume_at, page_number,
if call_parse_again:
remake_state['content_changed'] = True
counter_lookup.parse_again(page_counter_values)
if isinstance(child, boxes.RunningPlaceholder):
elements = context.running_elements[child.identifier]
elements[page.page_type.index] = elements[child]

if page_type.blank:
resume_at = previous_resume_at
Expand Down

0 comments on commit 0a403d9

Please sign in to comment.