Re: [css-backgrounds] border-image with an SVG resource that has no intrinsic size

On Wed, Jun 17, 2015 at 2:27 AM, Brad Kemper <brad.kemper@gmail.com> wrote:

> OK, so, I am no SVG expert (far from it). But it looks to me (and feel free to correct me, and I'm probably overgeneralizing) that your examples are based on the idea that if the SVG element itself has width and height, then those are intrinsic sizes. And that if it has a viewbox, then that gives it an intrinsic ratio.

Sounds just about correct.

> I don't really understand how the width and height don't also imply a ratio

But it does. A width and a height gives the intrinsic ratio of the SVG
(and overrides any value from the viewBox).

>, or why the viewbox doesn't imply a width and height, but that's maybe due to my general SVG ignorance.

It does not, no. The actual values of viewBox are reserved for the
internal coordinate system of the SVG. Only the ratio is extracted.

> What I am suggesting is that if there is no viewbox, and no width or height, then intrinsic dimensions should be derived from the bounding box containing the content paths and shapes (and their strokes, filters, etc.), and their position offsets from 0,0. If you have both dimensions, then you have a ratio too.

There is no such thing at the moment, AFAIK. It has been suggested and
discussed before, I think. The proposal from Brian comes to mind:

https://lists.w3.org/Archives/Public/www-svg/2013Dec/0080.html

(point b, having viewBox accept 'auto')

It doesn't suggest doing it by default until we hypothetically
introduce new top-level element for SVG though (see issue 6). Probably
because of compatibility reasons but there may be other details here.

>> and what effect should that have in this case?
>
> This would mean that in your examples:
>
> #1) intrinsic size=100x100 based on green rect, therefore ratio=1:1
> #2) no intrinsic size or ratio, fills border image area
> #3) intrinsic size=100x100 based on viewbox (or based on green rect, if using viewbox that way is somehow illegal), ratio=1:1
> #4) intrinsic size=100x100, therefore ratio=1:1
> #5) no intrinsic size or ratio, fills border image area. This gives it a concrete size of 200px in both dimensions, so the slices are 33% of that (66px) all the way around.

I we had such a fallback it would be another matter I agree. But we
don't, AFAICT.

David

Received on Wednesday, 17 June 2015 07:03:06 UTC