Commit Graph

42 Commits

Author SHA1 Message Date
Benjamin Otte
bc9060a591 styleproperty: Make gtk_style_property_register() not be valist
Instead, make the caller create a GtkCssValue in advance.
2012-04-17 08:59:12 +02:00
Benjamin Otte
9b7640b898 styleproperty: Make _gtk_style_property_parse_value() return a CssValue
Also split out initial/inherit handling into a custom GtkCssValue class.
2012-04-17 08:59:11 +02:00
Benjamin Otte
df45983fcb cssvalue: Remove _gtk_css_value_new_take_gvalue()
Having two constructors from GValues complicates refactorings, so I'd
rather not have them.
2012-04-17 08:59:11 +02:00
Benjamin Otte
58e4fdf911 styleproperty: Make print_func take a GtkCssValue
Also, constify GtkCssValue getters, so we can pass a const GtkCssValue
to the print_func.
2012-04-17 08:59:11 +02:00
Benjamin Otte
3cdb9c91ca styleproperty: Add support for equal_func 2012-04-17 08:59:11 +02:00
Benjamin Otte
5bbf59b519 cssvalue: Constify a bunch of APIs 2012-04-17 08:59:10 +02:00
Benjamin Otte
8b5910f8d7 styleproperty: Fix thinko
Introduced in 8243b16ad7 - seems I wasn't
really on top of my own capabilities on Saturday.
2012-04-09 20:33:46 +02:00
Benjamin Otte
8243b16ad7 styleproperty: Save some memory
Only create a new CssValue when we actually need one.
2012-04-09 03:14:51 +02:00
Alexander Larsson
e65a2709a3 css: Support background-position property 2012-03-17 05:13:22 +01:00
Alexander Larsson
616cc5b96d Use GtkCssValue in symbolic color resolving
We now store the symbolic colors as a GtkCssValue which means that
we can reuse the color when resolving and storing the color in
the computed values in the style context.

Additionally we keep a last_resolved GtkCssValue cache in the
GtkSymbolicColor, and if resolving the color returns the same as
last time we reuse the old value. This further increases sharing
of Css Values.
2012-03-08 14:52:10 +01:00
Alexander Larsson
7603e6e473 css: Use GtkCssValues instead of GValue in the css machinery
Also, in places where we're computing a new CssValue based on an
old one, make sure that if nothing changes we're returning a reference
to the old one, rather than creating a new identical instance.
2012-03-08 11:03:57 +01:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Benjamin Otte
e84af235ee css: Implement padding as numbers
Also remove the now unused border parsing function for shorthands.
2012-02-02 03:14:02 +01:00
Benjamin Otte
3c4b8a676f css: Port margin properties to GtkCssNumber 2012-02-02 03:14:01 +01:00
Benjamin Otte
1979d048d3 css: Implement parsing for 'background-size' 2012-02-02 03:14:01 +01:00
Benjamin Otte
a63ff72406 css: Convert border-radius to GtkCssNumber
We can do % now, wohoo!
2012-02-02 03:14:00 +01:00
Benjamin Otte
762ea4793f css: Make border-width a length property 2012-02-02 03:14:00 +01:00
Benjamin Otte
032e8f9f9b styleproperty: Simplifiy registering function
... and rename it to conform to the actual type.

We don't need 2 registering functions anymore now that we can use the
specified type.
2012-02-02 03:13:58 +01:00
Benjamin Otte
c8786c3b97 css: color_compute no longer needs to check type
The input is always a symbolic color.
2012-02-02 03:13:38 +01:00
Benjamin Otte
5e5e8367ce css: Initialize value before calling compute function 2012-02-02 03:13:38 +01:00
Benjamin Otte
f7e0ce3b28 css: Initialize values to their specified type
.. when parsing.
2012-02-02 03:13:38 +01:00
Benjamin Otte
9fa764abec styleproperty: Introduce "specified type" and "computed type"
Make the types explicit. This way, we can actually do useful stuff with
them (like sanity checks, d'oh).
2012-02-02 03:13:34 +01:00
Benjamin Otte
05f14af24c css: Make the 'currentColor' keyword a symbolic color
This is the first step on a quest to ensure that there is only ever one
GType in use for GValues in every stage of the CSS resolving process.
2012-02-02 00:40:33 +01:00
Benjamin Otte
4a33eb1aae styleproperty: Fix 'currentColor'
It was always looking at the 'color' keyword for the parent context
instead of only doing that when used with the 'color' property.

Tested by border-color-default.ui reftest.
2012-01-12 04:38:33 +01:00
Benjamin Otte
e9cd339573 css: Add outline CSS properties 2012-01-09 18:38:00 +01:00
Benjamin Otte
fbde62d8e7 css: border-style: hidden computes a 0 border 2012-01-09 18:37:59 +01:00
Benjamin Otte
2c5a8420b5 Set border-width to 0 in compute function
This reverts commit c276f53796 and
implements the same feature using the compute function.
A nice side effect is that gtk_style_property_get_border() and
gtk_style_property_get("border") to the same thing now.
2012-01-09 18:37:58 +01:00
Paolo Borelli
e69f14cf2b Add border-{top|left|bottom|right}-style properties
Add all the border-style subproperties and turn border-style itself in a
shorthand.
2012-01-09 18:37:58 +01:00
Benjamin Otte
bc9373fb43 styleproperty: Parse all values for background-repeat
... and its component in the background property.
2012-01-09 18:37:58 +01:00
Benjamin Otte
4b7ca9602d background: Simplify background-repeat
It used to be a struct, now it's just an enum
2012-01-09 18:37:58 +01:00
Benjamin Otte
af8dd87867 styleproperty: Use a custom resolve function for colors
We want to make sure to fall back to the initial value of the property
if resolving fails.

This is kinda tricky, because the initial value itself might need
resolving, too.
2012-01-09 18:37:57 +01:00
Benjamin Otte
839b0f5317 css: Handle 'currentColor' special value
Computes to the value of the 'color' property, or when used on that
property, is treated as 'inherit'.
2012-01-09 18:37:57 +01:00
Benjamin Otte
6dfab12e1b styleproperty: Change order for property registration
Some properties depend on other properties, handle those first.
2012-01-09 18:37:57 +01:00
Benjamin Otte
37b11b6c8a borderimage: Convert to using GtkCssImage 2012-01-09 18:37:57 +01:00
Benjamin Otte
0bc170cd84 styleproperty: Convert background-image from pattern to GtkCssImage 2012-01-09 18:37:56 +01:00
Benjamin Otte
e8cb6f3165 styleproperty: Add compute_value vfunc 2012-01-09 18:37:55 +01:00
Benjamin Otte
c3d337312a styleproperty: Move parse/print vfuncs to GtkCssStyleProperty 2012-01-09 18:37:55 +01:00
Benjamin Otte
22e9588dad styleproperty: Stop using pspecs
The pspec type is wrong most of the time anyway.
2012-01-09 18:37:55 +01:00
Benjamin Otte
65f6925dd1 styleproperty: Don't use gtk_style_properties_register_property()
This would make the internal properties custom properties. And they are
not.

Also get rid of default initial values, we now specify the correct one
at all times.
2012-01-09 18:37:55 +01:00
Benjamin Otte
4b4792f65d styleproperty: Make the register functin take varargs
.. for the initial value.
2012-01-09 18:37:55 +01:00
Benjamin Otte
09b25facb0 styleproperty: Don't register a property parse func
Nobody does that anymore.
2012-01-09 18:37:54 +01:00
Benjamin Otte
8bcfa6ef78 styleproperty: Move implementations to separate file 2012-01-09 18:37:54 +01:00