mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-06 00:30:08 +00:00
Add singleton for css number 1.0
This will be nice as this is will be the default for opacity. https://bugzilla.gnome.org/show_bug.cgi?id=687842
This commit is contained in:
parent
ebb84e8d19
commit
7d21ec23f6
@ -189,7 +189,10 @@ GtkCssValue *
|
|||||||
_gtk_css_number_value_new (double value,
|
_gtk_css_number_value_new (double value,
|
||||||
GtkCssUnit unit)
|
GtkCssUnit unit)
|
||||||
{
|
{
|
||||||
static GtkCssValue zero_singleton = { >K_CSS_VALUE_NUMBER, 1, GTK_CSS_NUMBER, 0 };
|
static GtkCssValue number_singletons[] = {
|
||||||
|
{ >K_CSS_VALUE_NUMBER, 1, GTK_CSS_NUMBER, 0 },
|
||||||
|
{ >K_CSS_VALUE_NUMBER, 1, GTK_CSS_NUMBER, 1 },
|
||||||
|
};
|
||||||
static GtkCssValue px_singletons[] = {
|
static GtkCssValue px_singletons[] = {
|
||||||
{ >K_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 0 },
|
{ >K_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 0 },
|
||||||
{ >K_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 1 },
|
{ >K_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 1 },
|
||||||
@ -199,8 +202,8 @@ _gtk_css_number_value_new (double value,
|
|||||||
};
|
};
|
||||||
GtkCssValue *result;
|
GtkCssValue *result;
|
||||||
|
|
||||||
if (unit == GTK_CSS_NUMBER && value == 0)
|
if (unit == GTK_CSS_NUMBER && (value == 0 || value == 1))
|
||||||
return _gtk_css_value_ref (&zero_singleton);
|
return _gtk_css_value_ref (&number_singletons[(int) value]);
|
||||||
|
|
||||||
if (unit == GTK_CSS_PX &&
|
if (unit == GTK_CSS_PX &&
|
||||||
(value == 0 ||
|
(value == 0 ||
|
||||||
|
Loading…
Reference in New Issue
Block a user