summaryrefslogtreecommitdiff
path: root/gtk/gtkcssimage.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2018-02-17 20:31:14 +0100
committerBenjamin Otte <otte@redhat.com>2018-03-16 06:04:44 +0100
commit4beeb6173b44f4f4d662f79daacffee6569f3136 (patch)
tree1b9055ed2570c62821cb774495c38bb6a59e77fc /gtk/gtkcssimage.c
parent5970dac1679d9b7ea3aa6feae1d7520dd235c166 (diff)
downloadgtk+-4beeb6173b44f4f4d662f79daacffee6569f3136.tar.gz
cssimage: Add gtk_css_image_is_invalid()
Use that instead of hacks to guess when an image is considered invalid according to https://drafts.csswg.org/css-images-4/#invalid-image Also add a GtkCssImageInvalid that implements the behavior of invalid images according to the CSS spec so thjat image implementations can refer to that image.
Diffstat (limited to 'gtk/gtkcssimage.c')
-rw-r--r--gtk/gtkcssimage.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c
index 10cdc73ce5..c61c3ee4a5 100644
--- a/gtk/gtkcssimage.c
+++ b/gtk/gtkcssimage.c
@@ -97,6 +97,12 @@ gtk_css_image_real_transition (GtkCssImage *start,
}
static gboolean
+gtk_css_image_real_is_invalid (GtkCssImage *image)
+{
+ return FALSE;
+}
+
+static gboolean
gtk_css_image_real_is_dynamic (GtkCssImage *image)
{
return FALSE;
@@ -118,6 +124,7 @@ _gtk_css_image_class_init (GtkCssImageClass *klass)
klass->compute = gtk_css_image_real_compute;
klass->equal = gtk_css_image_real_equal;
klass->transition = gtk_css_image_real_transition;
+ klass->is_invalid = gtk_css_image_real_is_invalid;
klass->is_dynamic = gtk_css_image_real_is_dynamic;
klass->get_dynamic_image = gtk_css_image_real_get_dynamic_image;
}
@@ -280,6 +287,18 @@ gtk_css_image_snapshot (GtkCssImage *image,
}
gboolean
+gtk_css_image_is_invalid (GtkCssImage *image)
+{
+ GtkCssImageClass *klass;
+
+ g_return_val_if_fail (GTK_IS_CSS_IMAGE (image), FALSE);
+
+ klass = GTK_CSS_IMAGE_GET_CLASS (image);
+
+ return klass->is_invalid (image);
+}
+
+gboolean
gtk_css_image_is_dynamic (GtkCssImage *image)
{
GtkCssImageClass *klass;