- From: Brian Manthos <brianman@microsoft.com>
- Date: Thu, 9 Jun 2011 17:33:00 +0000
- To: Brad Kemper <brad.kemper@gmail.com>
- CC: fantasai <fantasai.lists@inkedblade.net>, Sylvain Galineau <sylvaing@microsoft.com>, "www-style@w3.org" <www-style@w3.org>
> -----Original Message----- > From: Brad Kemper [mailto:brad.kemper@gmail.com] > Sent: Thursday, June 09, 2011 10:06 AM > To: Brian Manthos > Cc: fantasai; Sylvain Galineau; www-style@w3.org > Subject: Re: [css3-images] linear-gradient keywords and angles are > opposite > > On Jun 9, 2011, at 9:20 AM, Brian Manthos <brianman@microsoft.com> > wrote: > > >> Behalf Of fantasai > >> Let's say I create a gradient like this: > >> > >> background: linear-gradient(left, blue, green); > >> > >> This will create a gradient with blue starting at the left edge of > the > >> box > >> progressing to green on the right edge of the box. > >> > >> Now suppose I create a gradient like this: > >> > >> background: linear-gradient(left, blue, green 10px); > >> > >> This will create a gradient with blue starting at the left edge of > the > >> box > >> and progressing to green at 10px from the start of the gradient, > i.e. > >> at > >> the left edge of the box, and continuing as green until the right > edge. > > > > background: linear-gradient(left, transparent 90%, blue 90%, green); > > > > With the current spec this will render a similar "colors on the > right" rendering. Is this one a problem for the "weird, the colors > should be on the left" way of thinking about things too? > > > > > > Again, the root issue is that angle and keyword specifications are > not consistent with each other in the prose or in the effect. One of > them should be change so the spec is self consistent across first > parameter formats. > > > > If you want it to mean "coming from <keyword>" then the angles should > behave the same way. > > Is there evidence that this is a major confusion point that needs > fixing? The issue is that you and at least a few others intuitively > take 'left' to mean "leftwards" instead of "from left", correct? > > If this really is a big issue, we could change 'left' (etc.) to 'from > left' (etc.) or 'towards right' (etc.). This would be OK with me, even > though I'd rather not. At least that way, authors could write multiple > versions of the declarations to handle the syntax changes between > versions (as they do now, when including '-webkit-gradient' and IE's > 'filter' property for simple horizontal or vertical gradients). Yes, "from<keyword>" would be better than what we have today (in either draft) because then angles and keywords wouldn't be opposite from each other. The cleaner fix is to just recognize that it's far simpler to consistently use the first parameter to specify the direction of a vector along the gradient line. Angles already match this model. The keywords are currently backwards relative to this model. For keywords that model would map to: "left" -> "leftwards" "right" -> "rightwards" "top" -> "topwards" "bottom" -> "bottomwards" >From there you might decide to switch to "upwards" and "downwards". You then might decide that "upwards" and "downwards" don't need "wards" for clarity, since they already define direction. If you then decide to remove it for all of them you get... "left" = "direction of gradient is right to left" "right" = "direction of gradient is left to right" "up" = "direction of gradient is from bottom to top" "down" = "direction of gradient is from top to bottom" And thus, finally, the root cause of the problem is obvious: The spec as currently authored decided to choose "left/right the start location" instead of "left/right the direction". Again, all of this leads to "use keyword to define the endpoint rather than the startpoint" and the spec becomes self-consistent and straightforward to everyone that doesn't insert "comes from" whenever they read a document with the word "left" or "right" in it. -Brian
Received on Thursday, 9 June 2011 17:33:45 UTC