Commit Graph

17 Commits

Author SHA1 Message Date
Benjamin Otte
9b9b475f0a API: stylecontext: Remove regions 2016-10-16 18:17:21 +02:00
Matthias Clasen
3756d92367 Move private widget path functions away
We don't put private functions in public headers anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=761339
2016-02-04 15:19:51 +01:00
Matthias Clasen
0c52eca34c Move node printing to GtkCssNodeDeclaration
The node declaration has all the information we are printing
here (except for visibility). At the same time, redo the format
to print the information in selector format, and indicate
(in)visibility by enclosing the selector in square brackets.
2016-01-03 14:41:43 -05:00
Benjamin Otte
ee1381a1f3 cssnodedeclaration: Only set the id on the widget path if we have one
Widget paths don't like NULL.
2015-11-21 02:40:53 +01:00
Benjamin Otte
7373fd8aab cssnodedeclaration: Set element name and id on widget path
Otherwise the widget path creation functions will fail. This affects
widgets still using gtk_style_context_save().

https://bugzilla.gnome.org/show_bug.cgi?id=758442
2015-11-21 02:14:08 +01:00
Matthias Clasen
d1a85fc9e4 css node declaration: Allow both name and type to be set
The widget path machinery assumes that we always have types,
and without this change, it will start spewing warnings when
we start to introduce node names.
2015-10-22 20:58:52 -04:00
Benjamin Otte
26450a661e cssnodedeclaration: Add possibility to set the name
This is supposed to be a replacement for setting the type. So far, both
options are possible - either will unset the other.
2015-10-22 16:35:14 +02:00
Matthias Clasen
20c49b8837 css node declaration: Avoid optional out parameters
Always pass a pos to find_class, and avoid the if.
2015-09-12 12:50:37 -04:00
Matthias Clasen
29505af07f css node declaration: Fix a typo 2015-09-12 12:50:37 -04:00
Benjamin Otte
c6a5a12922 widgetpath: Implement using GtkCssNodeDeclaration
This removes a bunch of code but more importantly allows providing the
declaration in CSS matchers.
2015-09-12 05:27:35 +02:00
Benjamin Otte
610452dda8 cssnode: Move clear_classes() into the NodeDeclaration
The previous code was crashing when used as the returned classes array
would have been invalid after the first deletion. So if a 2nd class
would be deleted, invalid memory might have been referenced.
2015-09-12 05:27:35 +02: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
Matthias Clasen
cf0e087527 Optimize gtk_css_node_declaration_has_class
This function is getting called a lot. Statistics for the gtk3-demo
listbox example show most calls with 0-4 classes. Unrolling the cases
a bit brings the instruction count in callgrind from 93M to 52M.
2015-09-09 14:40:36 -04: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
26f36ef8ae cssnodedeclaration: Store the GType of the node 2015-01-07 14:26:48 +01:00
Benjamin Otte
7d96770453 cssnodedeclaration: Fix src/dest swap in memmove()
The main cause here were the wrong style classes being removed, such as
"message-dialog" instead of "csd" for GtkMessageDialog.
2014-10-22 03:39:17 +02:00
Benjamin Otte
5c2c659122 stylecontext: Split out functionality into custom object
GtkCssNodeDeclaration is a new struct with copy-on-write semantics.

It encapsulated the properties used to define a node in the CSS tree.

The idea is to use it in various places for caching, in particular as
key in hash tables.
2014-10-21 03:03:28 +02:00