cssarrayvalue: Allow calling array API on non-arrays
authorTimm Bäder <mail@baedert.org>
Wed, 8 Jan 2020 07:37:04 +0000 (08:37 +0100)
committerTimm Bäder <mail@baedert.org>
Sat, 18 Jan 2020 07:49:51 +0000 (08:49 +0100)
commit8d15efba8f0ed705ed23aeba529652395128bfa7
tree016fc9867eb135260236980a2168ffe3a30858c1
parent1200fe2daf91df4bec11d3fdd97f06eedb01a976
cssarrayvalue: Allow calling array API on non-arrays

Just allow calling _get_nth() and _get_n_values() on every kind of css
value. This way we can allow all values in places where only array
values would be allowed before.

This spares us around 1000 array values in the widget factory.

css value stats before:

GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssCornerValue: 556
GtkCssArrayValue: 1130
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
GtkCssColorValue: 1452
SUM: 9415

and after:

GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssCornerValue: 556
GtkCssArrayValue: 143
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
GtkCssColorValue: 1452
GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
SUM: 8428

9415 to 8428 is a 987 reduction (10.4%)
gtk/gtkcssarrayvalue.c
gtk/gtkcssarrayvalueprivate.h
gtk/gtkcssstylepropertyimpl.c
gtk/gtkcssstylepropertyprivate.h