Commit Graph

58 Commits

Author SHA1 Message Date
Benjamin Otte
83fb7a649f css: Merge GtkStyleProviderPrivate into GtkStyleProvider
This is just lots of renaming.

The interface remains private, so the public API does not change, apart
from removing the definition of the Interface object to avoid
subclassing.
2017-10-31 04:33:54 +01:00
Timm Bäder
fc47be9339 GtkStyleContext: Remove property cache
It was only used for widget style properties which don't exist anymore.
2017-07-19 21:27:16 -04:00
Benjamin Otte
1518fe0a8f API: stylecontext: Remove state argument from getters
The argument must always be the current state.
2016-10-16 18:18:58 +02:00
Benjamin Otte
71a9fd9d83 stylecontext: Move background_is_opaque() function
The new way, it no longer depends on the style context, but on the
CssStyle. This will become relevant in the next commit.
2016-02-25 16:52:58 +01:00
Benjamin Otte
ad22612ab2 iconhelper: Require passing a cssnode to the constructor
Note that we don't use it yet.
2015-12-15 08:41:16 -05:00
Benjamin Otte
5cbbc62026 widget: Pass a GtkCssStyleChange instead of a bitmask 2015-12-13 04:11:58 +01:00
Benjamin Otte
c075c14bf4 stylecontext: Add gtk_style_context_save_to_node()
To be used instead of gtk_style_context_save() with persistent nodes.
2015-10-22 16:35:14 +02:00
Benjamin Otte
72615a1b16 stylecontext: Add gtk_style_context_add_named()
This is an intermediate step for cssnode introduction. It gives a name
for the node created by saving the style context.
2015-10-22 16:35:14 +02:00
Christian Hergert
c1691a4964 stylecontext: add opaque background helper
This new private API, _gtk_style_context_is_background_opaque(), is meant to
be used by internal Gtk+ wigets to optimize fast paths for cases where
applicable. One such use would be to use a CAIRO_CONTENT_COLOR surface
instead of CAIRO_CONTENT_COLOR_ALPHA.

https://bugzilla.gnome.org/show_bug.cgi?id=754658
2015-09-13 13:41:19 -07:00
Paolo Borelli
a19331f231 label: add support for CSS letter-spacing property
Support letter-spacing CSS property on GtkLabel.
Reftest is included.
2015-07-06 00:04:05 +02:00
Benjamin Otte
3e5280ae4d stylecontext: Clear style property more frequently
We want to clear the style property cache whenever things change in the
tree, not as we previously did only when those changes actually lead to
a different CSS style.
2015-04-27 19:17:03 +02:00
Benjamin Otte
2ec26cd9b5 cssnode: Move style context function to only user 2015-03-18 15:23:32 +01:00
Benjamin Otte
da25771e58 cssvalue: Remove GtkCssDependencies
They are not used anymore.
2015-03-18 15:23:31 +01:00
Benjamin Otte
b92fe2fa85 widget: Add gtk_widget_get_css_node()
and replace gtk_style_context_get_root() with it.
2015-03-18 15:23:31 +01:00
Benjamin Otte
ffb410f11e widget: Create the CssNode
... and pass it to the style context instead of having the style context
create it for us.
2015-03-18 15:23:30 +01:00
Benjamin Otte
efda30c495 stylecontext: Don't queue animate tick callbacks anymore
Instead, just mark nodes permanently as invalid.
2015-03-18 15:23:30 +01:00
Benjamin Otte
c550cf122a stylecontext: Move gtk_style_context_validate() to GtkCssWidgetNode 2015-03-18 15:23:30 +01:00
Benjamin Otte
03ac5f310b cssnode: Add gtk_style_context_get_style_provider()
... and use it when looking up properties.
2015-03-18 15:23:29 +01:00
Benjamin Otte
4cc2af2db1 stylecontext: Move validation into GtkCssNode 2015-03-18 15:23:29 +01:00
Benjamin Otte
8e1017db35 stylecontext: Export gtk_style_context_get_root()
.. in the private header. This avoids tiny wrapper functions.
2015-03-18 15:23:29 +01:00
Benjamin Otte
55e68bc2ea cssnode: Track invalid flag
Remove it from GtkStyleContext.
2015-03-18 15:23:29 +01:00
Benjamin Otte
8c73799ca8 stylecontext: Move relevant_changes tracking to GtkCssWidgetNode 2015-03-18 15:23:29 +01:00
Benjamin Otte
7bafb63ec3 cssnode: Handle invalidation
Handle invalidation of node inside the CssNode code, don't do it in the
stylecontext.
2015-03-18 15:23:29 +01:00
Benjamin Otte
181e58e402 iconhelper: Move function from style context into only user 2015-03-12 01:15:38 +01:00
Benjamin Otte
73b3b9ee94 stylecontext: Rename function and export it.
The name now better reflects what it does, since GtkCssComputedValues
was renamed to GtkCssStyle, too.
2015-01-20 01:23:18 +01:00
Benjamin Otte
dbb8d1dd07 stylecontext: Keep track of the CSS ID
This is necessary since we do the new caching and need to distinguish
between styles with different IDs.

Fixes various test cases.
2015-01-20 01:07:13 +01:00
Benjamin Otte
7e5b58c727 stylecontext: Move private a11y function to private header 2014-08-16 19:39:44 +02:00
Benjamin Otte
4a6957f50d stylecontext: Remove state from _peek_style_property()
It evaluates to "current state" in all cases, so no need to special case
it.
2014-06-11 01:18:04 +02:00
Benjamin Otte
434f91feff spinner: Implement clip
We now allow you to gtk-icon-transform() the spinner outside of the
spinners allocation.
2014-05-24 16:12:20 +02:00
Benjamin Otte
f8cccbad0e iconhelper: Respect -gtk-icon-style
This allows styling of entry icons, treeview pixbufs and images. They
can now be forced to be symbolic or regular.
2014-05-14 04:28:34 +02:00
Benjamin Otte
fc67f0d4f8 stylecontext: Remove unused private functions 2012-11-30 22:41:22 +01:00
Benjamin Otte
e0586e3680 stylecontext: Expose a function to get at the current changes 2012-11-30 20:36:57 +01:00
Benjamin Otte
42dc0ea0fd styleprovider: Change function prototype
Make _gtk_style_provider_private_get_color() return a GtkCssValue (a
GtkCssColorValue to be exact) instead of GtkSymbolicColor.

With this, the symbolic color usage inside GTK is minimized.
2012-11-25 02:45:10 +01:00
Benjamin Otte
ba88174614 stylecontext: Remove unused function 2012-11-08 23:34:29 +01: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
7712d41b5e stylecontext: Refactor the way animations are started and stopped
We now create animation objects unconditionally, but we only run the
animation loop when gtk_style_context_should_animate() return TRUE.
2012-09-17 20:40:01 +02:00
Benjamin Otte
554002028c stylecontext: Provide a function for getting the style provider
This will be necessary for creating the computed values for keyframes.
2012-09-17 20:39:12 +02:00
Benjamin Otte
11d0f9e408 css: Make color lookup handle dependencies 2012-08-28 15:42:24 +02:00
Benjamin Otte
2cb9dac14c stylecontext: Pass the changes in the parent to validation function
This way, inherited properties can be updated.
2012-08-28 15:42:23 +02:00
Benjamin Otte
fe89e710ea stylecontext: Add public API to stop animations
... and use it.

Of course, there still are no animations, so we don't turn anything off
yet.
2012-04-17 08:59:22 +02:00
Benjamin Otte
29fbfcb8f5 stylecontext: Pass time to style_context_validate()
This way, we can ensure that every style context uses the same timestamp
for whatever they do.
2012-04-17 08:59:21 +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
83be7e5dbd symboliccolor: Pass the current color to the resolve function
This way, we can resolve things like
  mix (currentColor, &otherColor);
and therefore parse currentColor as a regular color.
2012-04-17 08:59:19 +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
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
585a1fae4f stylecontext: Really queue style changes
Instead of instantly applying a new style, just mark the context as
invalid. Only apply the new style at layout time.
2012-04-17 08:59:10 +02:00
Benjamin Otte
39ff874a11 stylecontext: Introduce _gtk_style_context_queue_invalidate()
This is for only queueing invalidations instead of doing a full
invalidation cycle.
2012-04-17 08:59:09 +02:00
Benjamin Otte
1aa4a196dc stylecontext: Add setter for widget
... and actually set the widget on the style context. Note that this
function does not take a reference on the widget, which is a very good
reason to keep it private.
2012-04-17 08:59:08 +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