Re: [CSS2.1] Replaced elements

On Wednesday 2005-06-15 18:24 +0200, Staffan Måhlén wrote:
> One of the most important change in the new CSS 2.1 WD seems to be
> how to handle embedded content in replaced elements. The approach is
> to introduce a new concept, "intrinsic ratio" which is used to define
> how a CSS renderer shall calculate sizes of replaced elements
> containing content. The problem i have with this is that it dosen't
> seem to cover enough cases (types of embedded content) and may limit
> future additions in the area.

The idea here is that it applies to only those replaced elements that
have an intrinsic ratio, such as SVG.

> Whats the reason for choosing the approach that the CSS renderer
> needs to be aware of a ratio rather than that the embedded media
> needs to be made aware of the CSS constraints? The second would allow
> better handling for different types of media in my opinion, and the
> CSS renderer could still enfore its restrictions if the embedded 
> media was not capable of properly handling all the relevant CSS
> constraints.

I'm not sure what it is you're saying here, nor are others in the
working group.  Are you saying that the algorithm is fine, but it should
be defined in the other specs (e.g., SVG) rather than the CSS spec?
That seems like a bad idea to me since it's relatively easy to define
and harder to define an API through which other specs can define it.
If you still think the spec needs changing, could you clarify,
preferably with examples?

> Even with the change, i think the example
> http://www.w3.org/TR/2005/WD-CSS21-20050613/conform.html#replaced-
> element
> "(for example a blank HTML document)."
> should be removed since it would be good if HTML could be better used
> in embedding elements in the future (even a blank HTML document might
> be considered to have a minimum width/height due to default style).

Well, it has two intrinsic widths and a height function (to which width
is an argument).  At least when the block progression direction is
vertical.  This whole business would be quite difficult to define; it
could be considered for CSS3, but I think it's out of scope for CSS2.1
considering that it's a new feature and there are no current
implementations.

> One specific feature that i would like to see more described is how
> shrink-wrap on this type of replaced element is handled. Using 300px
> for that seems like a bad idea, and it seems more reasonable to leave
> it to the embedded media (eg SVG might choose to check if the viewbox
> attribute holds reasonable values, "text/plain" might check the
> widest line etc).

In CSS2.1, it's 300px largely because that's what implementations do.
(I'm not sure what the viewBox attribute has to do with it, but SVG with
width and height attributes has intrinsic dimensions.)

> Finally, does the table under 'max-width' still work when the
> replaced elements use the intrinsic ratio? 

Is the following change sufficient?

  Replace "In this table, w and h stand for the intrinsic width and
  height, respectively." with:

  "In this table <var>w</var> and <var>h</var> stand for the results
  of the width and height computations ignoring the 'min-width',
  'min-height', 'max-width' and 'max-height' properties. Normally
  these are the intrinsic width and height, but they may not be in the
  case of replaced elements with intrinsic ratios."

-David

-- 
L. David Baron                                <URL: http://dbaron.org/ >
          Technical Lead, Layout & CSS, The Mozilla Foundation

Received on Tuesday, 12 July 2005 21:39:09 UTC