Commit Graph

46 Commits

Author SHA1 Message Date
Benjamin Otte
b356d81410 css: Split out a common function
It's used in two places already, and Iwant to use it in a third one.
2014-05-05 15:48:02 +02:00
Matthias Clasen
dbbb9c8f8f Plug a memory leak in the css parser
color_value_parse was leaking a GtkCssSymbolicValue.
Reported in

https://bugzilla.gnome.org/show_bug.cgi?id=702034
2013-09-16 23:30:57 -04:00
Alexander Larsson
6cc5d29792 Use gdk_cairo_surface_create_from_pixbuf when possible 2013-07-03 14:39:25 +02:00
Matthias Clasen
f5f5b70355 Ignore deprecations where needed
There are a few places where we are still using deprecated
API internally - ignore deprecations around these uses.
2013-05-05 15:38:48 -04:00
Benjamin Otte
cbee390148 cssvalue: At cycle detection to color resolving
The following CSS would infloop:

@define-color self @self

as it would infinitely lookup the color named "self" and try to resolve
it. This patch adds detection of such cycles to the resolve function by
keeping a list of currently resolving colors in the cycle_list variable.
2013-03-28 23:18:59 +01:00
Benjamin Otte
41486895d5 deprecations: Move files into deprecated/ dir 2012-11-25 04:16:43 +01:00
Benjamin Otte
0862afaded gtkgradient: Deprecate 2012-11-25 03:47:51 +01:00
Benjamin Otte
fb643c1c12 symboliccolor: Deprecate
Symbolic colors are an implementation detail of the CSS engine and have
been superceded by GtkCssColorValue. We don't want them clobbering the
public API. In particular because the only use I could find in the
public API is people using it to shade colors.
2012-11-25 03:43:28 +01:00
Benjamin Otte
08ac1504d2 symboliccolor: Implement using GtkCssValue 2012-11-25 02:41:17 +01:00
Benjamin Otte
94b80cc774 symboliccolor: Change prototype of function
Makes it easier to use the function in the places where it's still used.
2012-11-24 21:56:47 +01:00
Benjamin Otte
046d004725 gradient: Add a private header file 2012-10-02 14:16:36 +02:00
Benjamin Otte
1454ba15ba css: Huge refactoring to avoid computing wrong values
Here's the shortest description of the bug I can come up with:
When computing values, we have 3 kinds of dependencies:
(1) other properties ("currentColor" or em values)
(2) inherited properties ("inherit")
(3) generic things from the theme (@keyframes or @define-color)
Previously, we passed the GtkStyleContext as an argument, because it
provided these 3 things using:
(1) _gtk_style_context_peek_property()
(2) _gtk_style_context_peek_property(gtk_style_context_get_parent())
(3) context->priv->cascade

However, this makes it impossible to lookup values other than the ones
accessible via _gtk_style_context_peek_property(). And this is exactly
what we are doing in gtk_style_context_update_cache(). So when the cache
updates encountered case (1), they were looking up the values from the
wrong style data.

So this large patch essentially does nothing but replace the
context argument in all compute functions with new arguments for the 3
cases above:
(1) values
(2) parent_values
(3) provider

We apparently have a lot of computing code.
2012-09-28 18:27:49 +02:00
Benjamin Otte
5c4fc16cd4 css: Don't crash when printing gradients
... in the fallback code. Instead print a FIXME.
2012-09-28 18:27:49 +02:00
Benjamin Otte
3a65fbfc13 cssvalue: Implement dependency tracking for gradients 2012-08-28 15:42:25 +02:00
Benjamin Otte
3cf6db8b1a cssvalue: Handle dependencies for typed values 2012-08-28 15:42:24 +02:00
Benjamin Otte
11d0f9e408 css: Make color lookup handle dependencies 2012-08-28 15:42:24 +02:00
Benjamin Otte
1367ef7e54 cssstylefuncs: Remove base argument
The GtkCssParser keeps track of the base file now.
2012-05-11 16:42:12 +02:00
Benjamin Otte
e1317268a3 cssparser: Change APIs that work with files
Now that we keep track of the parser's file, we don't require it to be
passed anymore.
2012-05-11 16:42:12 +02:00
Benjamin Otte
40283e7c27 cssvalue: Split out old value handling to new typed value
... and Make this new value be a real GValue, as we don't need to save
performance for these anymore (it's just used for custom properties).
And I'd rather have code work for all values then be optimized for no
reason.
2012-04-17 08:59:20 +02:00
Benjamin Otte
0111b9d507 symboliccolor: Treat it as a CssValue
.. now that it is one.
2012-04-17 08:59:20 +02:00
Benjamin Otte
51da8cb263 symboliccolor: Parse 'currentColor' everywhere 2012-04-17 08:59:20 +02:00
Benjamin Otte
04c5fdaca6 css: Remove old animation code
Deprecate public API where appropriate and make it no-ops.
Remove all calls to it.
Get rid of the 'transition' css property.

For now, this means spinners don't animate anymore.
2012-04-17 08:59:19 +02:00
Benjamin Otte
f785f7177c cssvalue: Add a custom value for repeats
In particular, that's background-repeat and border-image-repeat.

Also, fix up the border-image shorthand to allow any order.
2012-04-17 08:59:18 +02:00
Benjamin Otte
31565139ba stylecontext: Convert _gtk_style_context_peek_property()
Take the property id instead of the name.
2012-04-17 08:59:15 +02:00
Benjamin Otte
58b6d492b8 cssvalue: Add a custom RGBA value
Note: custom CSS properties still use the default GtkCssValue and always
will.
So there is a difference in css values used between those, even though
they both carry a GdkRGBA payload.
2012-04-17 08:59:14 +02:00
Benjamin Otte
645309e98b shadow: Also rename files 2012-04-17 08:59:14 +02:00
Benjamin Otte
a33df2d1d6 cssvalue: Split number values into their own class 2012-04-17 08:59:13 +02:00
Benjamin Otte
7fbc583b88 css: Move shadow parse/print/compute funcs
They don't belong in the style funcs, as those are for custom
properties, and the shadow type is private.
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
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
893807bee0 css: Add GtkCssNumber 2012-02-02 03:14:00 +01:00
Benjamin Otte
c2fb315878 css: parse 'currentColor' for symbolic colors 2012-02-02 03:13:38 +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
Matthias Clasen
5c10f8ce8c Pedantic spelling fix
Its 'theming', not 'themeing'.
2012-01-23 16:48:02 -05:00
Benjamin Otte
9770184643 css: Fix memleak in shadow parsing 2012-01-18 10:46:46 +01:00
Cosimo Cecchi
d1f3fe4342 parser: remove a duplicate copy of gtk_css_parse_url()
Move the function to gtkcssparser.c and use it in both places.
2012-01-13 17:55:53 -05:00
Christophe Fergeau
ba2d3d1469 Remove duplicate definition of GtkStylePrintFunc 2012-01-11 13:10:28 +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
Paolo Borelli
fee09e726f Introduce _gtk_css_parser_try_length
This starts to introduce the proper API abstraction for when we will
support different units
2012-01-09 18:37:58 +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
d021ed7c5e win32: Remove GtkWin32ThemePart
Its job is done by GtkCssImage now.
2012-01-09 18:37:57 +01:00
Benjamin Otte
cdd4ed6600 styleproperty: Use factored-out gradient parser 2012-01-09 18:37:56 +01:00
Benjamin Otte
e87cf5d789 css: Redo value resolving
Instead of on-demand resolvage, we now resolve during lookup. The step
is done via
  _gtk_css_style_property_compute_value()
which currently calls into
  _gtk_css_style_compute_value()
That function has all the old resolving machinery.

The only part missing for now is the handling of win32 code. It will be
added back later.
2012-01-09 18:37:55 +01:00
Benjamin Otte
078fc725e0 css: Split generic parse/print functions out
It seems to be some sort of sport for me to split them out and merge
them back in...
2012-01-09 18:37:53 +01:00