all: add an 'only-child' pseudo-class selector

Add an :only-child pseudo-class selector, which selects single children
of a parent container.

https://bugzilla.gnome.org/show_bug.cgi?id=660833
This commit is contained in:
Cosimo Cecchi
2011-10-03 17:09:09 -04:00
parent 3a6996ea83
commit 1f2cfb5619
4 changed files with 7 additions and 0 deletions

View File

@ -130,6 +130,7 @@ _gtk_css_selector_print (const GtkCssSelector *selector,
"nth-child(odd)",
"first-child",
"last-child",
"only-child",
"sorted"
};
guint i;
@ -201,6 +202,8 @@ compute_region_flags_for_index (const GtkWidgetPath *path,
flags |= GTK_REGION_FIRST;
if (sibling_id + 1 == n_siblings)
flags |= GTK_REGION_LAST;
if (n_siblings == 1)
flags |= GTK_REGION_ONLY;
return flags;
}