[webkit-dev] Adding CSS3 background-position offsets.

Alexis Menard alexis at webkit.org
Mon Dec 3 04:51:17 PST 2012

Hi everyone,

I wanted to let you know that I have added the new CSS3
background-position offsets support to WebKit.

This support is behind the ENABLE_CSS3_BACKGROUND feature define and
it's disabled by default on all ports. I took the conservative
approach despite it's a cool feature.

Long story short, it allows you to specify three or four values to
background-position. It's a nice addition as you can now position the
images using length or values in relation to any of the four corners
of elements, not just the top left corner.

Opera, IE10 and Firefox implements this feature already (though the
latter returns weird results using getComputedStyle).

It is tracked by https://bugs.webkit.org/show_bug.cgi?id=37514 and the
two patches landed (parsing and rendering) are
http://trac.webkit.org/changeset/135632 and

I believe the <position> type (3-4 values) could be/or is used in
other cases so we can reuse the parsing code for four/three values if
needed. I will investigate this afterwards and make appropriate

I plan to enable it by default on Qt and EFL ports this week. If
somebody wants me to enable it on their ports please tell me, I'll be
happy to do it.

Looking forward to your comments.

Spec : http://www.w3.org/TR/css3-background/#the-background-position

Software Engineer @
Intel Open Source Technology Center

More information about the webkit-dev mailing list