W3C home > Mailing lists > Public > www-style@w3.org > December 2011

Re: [css3-background] SVG in border-image / background-image

From: fantasai <fantasai.lists@inkedblade.net>
Date: Mon, 19 Dec 2011 10:17:44 -0800
Message-ID: <4EEF7FC8.2090704@inkedblade.net>
To: Erik Dahlström <ed@opera.com>
CC: "www-style@w3.org" <www-style@w3.org>
On 05/26/2009 05:55 AM, Erik Dahlström wrote:
> Hi www-style,
>
> when a 'border-image' property[1] references an SVG image, how should the border parts be rendered?
>
> Doing a rasterization followed by e.g stretching when there's vector data available seems like a suboptimal solution.
>
> After having looked at the various scenarios, both where the SVG has a viewBox attribute and when it doesn't, the idea of splitting the viewBox rectangle using the cuts defined in CSS would seem the most logical and useful one. To be intuitive and easy to use that would imply that @preserveAspectRatio in the SVG must be ignored[2]. For the case where there's no @viewBox the behaviour could be defined to be as if there was a viewBox with value "0 0 width height", where the width and height are absolute values from the svg root element (and in case they need to be resolved, e.g percentage values, they are resolved using the size of the split border-image destination area).
>
> Please define the processing for the SVG-in-border-image case.

I'm sorry, I seem to have missed this message. Filed as ISSUE-208.
   https://www.w3.org/Style/CSS/Tracker/issues/208

> Also please consider defining something similar for when 'background-image' references an SVG that lacks a @viewBox. Opera currently treats it as if there was a viewBox with value "0 0 width height", where the width and height are absolute values from the svg root element (and in case they need to be resolved, e.g percentage values, they are resolved using the size of the background-image destination area). This makes the svg case more similar to the raster image case, and also makes it easier to reuse clip-art from svg graphic editors that don't add a @viewBox (rather common). Note however that @preserveAspectRatio is respected for 'background-image'.

If an SVG element has no 'viewBox', but has 'width' and 'height',
then it will be treated as having those given dimensions and sized
accordingly. How SVG paints inside the box CSS gives it is a matter
for SVG to determine.

If an SVG element has no 'viewBox', and no 'width' and 'height',
then it will be treated as having no intrinsic dimensions and
sized accordingly. Again, how SVG paints inside the box CSS gives
it is a matter for SVG to determine.

So I believe this is already defined, insofar as it can be, by CSS.

~fantasai
Received on Monday, 19 December 2011 18:18:10 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:47 GMT