Merge branch 'escape-included-svg' into 'gtk-3-24'

(#1471): base64-encode included SVGs to avoid mis-escaped characters

See merge request GNOME/gtk!429
This commit is contained in:
Matthias Clasen 2018-11-27 18:59:13 +00:00
commit 1dd0b8e6aa
2 changed files with 4 additions and 4 deletions

View File

@ -79,7 +79,7 @@ load_symbolic_svg (char *file_data, gsize file_len,
svg_height = g_strdup_printf ("%d",gdk_pixbuf_get_height (pixbuf));
g_object_unref (pixbuf);
escaped_file_data = g_markup_escape_text (file_data, file_len);
escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
data = g_strconcat ("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
"<svg version=\"1.1\"\n"
@ -101,7 +101,7 @@ load_symbolic_svg (char *file_data, gsize file_len,
" fill: ", css_success, " !important;\n"
" }\n"
" </style>\n"
" <xi:include href=\"data:text/xml,", escaped_file_data, "\"/>\n"
" <xi:include href=\"data:text/xml;base64,", escaped_file_data, "\"/>\n"
"</svg>",
NULL);
g_free (escaped_file_data);

View File

@ -4555,7 +4555,7 @@ gtk_icon_info_load_symbolic_svg (GtkIconInfo *icon_info,
width = g_strdup_printf ("%d", icon_info->symbolic_width);
height = g_strdup_printf ("%d", icon_info->symbolic_height);
escaped_file_data = g_markup_escape_text (file_data, file_len);
escaped_file_data = g_base64_encode ((guchar *) file_data, file_len);
g_free (file_data);
g_ascii_dtostr (alphastr, G_ASCII_DTOSTR_BUF_SIZE, CLAMP (alpha, 0, 1));
@ -4580,7 +4580,7 @@ gtk_icon_info_load_symbolic_svg (GtkIconInfo *icon_info,
" fill: ", css_success, " !important;\n"
" }\n"
" </style>\n"
" <g opacity=\"", alphastr, "\" ><xi:include href=\"data:text/xml,", escaped_file_data, "\"/></g>\n"
" <g opacity=\"", alphastr, "\" ><xi:include href=\"data:text/xml;base64,", escaped_file_data, "\"/></g>\n"
"</svg>",
NULL);
g_free (escaped_file_data);