Re: orphans test

Matthew Ausonio wrote:
 > Hello Fantasai and Melinda,
 > My name is Matthew.  I have been working with Michael and the others at
 > Revenution for a couple of weeks now.
 > We have all been brainstorming over a set of test cases involving the
 > 'orphans' property.  After a few iterations, we have decided to submit one
 > of the cases to you for feedback along with a description of the challenge
 > we faced.
 >
 > http://revenutiontesting.com/w3c/breaks_inside_elements/t130302-orphans-syntax-01.xht
 >
 > The challenge with the orphans cases is that there could be more than one
 > correct outcome. I'll give you a brief description of the what I mean:
 > The orphans property decides the minimum number of lines of a paragraph
 > that are left at the bottom of a page when a paragraph is broken across
 > two pages. If, for instance, the orphans property is set to seven, but
 > there isn't enough space for at least seven lines, then the whole
 > paragraph will go to the next page and not break. On the other hand, if
 > there is enough space for seven lines on the first page, the paragraph
 > will break onto both pages, leaving seven lines on the first.  Both of
 > these outcomes are correct behavior.
 >
 > We decided to try and narrow down the possible correct outcomes by setting
 > the orphans property very high.  Thereby, always forcing it to push the
 > whole paragraph to the second page.  We would like your feedback as to
 > whether yo uwould consider this the right direction to go with cases of
 > this nature.

There's one major problem with your test: percentages on margin are relative
to the *width* of the containing block, not its height.


We do need a test for orphans that makes sure the entire paragraph gets shifted
over when the value of orphans is larger than the number of lines in the paragraph.
However, that test should use a small paragraph to ensure that the entire paragraph
fits on a single page even when the page is small. And we do still need tests for
other values of 'orphans': I'd test at least 0, 1, and 2.

I think I already outlined a way of leaving room for exactly X lines at the bottom
of a page in a previous message, but I can't find it so here it is again:

You can leave room for X lines at the bottom of the page by:
   a) Setting line-height: 1; and using a consistent font-size throughout
   b) Starting the page with two <div>s with height: 50%;
   c) Setting margin-top: -Xem; on the second div.
The two divs together will take up 100%-Xem space on the page, leaving Xem for
X lines of height 1em each.

If you want to make sure a paragraph has at least X lines, put at least X words in
it separated by spaces and make its width really narrow, e.g. 1em. If you use N
one-letter words and zero width you're pretty much guaranteed N lines. You can also
write some advanced tests using the Ahem font, which since it has 1em*1em glyphs
for the 'X' character can give you very precise control over line breaking.
   http://www.hixie.ch/resources/fonts/

You should also test the interaction of windows and orphans with <br> and
white-space: pre; with line breaks.

Adding public-css-testsuite, since others may benefit from this discussion.
(I shifted your address to BCC in case you didn't want it public.)

~fantasai

Received on Friday, 5 October 2007 06:16:53 UTC