Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page break after avoid #201

Merged
merged 5 commits into from
Jun 19, 2014
Merged

Conversation

jdus
Copy link
Contributor

@jdus jdus commented May 27, 2014

Respect page-break-after-avoid of previous element(s), when pushing floats to the next page.

@SimonSapin
Copy link
Member

This should use last_in_flow_child and block_level_page_break instead of new_children[-1].style.page_break_after. Other than that, looks good!

@jdus
Copy link
Contributor Author

jdus commented May 28, 2014

But then I will have to update last_in_flow_child myself, like this:

for previous_child in reversed(new_children):
    if previous_child.is_in_normal_flow():
        last_in_flow_child = previous_child
        break
if new_children and block_level_page_break(
        last_in_flow_child,
        child
    ) == 'avoid':
    result = find_earlier_page_break(
        new_children, absolute_boxes, fixed_boxes)
    if result:
        new_children, resume_at = result
        break
resume_at = (index, None)
break

Because at this point last_in_flow_child == child, which is the "current" element, not the previous.

@SimonSapin
Copy link
Member

Ok, maybe not last_in_flow_child if it’s not what you need, but still block_level_page_break() in order to check for page-break-before in addition to page-break-after, and look not only at the two sibling elements but also their last/first child, recursively.

@SimonSapin
Copy link
Member

Look good. Merged, thanks! (By the way, please comment when you push new commits, as I do not get notified otherwise.)

SimonSapin added a commit that referenced this pull request Jun 19, 2014
@SimonSapin SimonSapin merged commit 1e4a6ea into Kozea:master Jun 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants