mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-07 01:00:28 +00:00
GtkCssProvider: Add named regions to selector path.
This commit is contained in:
parent
707d5ae99c
commit
07171d5f68
@ -41,6 +41,7 @@ enum SelectorElementType {
|
||||
SELECTOR_TYPE_NAME,
|
||||
SELECTOR_NAME,
|
||||
SELECTOR_GTYPE,
|
||||
SELECTOR_REGION,
|
||||
SELECTOR_GLOB
|
||||
};
|
||||
|
||||
@ -58,6 +59,12 @@ struct SelectorElement
|
||||
{
|
||||
GQuark name;
|
||||
GType type;
|
||||
|
||||
struct
|
||||
{
|
||||
GQuark name;
|
||||
GtkChildClassFlags flags;
|
||||
} region;
|
||||
};
|
||||
};
|
||||
|
||||
@ -204,6 +211,23 @@ selector_path_prepend_glob (SelectorPath *path)
|
||||
path->elements = g_slist_prepend (path->elements, elem);
|
||||
}
|
||||
|
||||
static void
|
||||
selector_path_prepend_region (SelectorPath *path,
|
||||
const gchar *name,
|
||||
GtkChildClassFlags flags)
|
||||
{
|
||||
SelectorElement *elem;
|
||||
|
||||
elem = g_slice_new (SelectorElement);
|
||||
elem->combinator = COMBINATOR_DESCENDANT;
|
||||
elem->elem_type = SELECTOR_REGION;
|
||||
|
||||
elem->region.name = g_quark_from_string (name);
|
||||
elem->region.flags = flags;
|
||||
|
||||
path->elements = g_slist_prepend (path->elements, elem);
|
||||
}
|
||||
|
||||
static void
|
||||
selector_path_prepend_combinator (SelectorPath *path,
|
||||
CombinatorType combinator)
|
||||
@ -739,6 +763,9 @@ parse_selector (GtkCssProvider *css_provider,
|
||||
else if (g_ascii_islower (scanner->value.v_identifier[0]))
|
||||
{
|
||||
GtkChildClassFlags flags = 0;
|
||||
gchar *region_name;
|
||||
|
||||
region_name = g_strdup (scanner->value.v_identifier);
|
||||
|
||||
/* Parse nth-child type pseudo-class */
|
||||
if (g_scanner_peek_next_token (scanner) == ':')
|
||||
@ -752,6 +779,9 @@ parse_selector (GtkCssProvider *css_provider,
|
||||
return token;
|
||||
}
|
||||
}
|
||||
|
||||
selector_path_prepend_region (path, region_name, flags);
|
||||
g_free (region_name);
|
||||
}
|
||||
else if (scanner->value.v_identifier[0] == '*')
|
||||
selector_path_prepend_glob (path);
|
||||
|
Loading…
Reference in New Issue
Block a user