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

Re: Idea: background-image-frame attribute

From: Orion Adrian <orion.adrian@gmail.com>
Date: Sat, 31 Dec 2005 11:05:38 -0500
Message-ID: <abd6c8010512310805k279542c5xb9d9016bece42b2f@mail.gmail.com>
To: www-style@w3.org

On 12/31/05, Andrew Fedoniouk <news@terrainformatica.com> wrote:
>
> Thanks, David,
>
>
> ----- Original Message -----
> From: "L. David Baron" <dbaron@dbaron.org>
>
> >On Thursday 2005-12-29 14:22 -0800, Andrew Fedoniouk wrote:
> >>     background-image: url(nextpage.png);
> >>     background-image-frame: 0px 0px 10px 10px;
> >
> >This has already been proposed for replaced elements:
> >  http://www.w3.org/TR/2003/WD-css3-content-20030514/#the-crop
> >and a more general solution that solves both problems at once (like the
> >one proposed in [1]) would be vastly preferable to adding a new property
> >for each property that accepts image values.  For example:
> >
> >  background-image: image-rect(nextpage.png, 0px, 0px, 10px, 10px);
> >
> >This value could then be used everywhere images can be used: 'content',
> >'list-style-image', etc.
>
> Agree, it is more reasonable. I was thinking about something similar.
> The only concern I have here: url must be placed in url() brackets as
> comma is a valid url symbol.
>
> image-rect( url(some.jpg),  0px, 0px,  10px, 10px )
>
> Ideally functions should support named  parameters:
>
> background-image: bitmap (
>    src: url(some.jpg),
>    clip-left: 0px,
>    clip-top: 0px,
>    clip-width:10px,
>    clip-height: 10px )

I'm not sure I agree with this last part. Most languages don't have
named parameters even though the idea has been around a long time. And
I'm referring to the ability to name them on the call, as opposed to
naming them in declaration.

> This is more generic as probably we may need to add more parameters in
> future
> and some of them will be optional.

Optional parameters can be handled without allowing named parameters
on the call. While I find the idea interesting, it would get very ugly
very quickly as functions started nesting. You've also got the problem
that CSS treats missing values in lists differently than most other
languages treat them. CSS has unordered parameters, ordered list
parameters, and special syntax for certain parameters. For example:

border: solid black;
border-width: 2px 10px 2px;

Not specifying a width on the border property simply ignores it. Not
specify a value for border-width changes how it is interpreted. On is
optional parameters, and the other uses either optional parameters or
overloading. Though in this case using named parameters would be very
ugly and woud kind of defeat the whole point of shorthand properties.

> And in my opinion such things should be defined as rest of CSS, like:
>
> background-image: bitmap  {
>    src: url(some.jpg);
>    clip-left: 0px;
>    clip-top: 0px;
>    clip-width:10px;
>    clip-height: 10px;
>  }
>
> As in fact this is not a function in common sense but rather
> definition of some structure. Function imply some physical action and
> returning
> value which is not the case here I think.

Except it is returning a value, specifically image data. I think a
better expansion would be -- to show what's really going on -- is:

background-image: clipped-image(url(some.jpg), 0, 0, 100, 100);
background-image: image(url(some-already-clipped.jpg));

clipped-image or image-rect is just a specialized version of image,
which isn't ever explicitly used.

--

Orion Adrian
Received on Saturday, 31 December 2005 16:05:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:42 GMT