Merge branch 'css-color-deprecations' into 'main'

Add gtk_css_parser_warn_deprecated

See merge request GNOME/gtk!7270
This commit is contained in:
Matthias Clasen 2024-05-21 10:57:12 +00:00
commit 1f133c3d64
23 changed files with 158 additions and 4 deletions

View File

@ -812,6 +812,26 @@ gtk_css_parser_warn_syntax (GtkCssParser *self,
va_end (args);
}
void
gtk_css_parser_warn_deprecated (GtkCssParser *self,
const char *format,
...)
{
va_list args;
GError *error;
va_start (args, format);
error = g_error_new_valist (GTK_CSS_PARSER_WARNING,
GTK_CSS_PARSER_WARNING_DEPRECATED,
format, args);
gtk_css_parser_emit_error (self,
gtk_css_parser_get_start_location (self),
gtk_css_parser_get_end_location (self),
error);
g_error_free (error);
va_end (args);
}
gboolean
gtk_css_parser_consume_function (GtkCssParser *self,
guint min_args,

View File

@ -120,6 +120,9 @@ void gtk_css_parser_warn (GtkCssParser
void gtk_css_parser_warn_syntax (GtkCssParser *self,
const char *format,
...) G_GNUC_PRINTF(2, 3);
void gtk_css_parser_warn_deprecated (GtkCssParser *self,
const char *format,
...) G_GNUC_PRINTF(2, 3);
gboolean gtk_css_parser_has_token (GtkCssParser *self,

View File

@ -711,6 +711,8 @@ gtk_css_color_value_parse (GtkCssParser *parser)
{
const GtkCssToken *token = gtk_css_parser_get_token (parser);
gtk_css_parser_warn_deprecated (parser, "@define-color and named colors are deprecated");
value = gtk_css_color_value_new_name (gtk_css_token_get_string (token));
gtk_css_parser_consume_token (parser);

View File

@ -184,10 +184,12 @@ gtk_css_provider_parsing_error (GtkCssProvider *provider,
{
char *s = gtk_css_section_to_string (section);
g_warning ("Theme parser %s: %s: %s",
error->domain == GTK_CSS_PARSER_WARNING ? "warning" : "error",
s,
error->message);
if (GTK_DEBUG_CHECK (CSS) ||
!g_error_matches (error, GTK_CSS_PARSER_WARNING, GTK_CSS_PARSER_WARNING_DEPRECATED))
g_warning ("Theme parser %s: %s: %s",
error->domain == GTK_CSS_PARSER_WARNING ? "warning" : "error",
s,
error->message);
g_free (s);
}

View File

@ -96,6 +96,7 @@ typedef enum {
GTK_DEBUG_A11Y = 1 << 17,
GTK_DEBUG_ICONFALLBACK = 1 << 18,
GTK_DEBUG_INVERT_TEXT_DIR = 1 << 19,
GTK_DEBUG_CSS = 1 << 20,
} GtkDebugFlags;
#define GTK_DEBUG_CHECK(type) G_UNLIKELY (gtk_get_debug_flags () & GTK_DEBUG_##type)

View File

@ -200,6 +200,7 @@ static const GdkDebugKey gtk_debug_keys[] = {
{ "accessibility", GTK_DEBUG_A11Y, "Information about accessibility state changes" },
{ "iconfallback", GTK_DEBUG_ICONFALLBACK, "Information about icon fallback" },
{ "invert-text-dir", GTK_DEBUG_INVERT_TEXT_DIR, "Invert the default text direction" },
{ "css", GTK_DEBUG_CSS, "Information about deprecated CSS features" },
};
/* This checks to see if the process is running suid or sgid

View File

@ -1 +1,3 @@
at-invalid-12.css:1:25-29: error: GTK_CSS_PARSER_WARNING_DEPRECATED
at-invalid-12.css:1:31-36: error: GTK_CSS_PARSER_WARNING_DEPRECATED
at-invalid-12.css:1:38-44: error: GTK_CSS_PARSER_ERROR_SYNTAX

View File

@ -1 +1,2 @@
at-invalid-13.css:1:25-30: error: GTK_CSS_PARSER_WARNING_DEPRECATED
at-invalid-13.css:1:32-35: error: GTK_CSS_PARSER_ERROR_SYNTAX

View File

@ -1 +1,3 @@
at-invalid-15.css:1:25-30: error: GTK_CSS_PARSER_WARNING_DEPRECATED
at-invalid-15.css:1:32-36: error: GTK_CSS_PARSER_WARNING_DEPRECATED
at-invalid-15.css:1:36-37: error: GTK_CSS_PARSER_ERROR_SYNTAX

View File

@ -1 +1,2 @@
at-invalid-16.css:1:25-30: error: GTK_CSS_PARSER_WARNING_DEPRECATED
at-invalid-16.css:1:30-31: error: GTK_CSS_PARSER_ERROR_SYNTAX

View File

@ -0,0 +1 @@
at-valid-07.css:1:21-30: error: GTK_CSS_PARSER_WARNING_DEPRECATED

View File

@ -0,0 +1 @@
at-valid-11.css:1:29-34: error: GTK_CSS_PARSER_WARNING_DEPRECATED

View File

@ -0,0 +1 @@
at-valid-12.css:1:27-32: error: GTK_CSS_PARSER_WARNING_DEPRECATED

View File

@ -0,0 +1 @@
at-valid-13.css:1:27-32: error: GTK_CSS_PARSER_WARNING_DEPRECATED

View File

@ -0,0 +1,2 @@
at-valid-14.css:1:25-30: error: GTK_CSS_PARSER_WARNING_DEPRECATED
at-valid-14.css:1:32-36: error: GTK_CSS_PARSER_WARNING_DEPRECATED

View File

@ -0,0 +1 @@
at-valid-16.css:1:69-74: error: GTK_CSS_PARSER_WARNING_DEPRECATED

View File

@ -0,0 +1 @@
at-valid-17.css:1:20-25: error: GTK_CSS_PARSER_WARNING_DEPRECATED

View File

@ -0,0 +1,94 @@
background-shorthand.css:10:273-278: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:46:163-168: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:118:38-43: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:158:89-94: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:194:316-321: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:214:122-127: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:222:381-386: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:226:48-53: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:238:214-219: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:246:88-93: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:306:15-20: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:346:358-363: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:374:31-36: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:422:96-101: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:430:719-724: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:446:252-257: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:458:153-158: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:498:46-51: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:546:201-206: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:562:260-265: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:618:801-806: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:646:86-91: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:666:279-284: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:738:355-360: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:742:194-199: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:798:95-100: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:826:75-80: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:854:15-20: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:862:76-81: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:866:116-121: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:874:517-522: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:894:98-103: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:898:157-162: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:906:225-230: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:986:712-717: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:994:304-309: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1078:542-547: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1090:719-724: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1110:586-591: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1146:127-132: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1242:261-266: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1306:24-29: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1314:393-398: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1398:283-288: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1414:236-241: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1418:268-273: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1438:406-411: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1446:102-107: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1482:94-99: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1494:766-771: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1510:45-50: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1534:84-89: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1538:268-273: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1626:786-791: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1642:231-236: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1658:69-74: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1694:607-612: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1782:59-64: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1794:214-219: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1850:113-118: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1858:108-113: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1894:535-540: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1898:301-306: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1902:373-378: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1922:154-159: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1926:391-396: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1938:224-229: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1942:533-538: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1958:15-20: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1970:412-417: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:1994:202-207: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2110:547-552: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2138:356-361: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2174:204-209: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2266:59-64: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2278:305-310: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2286:71-76: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2290:106-111: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2334:133-138: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2374:489-494: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2386:197-202: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2414:15-20: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2454:173-178: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2470:527-532: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2506:49-54: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2522:181-186: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2562:369-374: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2586:583-588: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2598:574-579: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2602:247-252: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2622:109-114: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2646:34-39: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2662:63-68: error: GTK_CSS_PARSER_WARNING_DEPRECATED
background-shorthand.css:2674:24-29: error: GTK_CSS_PARSER_WARNING_DEPRECATED

View File

@ -0,0 +1 @@
color.css:72:10-18: error: GTK_CSS_PARSER_WARNING_DEPRECATED

View File

@ -0,0 +1,2 @@
currentcolor-everywhere.css:16:28-39: error: GTK_CSS_PARSER_WARNING_DEPRECATED
currentcolor-everywhere.css:20:14-25: error: GTK_CSS_PARSER_WARNING_DEPRECATED

View File

@ -0,0 +1 @@
declarations-valid-09.css:1:41-50: error: GTK_CSS_PARSER_WARNING_DEPRECATED

View File

@ -0,0 +1,12 @@
shadow.css:78:30-39: error: GTK_CSS_PARSER_WARNING_DEPRECATED
shadow.css:146:52-61: error: GTK_CSS_PARSER_WARNING_DEPRECATED
shadow.css:154:35-44: error: GTK_CSS_PARSER_WARNING_DEPRECATED
shadow.css:174:42-51: error: GTK_CSS_PARSER_WARNING_DEPRECATED
shadow.css:190:36-45: error: GTK_CSS_PARSER_WARNING_DEPRECATED
shadow.css:238:27-36: error: GTK_CSS_PARSER_WARNING_DEPRECATED
shadow.css:314:41-50: error: GTK_CSS_PARSER_WARNING_DEPRECATED
shadow.css:318:21-30: error: GTK_CSS_PARSER_WARNING_DEPRECATED
shadow.css:334:27-36: error: GTK_CSS_PARSER_WARNING_DEPRECATED
shadow.css:354:36-45: error: GTK_CSS_PARSER_WARNING_DEPRECATED
shadow.css:358:41-50: error: GTK_CSS_PARSER_WARNING_DEPRECATED
shadow.css:382:30-39: error: GTK_CSS_PARSER_WARNING_DEPRECATED

View File

@ -0,0 +1 @@
variables-invalid-06.css:2:10-14: error: GTK_CSS_PARSER_ERROR_SYNTAX