Use stylish_get_url_from_term()

The code in _st_theme_node_ensure_background() and
st_theme_node_get_border_image() still does URLs by hand; we'll get
there eventually.
parent fce2e233
Pipeline #135636 failed with stages
in 9 minutes and 14 seconds
......@@ -746,26 +746,32 @@ st_theme_node_lookup_url (StThemeNode *node,
if (strcmp (cr_declaration_name (decl), property_name) == 0)
{
CRTerm *term = decl->value;
CRStyleSheet *base_stylesheet;
char *value = NULL;
GetFromTermResult result = stylish_get_url_from_term (decl->value, &value);
if (term->type != TERM_URI && term->type != TERM_STRING)
continue;
if (result == VALUE_FOUND)
{
CRStyleSheet *base_stylesheet;
if (decl->parent_statement != NULL)
base_stylesheet = decl->parent_statement->parent_sheet;
else
base_stylesheet = NULL;
if (decl->parent_statement != NULL)
base_stylesheet = decl->parent_statement->parent_sheet;
else
base_stylesheet = NULL;
*file = _st_theme_resolve_url (node->theme, base_stylesheet, value);
g_free (value);
*file = _st_theme_resolve_url (node->theme,
base_stylesheet,
decl->value->content.str->stryng->str);
result = TRUE;
break;
return TRUE;
}
else if (result == VALUE_INHERIT)
{
inherit = TRUE;
break;
}
}
}
if (!result && inherit && node->parent_node)
if (inherit && node->parent_node)
result = st_theme_node_lookup_url (node->parent_node, property_name, inherit, file);
return result;
......
......@@ -310,6 +310,19 @@ test_lengths (void)
st_theme_node_get_margin (group1, ST_SIDE_LEFT));
}
static void
test_url (void)
{
GFile *file;
test = "url";
file = st_theme_node_get_url (group1, "url-prop");
g_assert (file != NULL);
/* FIXME: test that the relative URL is resolved with respect to the test-theme.css file */
g_object_unref (file);
}
static void
test_classes (void)
{
......@@ -625,6 +638,7 @@ main (int argc, char **argv)
test_double ();
test_time ();
test_lengths ();
test_url ();
test_classes ();
test_type_inheritance ();
test_adjacent_selector ();
......
......@@ -20,6 +20,8 @@ stage {
time-s: 42s;
time-ms: 42000ms;
url-prop: url("foo.svg");
}
#text1 {
......
Subproject commit 9e9948935334789f383afd2fd23f13d8e164a4cc
Subproject commit e581508df3de7e1c5b49edeeab99b02a9a22fb4f
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment