W3C home > Mailing lists > Public > www-svg@w3.org > July 2008

Re: limitations of units and a proposed "percent+offset" extension

From: Doug Schepers <schepers@w3.org>
Date: Wed, 30 Jul 2008 04:12:17 -0400
Message-ID: <48902261.2020008@w3.org>
To: robert@ocallahan.org
Cc: www-svg <www-svg@w3.org>

Hi, Rob-

As I mentioned a while back, we are definitely interested in a layout 
module.  Cameron McCormack is laying much of the groundwork, but the SVG 
WG discussed your proposal and we think that it would fit in there.

I took the liberty of starting a module to start playing around with 
what we would need to specify:


Don't take anything in there too seriously, especially my terminology. :)

Let me know what you think.  If you have implemented something like this 
in your bling build, I'd love to see it.

-Doug Schepers
W3C Team Contact, WebApps, SVG, and CDF

Robert O'Callahan wrote (on 6/30/08 12:40 AM):
> Currently, SVG units can express a coordinate N pixels from the top or 
> left edge of the viewport, but not from the right or bottom edge (unless 
> N is 0, in which case I can use %). So it's easy to draw a 10px-wide 
> rectangle along the left edge of the viewport, but not the right edge.
> I can work around this limitation in some cases by introducing an <svg> 
> container. For example, I can actually draw a 10px wide rectangle along 
> the right edge using
> <svg ...>
>   <svg x="100%" style="overflow:visible">
>     <rect x="-10" width="10" y="0" height="100%"/>
>   </svg>
> </svg>
> However, as far as I can tell there is no way to use this to draw, say, 
> a rectangle inset from the viewport by 10px on each side. (And of course 
> it's very ugly.)
> A very simple extension would be to allow length values like "50%-10". 
> This is necessarily trivial to implement since length interpretation 
> already requires support for viewport percentages and user-space units; 
> this just combines them into a single value.
> An important use-case for this is "nine-grid" image stretching (see e.g. 
> http://msdn.microsoft.com/en-us/library/bb189722.aspx). It would be very 
> useful if SVG images supported this, for example for use as background 
> images for flexible HTML content.
> Of course, SVG direly needs a real layout mechanism. But this is a very 
> small tweak that would provide a great deal of value.
> Rob
> -- 
> "He was pierced for our transgressions, he was crushed for our 
> iniquities; the punishment that brought us peace was upon him, and by 
> his wounds we are healed. We all, like sheep, have gone astray, each of 
> us has turned to his own way; and the LORD has laid on him the iniquity 
> of us all." [Isaiah 53:5-6]

Received on Wednesday, 30 July 2008 08:12:53 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:19 UTC