[Webkit-unassigned] [Bug 5097] CSS2: page-break-after does not work

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 16 00:31:24 PDT 2009


--- Comment #12 from Andrew Chalmers <achalmers at ellex.com>  2009-09-16 00:31:22 PDT ---
Created an attachment (id=39635)
 --> (https://bugs.webkit.org/attachment.cgi?id=39635)
Simple patch to handle 'page-break-inside: avoid' in a similar manner to
page-break-before and page-break-after.

This is a simple patch to handle the CSS property 'page-break-inside: avoid' in
a similar manner to page-break-before and page-break-after.
Its clear that the page-break handling required some major rework. But this
might be sufficient in the mean time.

I've just been using the tool wkhtmltopdf to generate documents from a project
database. wkhtmltopdf uses WebKit to produce PDF file for URLs.
I ran into similar issues. After a little digging, I discovered the problem is
in WebKit itself. WebKit recognises page-break-inside but does not do anything
with it.
In fact the whole page break handling in WebKit is very limited, as is
evidenced by the following comment in RenderFlow.cpp:

// FIXME: This is a feeble effort to avoid splitting a line across two pages.
// It is utterly inadequate, and this should not be done at paint time at all.
// The whole way objects break across pages needs to be redone.
// Try to avoid splitting a line vertically, but only if it's less than the
// of the entire page.

Looking at how the page-break-before and page-break-after are handled in
RenderBlock.cpp I put together a patch to handle page-break-inside:avoid in a
similar manner. As with -before and -after -inside works only on non-floating
blocks and does not deal with multiple columns correctly. But it should be
sufficient until the the page-breaks are properly dealt with.

wkhtmltopdf uses the WebKit verion included in the Qt source distribution. I
also looked at the latest stable version of WebKit and there appears to have
been no change in the page-break handling as yet. wkhtmltopdf also includes
other Webkit and Qt patches that may be of interest.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list