kdelibs/khtml

Martijn Klingens klingens at kde.org
Thu May 23 21:41:22 BST 2002


(Whoops, didn't notice you CC-ed kfm-devel on both your replies... sorry!)

On Thursday 23 May 2002 21:59, Waldo Bastian wrote:
> Well, there is the print-algorithm that splits up the document across pages
> and there is the khtml rendering algorithm. And those two pretty much live
> in a world of there own. The CSS margins live in the khtml-rendering world.
>
> I would like to be able to tell the khtml rendering not to use a margin at
> all and then let the print-algorithm provide margins that make sense,
> possibly taking into account values provided via CSS.

Or the other way round: let the renderer use a method

   uint minMarginLeft( const QString &mediaType );

which basically does

   return mediaType == "print" ? 2 cm : 0;

after which the margin as taken into account for the body element is set to

   MAX( minMarginLeft(), cssMarginLeft() );

and similar for the top, right and bottom margins (on a per-page basis, not 
per-flow, as printing is page based).

The troublesome parts are the repeated top/bottom margins on new pages and the 
clipping issues once the margin is > 0. No idea if those are easy to solve. 
The left and right margins and the top margin of the first page / bottom of 
the last page can be set with an algorithm like this I think.

The other troublesome part is of course that KHTML's renderer is a bit like 
voodoo magic for us mere mortals :-)

Martijn





More information about the kfm-devel mailing list