Paolo Borelli
c4996873dc
docs: try to clarify widget_get_state_flags vs context_get_state
2016-01-05 18:46:56 +01:00
Matthias Clasen
2e921691d9
Redo CSS style printing
...
Drop the custom style printing implementation in gtkcssnode.c and
instead reuse the existing gtk_css_style_print function, extending
it a bit to suit our needs.
Instead of computing values, just recognize initial values by
having no CSS section. Also do away with the show-initial flag, and
just always filter out initial values. The flag can come back when
it is needed.
2016-01-03 15:36:48 -05:00
Matthias Clasen
68edc47f6a
Add a function to dump CSS nodes and styles
...
Add a gtk_style_context_to_string function that can serialize
a CSS node or tree of nodes, optionally including CSS properties
as well.
This will be useful in writing tests.
2016-01-03 09:19:30 -05:00
Benjamin Otte
d3cf3fd267
rendericon: Move a function
...
The function is identical if used for builtin icons and regular icons
(as per iconhelper). So split it out in a way that doesn't assume
either.
2015-12-16 04:46:22 +01:00
Benjamin Otte
a11de0da6b
stylecontext: Builtin images can be (and are) transformed
...
So don't special-case them out.
2015-12-16 01:50:00 +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
b8dd24b4fb
iconfactory: Drop caching infrastructure
...
- icon sets are essentially unused
- the icon theme does caching
- this code complicates the restructuring I'm about to do
=> Delete it!
2015-12-04 17:44:51 +01:00
Benjamin Otte
8355ee3053
stylecontext: Don't emit state warning for transient nodes
...
It's fine to call set_state() on those.
https://bugzilla.gnome.org/show_bug.cgi?id=758930
2015-12-02 00:29:36 +01:00
Benjamin Otte
4b2ea59dd1
stylecontext: Treat empty path like no path
...
This way, we don't do weird stuff when an empty path is set.
2015-11-21 02:22:22 +01:00
Benjamin Otte
6eb89fb6a3
stylecontext: Copy name when setting widget path
...
Imitate what we do for the type. This way we don't lose the name on
save/restore.
https://bugzilla.gnome.org/show_bug.cgi?id=758442
2015-11-21 02:21:12 +01:00
Benjamin Otte
a9814fea7d
stylecontext: Always warn on style mismatch
...
For now, always warn when
gtk_style_context_get()/get_padding()/get_margin()/get_border()
get called with the wrong state.
We used to hide this behind an env var because the warnings were
too frequent, but with the recent refactorings, this warning has become
rather important for detecting bugs.
If it's still problematic, we might want to revert this patch before
3.20.
2015-11-06 18:59:15 +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
Benjamin Otte
bddc524cd8
stylecontext: Make sure style is valid when looking up style properties
...
Otherwise, the validation may happen vey automatically some time during
the style property and that will most likely cause a crash.
https://bugzilla.gnome.org/show_bug.cgi?id=756338
2015-10-10 23:23:34 +02:00
Matthias Clasen
d930ea7c1f
style context: Avoid a compiler warning
2015-10-03 22:42:12 -04:00
Matthias Clasen
598e17018c
style context: Formatting fixes
2015-10-03 21:38:20 -04:00
Matthias Clasen
506fe61938
Fix gtk_style_context_list_classes
...
The function was always returning NULL.
2015-10-03 17:37:34 -04:00
Matthias Clasen
3c54fbd3ac
Use stupid quotes instead of dumb quotes
...
Following a similar change in GLib a while ago.
'bla' may by stupid, but it looks less dumb than `bla'.
2015-09-23 07:01:16 -04:00
Matthias Clasen
5dcbbc6736
style context: Trivial refactor
...
Use g_set_object for setting the frame clock.
2015-09-23 07:01:14 -04: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
Garrett Regier
6118893a4e
stylecontext: Fix list_classes() after optimization
...
Otherwise a junk value is returned.
2015-09-11 09:48:38 -07:00
Garrett Regier
41b386cd6a
cssnode: Optimize listing of classes
...
Avoid creating the GList of strings when the GQuarks
will just be determined again. Instead have
gtk_style_context_list_classes() do it specifically.
2015-09-11 18:26:11 +02:00
Benjamin Otte
9020b5bd17
stylecontext: Remove line that is a no-op
...
Creating the transient node will already copy the widget type. So
copying again will not do anything.
2015-09-07 14:33:35 +02:00
Matthias Clasen
4c376d1a9c
style context: Convert to g_object_notify_by_pspec
...
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:11:36 -04:00
Paolo Borelli
1eb1481bdf
css: support text-decoration-style
...
The support is limited to underline single, double and wavy, which
is what pango has today.
2015-07-06 20:06:20 +02:00
Paolo Borelli
a57e6731c4
css: support text-decoration-color
2015-07-06 00:04:06 +02:00
Paolo Borelli
384df61c90
css: add support for text-decoration-line
2015-07-06 00:04:06 +02: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
Cosimo Cecchi
a1e80d99d2
stylecontext: deprecate gtk_style_context_set_background()
...
Nothing in GTK calls it anymore.
2015-07-01 16:09:23 -07:00
Benjamin Otte
fe51ac273c
stylecontext: Change fallback behavior on state mismatch
...
For functions that take state flags as an argument we need to special
case the situation where the passed in flags don't match the current
state.
Previously we would create a copy of the style info, change its state
and do the lookup from there.
Now that GtkCssNode has replaced style infos, this doesn't work as well
anymore as copying a GtkCssNode is not possible.
However, unike style infos, GtkCssNodes are instant-apply, so we don't
need to copy anymore, we can just change the state of the node.
This causes some invalidations to be queued, but we can take that
performance hit as this is fallback code.
https://bugzilla.redhat.com/show_bug.cgi?id=1228852
2015-06-15 04:36:47 +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
ec57c6c10b
csspathnode: Handle context going away
...
Sometimes path nodes can survive longer than the style context that
created them. Don't crash in those cases.
Fixes startup of mutter.
Testcase included.
https://bugzilla.gnome.org/show_bug.cgi?id=746407
2015-03-18 18:24:45 +01:00
Benjamin Otte
776d99ac51
stylecontext: Call get_style(), not create_style()
...
We want to ensure that the style is created properly.
This also allows making the create_Style() function private.
2015-03-18 15:23:32 +01:00
Benjamin Otte
399df06d19
stylecontext: Refactor gtk_style_context_invalidate()
...
There's no need anymore to recreate styles, nodes do that automagically
now.
This allows making gtk_css_node_set_style() private.
2015-03-18 15:23:32 +01:00
Benjamin Otte
2ec26cd9b5
cssnode: Move style context function to only user
2015-03-18 15:23:32 +01:00
Benjamin Otte
cadf6a9d3c
cssnode: Add gtk_css_node_invalidate_style_provider()
...
This function not just invalidates the current node, but also all
children.
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
219e52f7e1
cssnode: Automatically recreate style on get_style() call
...
When the style is invalid, redo it.
Make this a vfunc, so the widget nodes can opt out.
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
649edbe2fc
stylecontext: Move style creation functions to CssNode code
2015-03-18 15:23:30 +01:00
Benjamin Otte
c4b88e05fd
stylecontext: Redo handling of differing state
...
Instead of passing an "override_state" flag, create a new CssNode just
for this simple lookup.
2015-03-18 15:23:30 +01:00
Benjamin Otte
637a4bda5c
stylecontext: Get rid of stylecontext argument
...
... to a bunch of functions.
This requires a tiny change to the heuristics for the style cache - we
now cache styles when they have the same style provider as their parent
instead of when they have the default provider - but that change doesn't
have any effect in practice.
2015-03-18 15:23:29 +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
6dc6af674c
stylecontext: Remove children list
...
It's not needed.
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