mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 05:31:07 +00:00
css: Avoid a crash with relative colors
rgba(from @foo ...) would crash if @foo was not a named color. Handle it as we do elsewhere, by returning NULL from resolve(). Test included. Fixes: #6985
This commit is contained in:
parent
b6d19f4c8b
commit
3f7f9b705e
@ -700,6 +700,8 @@ gtk_css_color_value_do_resolve (GtkCssValue *color,
|
||||
GtkCssValue *vals[4];
|
||||
|
||||
origin = gtk_css_color_value_do_resolve (color->relative.origin, context, current, cycle_list);
|
||||
if (origin == NULL)
|
||||
return NULL;
|
||||
|
||||
for (guint i = 0; i < 4; i++)
|
||||
{
|
||||
|
3
testsuite/css/style/bad-relative-color.css
Normal file
3
testsuite/css/style/bad-relative-color.css
Normal file
@ -0,0 +1,3 @@
|
||||
label {
|
||||
color: oklab(from @foo max(l, 0.75) a b / alpha);
|
||||
}
|
4
testsuite/css/style/bad-relative-color.nodes
Normal file
4
testsuite/css/style/bad-relative-color.nodes
Normal file
@ -0,0 +1,4 @@
|
||||
window.background:dir(ltr)
|
||||
box.horizontal:dir(ltr)
|
||||
label:dir(ltr)
|
||||
color: rgb(255,255,255); /* bad-relative-color.css:2:3-52 */
|
18
testsuite/css/style/bad-relative-color.ui
Normal file
18
testsuite/css/style/bad-relative-color.ui
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="decorated">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Hello World!</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
Loading…
Reference in New Issue
Block a user