[gtk+/wip/checked: 1/9] css: Add a :checked pseudoclass
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/checked: 1/9] css: Add a :checked pseudoclass
- Date: Fri, 15 Aug 2014 02:07:32 +0000 (UTC)
commit a05aef47fb60628e979d2efbe502028229214d3d
Author: Benjamin Otte <otte redhat com>
Date: Thu Aug 14 03:00:02 2014 +0200
css: Add a :checked pseudoclass
https://bugzilla.gnome.org/show_bug.cgi?id=733967
gtk/gtkcssselector.c | 6 ++++--
gtk/gtkenums.h | 4 +++-
gtk/gtkwidgetpath.c | 6 +-----
testsuite/css/parser/pseudo-classes-known.css | 4 ++++
testsuite/css/parser/pseudo-classes-known.ref.css | 4 ++++
5 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index ca9c45d..bfa8da0 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -1111,7 +1111,8 @@ gtk_css_selector_pseudoclass_state_print (const GtkCssSelector *selector,
"dir(ltr)",
"dir(rtl)",
"link",
- "visited"
+ "visited",
+ "checked"
};
guint i, state;
@@ -1831,7 +1832,8 @@ parse_selector_pseudo_class (GtkCssParser *parser,
{ "dir(ltr)", GTK_STATE_FLAG_DIR_LTR, },
{ "dir(rtl)", GTK_STATE_FLAG_DIR_RTL, },
{ "link", GTK_STATE_FLAG_LINK, },
- { "visited", GTK_STATE_FLAG_VISITED, }
+ { "visited", GTK_STATE_FLAG_VISITED, },
+ { "checked", GTK_STATE_FLAG_CHECKED, }
};
guint i;
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
index aa893d6..6322f12 100644
--- a/gtk/gtkenums.h
+++ b/gtk/gtkenums.h
@@ -856,6 +856,7 @@ typedef enum
* @GTK_STATE_FLAG_DIR_RTL: Widget is in right-to-left text direction. Since 3.8
* @GTK_STATE_FLAG_LINK: Widget is a link. Since 3.12
* @GTK_STATE_FLAG_VISITED: The location the widget points to has already been visited. Since 3.12
+ * @GTK_STATE_FLAG_CHECKED: Widget is checked. Since 3.14
*
* Describes a widget state. Widget states are used to match the widget
* against CSS pseudo-classes. Note that GTK extends the regular CSS
@@ -874,7 +875,8 @@ typedef enum
GTK_STATE_FLAG_DIR_LTR = 1 << 7,
GTK_STATE_FLAG_DIR_RTL = 1 << 8,
GTK_STATE_FLAG_LINK = 1 << 9,
- GTK_STATE_FLAG_VISITED = 1 << 10
+ GTK_STATE_FLAG_VISITED = 1 << 10,
+ GTK_STATE_FLAG_CHECKED = 1 << 11
} GtkStateFlags;
/**
diff --git a/gtk/gtkwidgetpath.c b/gtk/gtkwidgetpath.c
index aeb2980..7d10199 100644
--- a/gtk/gtkwidgetpath.c
+++ b/gtk/gtkwidgetpath.c
@@ -333,18 +333,14 @@ gtk_widget_path_to_string (const GtkWidgetPath *path)
{
GFlagsClass *fclass;
gint i;
- gboolean appended;
- appended = FALSE;
fclass = g_type_class_ref (GTK_TYPE_STATE_FLAGS);
for (i = 0; i < fclass->n_values; i++)
{
if (elem->state & fclass->values[i].value)
{
- if (appended)
- g_string_append_c (string, ':');
+ g_string_append_c (string, ':');
g_string_append (string, fclass->values[i].value_nick);
- appended = TRUE;
}
}
g_type_class_unref (fclass);
diff --git a/testsuite/css/parser/pseudo-classes-known.css b/testsuite/css/parser/pseudo-classes-known.css
index 363c7e0..53f8c71 100644
--- a/testsuite/css/parser/pseudo-classes-known.css
+++ b/testsuite/css/parser/pseudo-classes-known.css
@@ -49,3 +49,7 @@
:visited {
color: red;
}
+
+:checked {
+ color: red;
+}
diff --git a/testsuite/css/parser/pseudo-classes-known.ref.css
b/testsuite/css/parser/pseudo-classes-known.ref.css
index 416411f..ee00699 100644
--- a/testsuite/css/parser/pseudo-classes-known.ref.css
+++ b/testsuite/css/parser/pseudo-classes-known.ref.css
@@ -49,3 +49,7 @@
:visited {
color: rgb(255,0,0);
}
+
+:checked {
+ color: rgb(255,0,0);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]