This is a private type, and the CSS default value is "stretch", which
is how we were parsing and printing NONE anyway.
With this fix we can use the enum stuff for printing/parsing
At the toplevel we have _gtk_theming_engine_get, which lets us pass
in a property context with (atm) the size to get the property for.
Then there is a lot of plumbing to push this down into the lower
layers of the style property code until finally hitting
the property resolvers.
I need this because I will be adding a property resolver for win32
theme parts, and they render differently depending on the size
(i.e. they don't scale linearly). The idea is that the code
to get the background properties will pass in the final size
and we will resolve the theme part specification to that particular
size.
If the old non-context calls are used we just hardcode a size
of 100x100.
We used to special handle gradient, but we want to be able to store
other sources (that will eventually resolve to cairo patterns).
For instance, this is needed to handle win32 theme part sources.
gtk/gtkborderimage.c, gtk/gtklabel.c and gtk/gtkstyleproperty.c call
round() and/or rint(), which was only available in C99 compilers.
This adds the inclusion of the fallback implementation (gtk/fallback-c89.c)
to define these functions if they are not initially made available by the
compiler.
Also remove the rint() implementation in gtk/gtklabel.c as it is now in
the fallback implmentation.
It's useful to set a slice size != border-width, as backgrounds are
clipped to border-width too.
As slices can be half-transparent and overlap the background,
this would not fill the border box properly if we only use a single
property for specifying the width.
Also, this brings us even closer to CSS3.
NULL is a valid value for border-image, so if it's NULL when unpacking,
don't try to access the struct fields, but just init the GValues for the
unpacked parameters.
The new code is smaller, less crashy and correct(er), but arguably more
complex. I'd have liked to make it simpler, but this border image
algorithm is complex...
It's not useful to cache these surfaces here, as the GtkBorderImage will
be always generated on the fly, being a shorthand property.
This also allows to get rid of the intermediate image surfaces for
rendering the slices; we now use cairo_surface_create_for_rectangle()
to proxy the slices from the source surface to the rendered area, which
should also yield better performance.