Commit Graph

32 Commits

Author SHA1 Message Date
Cosimo Cecchi
b821f132d1 GtkCssImage: formatting fixes 2015-11-21 14:52:18 -08:00
Jasper St. Pierre
ce75c835e1 cssimage: Don't start a transition if the start and end are the same
Since a lot of Adwaita sets transition: all, it's easy to end up in a
state where we're making dummy transitions for all of the icons, most of
which we'll never be showing.
2015-08-02 12:57:31 -07:00
Benjamin Otte
da25771e58 cssvalue: Remove GtkCssDependencies
They are not used anymore.
2015-03-18 15:23:31 +01:00
Benjamin Otte
1116914ea0 css: Move scale to GtkStyleProviderPrivate
This way, we can remove it as a separate argument from
gtk_css_value_compute() and allow computation to only depend on one
thing: the style provider.
2015-02-06 11:26:31 +01:00
Benjamin Otte
572f46067f cssstyle: Rename GtkCssComputedValues => GtkCssStyle
This is literally just renaming of the object (and the associated source
files). No other changes are in there.
2015-01-07 14:26:46 +01:00
Benjamin Otte
27b9efbea2 cssimage: Fix size computation for -gtk-icontheme()
For images without a concrete size but with an aspect ratio, we took the
wrong code path.

(I even copied the documentation that said "Otherwise" but didn't put an
else clause there, go me!)
2014-07-23 18:51:26 +02:00
Benjamin Otte
633ec8184d css: Add support for -gtk-icontheme("icon-name")
This allows using icons from the icontheme as images in CSS. The
reasoning is that this allows to give the image control about how it's
scaled (by using the icon theme's scaling method. So we can get crisp
images at different resolutions.
2014-05-14 04:28:33 +02:00
Benjamin Otte
04b7c8e24e cssimage: Remove unused variables 2013-09-06 03:04:09 +02:00
Alexander Larsson
854f5818f8 Sync with changes in the cairo device-scale handling
The version of device scale that landed in upstream cairo
master already inherits the device scale in cairo_create_similar,
so no need to do that in gtk anymore.
2013-09-05 19:30:23 +02:00
Alexander Larsson
499cef1bb0 css: Inherit device scale in _gtk_css_image_get_surface
To handle hidpi support we need to make sure we don't
downscale scaled css images.

Note: If cairo_surface_create_similar starts doing this
by itself we need to back this out.
2013-08-05 16:14:25 +02:00
Alexander Larsson
48ff7d026e CSS: Add -gtk-scaled(image1,image2,...) support for hidpi assets 2013-07-03 14:39:25 +02:00
Alexander Larsson
af2c40bd54 css: Add a scale argument to css-value compute vfunc
We need to be able to compute different GtkCssImage values
depending on the scale, and we need this at compute time so that
we don't need to read any images other than the scale in used (to
e.g. calculate the image size). GtkStyleProviderPrivate is shared
for all style contexts, so its not right.
2013-07-03 14:39:25 +02:00
Benjamin Otte
016647edb1 cssimage: Add a warning for drawing empty images
width and height of an image must be > 0 for the image to get drawn.
It's up to the code further up to ensure that this is not happening.
2012-10-31 11:09:10 +01:00
Benjamin Otte
c13efbf8b0 cssimage: Add an equal vfunc
No implementations for it exist yet.
2012-10-31 11:09:10 +01:00
Benjamin Otte
12683da8f7 gtk: Make functions static that don't need to be non-static
Also remove the starting underscore from function names where
appropriate, as those functions are static now and not exported anymore.

This is part of a bunch of fixes for gcc complaining about
-Wmissing-declarations.
2012-10-02 19:32:51 +02:00
Benjamin Otte
a67bf5fde4 cssimage: Only create fades if we are actually fading 2012-10-02 14:16:36 +02:00
Benjamin Otte
558ffc24c2 cssimage: Make image transition a vfunc 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
e1a1432bd3 cssimage: Implement dependencies for images 2012-08-28 15:42:25 +02:00
Benjamin Otte
9b4ed66218 css: Pass property_id to compute function
This is a reorganization of how value computing should be done.
Previously the GtkCssStyleProperty.compute vfunc was supposed to take
care of special cases when it needed those for computation. However,
this proved to be very complicated in cases where values were nested and
only the last value (of a common type) needed to be special cased.

A common example for this was the fallback handling for unresolvable
colors.

Now, we pass the property's ID along with all compute functions so we
can do the special casing where it's necessary.
Note that no actual changes happen in this commit. This will happen in
follow-ups.
2012-08-28 15:40:56 +02:00
Benjamin Otte
c9f01ffb43 cssimage: No need to pass base file anymore
The file is now part of the GtkCssParser
2012-05-11 16:42:12 +02:00
Benjamin Otte
d853a8f2f7 cssimage: Add GtkCssImageCrossFade
Supports the cross-fade() css notation the way the old CSS3 specs did.

The main reason for adding it is supporting image transitions though.
2012-04-17 08:59:16 +02:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Benjamin Otte
811e848832 css: Implement repeating linear gradients 2012-02-02 03:14:00 +01:00
Benjamin Otte
5df9b0188a css: Implement CSS 3 linear-gradient() syntax 2012-02-02 03:14:00 +01:00
Benjamin Otte
a43553ab86 cssimage: Add _gtk_css_image_can_parse()
Looks at the first token of the stream to see if this looks like an
image declaration. If it does: return %TRUE.
2012-01-09 18:37:58 +01:00
Benjamin Otte
2bb899b5c0 cssimage: Add a few convenience functions 2012-01-09 18:37:56 +01:00
Benjamin Otte
2a6c168235 win32: Add a CssImage implementation 2012-01-09 18:37:56 +01:00
Benjamin Otte
f7eea0b86e cssimage: Add GtkCssImageGradient 2012-01-09 18:37:56 +01:00
Benjamin Otte
950b95af40 cssimage: Improve new_parse() to select right image type 2012-01-09 18:37:56 +01:00
Benjamin Otte
11ec705133 css: Add image implementation for urls 2012-01-09 18:37:56 +01:00
Benjamin Otte
b3389a017a css: Add GtkCssImage class
Doesn't do anything yet, just exists.
2012-01-09 18:37:56 +01:00