run-in boxes

Hello!

Looking at both "CSS 2.1" and "CSS 3: the box model" I could not find out
how the following is supposed to be rendered:

Case A:

<div class="block">
    <div class="runin">Is this supposed</div>
    <div class="inline">to run in?</div>
</div>

Case B:

<div class="block">
    <div class="runin">Is this supposed</div>
    to run in?
</div>

Case C:

<div class="block>
    <div class="runin">Is this supposed</div>
    <div class="block">to run in?</div>
</div>

where 

block { display: block }
runin { display: run-in }
inline { display: inline }


Intuitively I would say, that in all three cases the text should be
displayed in a single line (if there is enough space). In Case C this is
the behaviour specified in CSS 2.1 and 3:

CSS 3: "If the next element [after a run-in element] [...] has a 'display-model' 
of 'block-inside', the current element will be rendered as if it had
display-role 'inline' and was the first child of that block element."

CSS 2.1: "If a block box follows the run-in box, the run-in box becomes the first
inline box of the block box."


However in cases A and B these excerpts do not seem to apply, instead

CSS 3: "Otherwise this element will be rendered as if it had
display-role 'block'."

CSS 2.1: "Otherwise, the run-in box becomes a block box."

which would cause the text to be renderd in two lines.


Thus, A and B are only rendered on one line, if
1) the run-in element is initially taken as a block-level element
2) the following inline element/text is wrapped in an anonymous block
   box
3) the following anonymous block box causes the run-in to become the
   first child of the anonymous box with display role "inline"

This "algorithm" seems highly confusing to me. In what order are
user-agents supposed to determine the display-roles of run-in elements
and whether or not an inline element needs to be wrapped in an anonymous
block box?  Is this specified anywhere? To answer the first question you 
need to know the answer to the second and vice versa.


I can understand that a W3 recommendation is not supposed to tell
implementors _how_ to implement a given behaviour. But in this case the
recommended behaviour can only be determined by guessing which algorithm
the authors of the spec had in mind. This makes implementing conforming
user-agents unnecessarily difficult.


Regards,
Felix Breuer

Received on Saturday, 11 October 2003 09:06:32 UTC