Re: [css3-books] Re: [css3-gcpm] Leaders layout corner cases

Brad wrote:

 > This is really a separate question, but related. The spec talks
 > about "the line" and empty space space. The step before the one
 > quoted says "Determine the empty space left on the line."
 > 
 > It seems like both "the line" and "empty space" should be defined
 > more concretely.

Good feedback. I've qualified the term "line" in the first mentioning:

  To determine the length of the leaders, user agents must do the
  following for each line where a leader appears

  http://books.spec.whatwg.org/#leaders

As for "empty space", I can see problems as we move into
shrinkwrap-land. See below.

 > Maybe it is more obvious if you are dealing only
 > with inline elements (or inline pseudo-elements). But what if the
 > item that has the leader content is an inline block and/or if that
 > item is inside an inline block?  Do you do make the inline block as
 > big as you can (up to its width or max-width) to fill out the line
 > outside the inline block, or does the inline-block shrink to fit
 > the minimal leader length?

Good questions. I've added more text to -- hopefully -- answer your yestions. 

  Determine the empty space on the line. The empty space is the
  difference between the width of the line box (as per CSS 2.1,
  section 9.4.2) and the formatted content in the line box. For table
  cells in automatic table layout, the empty space is the difference
  between the "minimum content width" and the "maximum content width"
  (as per CSS 2.1 17.5.2.2).

The table cell description probably needs refinement as it would only
work if there is one cell with leaders in a row. Hmm.

 > What if the leader element/pseudo-element is floated? Or is wrapped
 > in something that is floated? What is 'the line' in that case
 > (there might be several lines outside the float with much smaller
 > line heights, for instance)?

I don't see that finding the line is problematic. The line is simply
the line where the formatter puts the leader. If that sounds too
simple, exchange the leader value with "foo" and see where "foo" ends
up. That's the line of the leader. 

 > Does it grow in width to fill its
 > container if there is no other content?

Yes. That's empty space, for sure.

 > Or if there is some sibling
 > text, is that text pushed to the right by the leader that is
 > filling the rest of the space? 

Yes. In the writing direction. Here's my current description:

  The string inside the parenthesis is called the leader string. The
  leader string must be shown in full at least once, thereby pushing
  other content to the side (in the writing direction of the element
  to which the leader is attached). The leader string establishes the
  minimum length of the leader. If there is empty space on the line,
  the leader is repeated as many times as possible. The expansion of a
  leader from its minimum length never causes line breaks to change.
  At the end of the leader, a partial leader string may be shown.
  White space in the leader string is collapsed according to the
  values of white-space properties.

 > What happens if the leader element/pseudo-element is absolutely
 > positioned? Or maybe it is not itself absolutely positioned, but
 > it's parent is, with an auto width? Is that width affected to grow
 > infinitely, or only enough to contain the minimal size leader?

These cases should be handled be the description above.

 > The spec does say, "These properties influence the appearance of
 > leaders: all font properties, text properties, 'letter-spacing',
 > white-space properties, background properties, and 'color'." I
 > guess it means only those properties can change any initial values
 > at all, if the cascaded value of 'content' is a leader(). Is that
 > practically enforceable on something based on the content value
 > only? Suppose I have this:
 > 
 > div { content: leader(dotted); }
 > 
 > Does that negate the 'display' value for DIVs in the UA stylesheet
 > and make DIVs into inline elements? Sort of like the opposite
 > effect of how floating something makes it into block display?

No, the presence of a leader doesn't change any values on other
properties. In your example, it would only mean that DIV is shown
with one line of dots instead of its normal content. 

 > The spec also says, "the leader string is repeated as many times as
 > possible in the writing direction". What if the leader element is
 > between two words that each have opposite writing directions?

Good point. Changed to indicate that it's the writing direction of the
leader we're talking about.

 > I think I can imagine what the answers to some of these questions
 > should be, and maybe some are answered somewhere else, but I think
 > the spec could be made more clear on such points.

Yes. Nice feedback. Let me know if you see further improvements.

-h&kon
              Håkon Wium Lie                          CTO °þe®ª
howcome@opera.com                  http://people.opera.com/howcome

Received on Saturday, 26 October 2013 14:46:45 UTC