Skip to content

Commit

Permalink
Don’t call page_values twice when it’s not needed
Browse files Browse the repository at this point in the history
Fix #1013.
  • Loading branch information
liZe committed Dec 21, 2019
1 parent eca2a6b commit 3f74dd9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions weasyprint/formatting_structure/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,14 @@ def get_wrapped_table(self):
def page_values(self):
start_value, end_value = super(ParentBox, self).page_values()
if self.children:
start_box, end_box = self.children[0], self.children[-1]
start_value = start_box.page_values()[0] or start_value
end_value = end_box.page_values()[1] or end_value
if len(self.children) == 1:
page_values = self.children[0].page_values()
start_value = page_values[0] or start_value
end_value = page_values[1] or end_value
else:
start_box, end_box = self.children[0], self.children[-1]
start_value = start_box.page_values()[0] or start_value
end_value = end_box.page_values()[1] or end_value
return start_value, end_value


Expand Down

0 comments on commit 3f74dd9

Please sign in to comment.