[webkit-dev] CSS values and multiple backgrounds
Dan Weber
dan.j.weber at gmail.com
Fri Jun 27 11:45:55 PDT 2014
This does appear to be a bug. Tested in Firefox, when I call
CSSStyleDeclaration.cssText with the following CSS:
background: url(http://example.com/image.png),
linear-gradient(rgb(255,0,0), blue) center top repeat-y scroll, 10px 10px
no-repeat scroll;
I get back:
background: url("http://example.com/image.png") repeat scroll 0% 0%,
linear-gradient(rgb(255, 0, 0), blue) repeat-y scroll center top, none
no-repeat scroll 10px 10px transparent;
Notice there are placeholders for all values, including position and
repeat. I will file a bug report.
Thanks,
Dan
On Fri, Jun 27, 2014 at 11:31 AM, Simon Fraser <simon.fraser at apple.com>
wrote:
> On Jun 27, 2014, at 11:26 AM, Daniel Weber <dan.j.weber at gmail.com> wrote:
>
> > I’m running into some trouble developing an app that needs to parse
> multiple CSS background values. The problem is that WebKit isn’t returning
> the same number of values for “background-image”, “background-position”,
> “background-size”, “background-repeat”, and “background-attachment”. If
> there are 3 background images, I would expect that all of the background
> properties contain 3 values, separated by commas. But that doesn’t seem to
> be the case. For example, I parse the following CSS text:
> >
> >> background: url(http://example.com/image.png),
> linear-gradient(rgb(255,0,0), blue) center top repeat-y scroll, 10px 10px
> no-repeat scroll;
> >
> >
> > I then call CSSStyleDeclaration.cssText and I get:
> >
> >> background-image: url(http://example.com/image.png),
> linear-gradient(rgb(255, 0, 0), blue), initial; background-attachment:
> initial, scroll, scroll; background-origin: initial, initial, initial;
> background-clip: initial, initial, initial; background-size: initial,
> initial, initial; background-position: 50% 0%, 10px 10px;
> background-repeat: repeat-y, no-repeat;
> >
> >
> > Notice that there are 3 values for background-image (a url, a gradient,
> and “initial” for the last one because it doesn’t specify an image). There
> are 3 values for background-attachment, background-origin, background-clip,
> and background-size. But the problem is with background-position and
> background-repeat. They only have 2 values because only 2 of the
> backgrounds specify these properties. But then how do I know that the first
> background does not specify a background-position or background-repeat? It
> seems to me there should be an “initial” placeholder for these properties.
> Am I missing something?
>
> Assuming other browsers get this right, please file a bug.
>
> Simon
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20140627/64ab6b0f/attachment.html>
More information about the webkit-dev
mailing list