[gtk/matthiasc/for-master: 2/7] cssshadowvalue: Add a parsing function
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 2/7] cssshadowvalue: Add a parsing function
- Date: Sat, 6 Feb 2021 14:58:15 +0000 (UTC)
commit adadf7d5f2da239c7489bf878c9ce5a40a9a58e6
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Feb 5 21:36:22 2021 -0500
cssshadowvalue: Add a parsing function
Add a variant of the parse function that parses
just a single (non-box) shadow, as required for
the drop-shadow filter.
gtk/gtkcssshadowvalue.c | 26 ++++++++++++++++++++++++++
gtk/gtkcssshadowvalueprivate.h | 2 ++
2 files changed, 28 insertions(+)
---
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index ba170c7cc9..e13714fce1 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -327,6 +327,21 @@ gtk_css_shadow_value_new (ShadowValue *shadows,
return retval;
}
+GtkCssValue *
+gtk_css_shadow_value_new_filter (void)
+{
+ ShadowValue value;
+
+ value.inset = FALSE;
+ value.hoffset = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
+ value.voffset = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
+ value.radius = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
+ value.spread = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
+ value.color = _gtk_css_color_value_new_current_color ();
+
+ return gtk_css_shadow_value_new (&value, 1);
+}
+
enum {
HOFFSET,
VOFFSET,
@@ -498,6 +513,17 @@ fail:
return NULL;
}
+GtkCssValue *
+_gtk_css_shadow_value_parse_filter (GtkCssParser *parser)
+{
+ ShadowValue shadow;
+
+ if (_gtk_css_shadow_value_parse_one (parser, FALSE, &shadow))
+ return gtk_css_shadow_value_new (&shadow, 1);
+ else
+ return NULL;
+}
+
void
gtk_css_shadow_value_get_extents (const GtkCssValue *value,
GtkBorder *border)
diff --git a/gtk/gtkcssshadowvalueprivate.h b/gtk/gtkcssshadowvalueprivate.h
index fd126bd6c9..7148d96371 100644
--- a/gtk/gtkcssshadowvalueprivate.h
+++ b/gtk/gtkcssshadowvalueprivate.h
@@ -35,9 +35,11 @@
G_BEGIN_DECLS
GtkCssValue * gtk_css_shadow_value_new_none (void);
+GtkCssValue * gtk_css_shadow_value_new_filter (void);
GtkCssValue * _gtk_css_shadow_value_parse (GtkCssParser *parser,
gboolean box_shadow_mode);
+GtkCssValue * _gtk_css_shadow_value_parse_filter (GtkCssParser *parser);
void gtk_css_shadow_value_get_extents (const GtkCssValue *shadow,
GtkBorder *border);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]