Commit Graph

39 Commits

Author SHA1 Message Date
Timm Bäder
77e0d360ed Add pure and const annotations to various functions 2020-01-26 18:21:07 +01:00
Timm Bäder
8d15efba8f 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%)
2020-01-18 08:49:51 +01:00
Matthias Clasen
94b1e72aa3 css: Remove an unused function
_gtk_css_style_property_get_mask_affecting was superseded
by GtkCssStyleChange back in 2015.
2020-01-14 18:32:05 -05:00
Benjamin Otte
dd83f9ca86 API: Remove API to set CSS properties from GValues
This API was only used in GtkModifierStyle and GtkStyleProperties and
they are both on their way out.

CSS properties must now be set using strings via the regular parser API.
2016-10-16 18:17:21 +02:00
Matthias Clasen
7b9b661aea Export some font parsing functions
These will be used for parsing the font: shorthand too.
2016-04-18 11:46:58 -04:00
Benjamin Otte
aa1b7fab9c css: Remove _gtk_css_style_property_changes_affect_size()
... and _gtk_css_style_property_changes_affect_font().

Replace it with _gtk_css_style_property_get_mask_affecting().
2015-01-27 05:04:34 +01:00
Benjamin Otte
c42e54e949 css: Add _gtk_css_style_property_get_mask_affecting()
Computes a bitmask for all properties that affect the given flags.
2015-01-27 05:04:34 +01:00
Benjamin Otte
ffff7b055b css: Remove GtkCssStyleProperty::affects-size
... and GtkCssStyleProperty::affects-font properties. Code now uses
GtkCssStyleProperty::affects instead.
2015-01-27 05:04:34 +01:00
Benjamin Otte
c0650057c1 css: Add GtkCssStyleProperty::affects property 2015-01-27 05:04:34 +01:00
Cosimo Cecchi
b855e91f7a build: fix some GCC warnings 2012-12-07 11:35:06 -05:00
Alexander Larsson
6dfee46cdb css: Add _gtk_css_style_property_affects_font
This checks if a style_update affects the font.
2012-12-06 21:14:02 +01:00
Benjamin Otte
8560ff88cd styleproperty: Add _gtk_css_style_property_changes_affect_size()
This gives fast access to the question of wether a style update requires
a resize.
2012-11-30 20:37:46 +01:00
Benjamin Otte
a5770cef36 styleproperty: Add an affects-size property
This property will be used to avoid gtk_widget_queue_resize() calls in
favor of gtk_widget_queue_draw().
2012-11-30 20:10:23 +01:00
Benjamin Otte
6dc3113edc cssstyleproperty: Get rid of unused API
Both _gtk_css_style_property_print_value() and
_gtk_css_style_property_compute_value() aren't necessary anymore and are
replaced by _gtk_css_value_print() and _gtk_css_value_comptue()
respectively.
2012-08-28 15:40:57 +02:00
Benjamin Otte
6ee237ea59 cssstyleproperty: Remove base argument
from parse functions.
2012-05-11 16:42:12 +02:00
Benjamin Otte
2fec112422 styleproperty: Remove equal_func vfunc
Equality tests are done with _gtk_css_value_equal(). There is no need to
do it per-property, equal values will still be equal.

This essentially reverts 24f5d54329e028347bd76af42e86ed190c1229a2 and
92c7a7171e1240b6d961ee5b6f9ab6b596e98904.
2012-04-17 08:59:20 +02:00
Benjamin Otte
ed45a3c2f0 cssstyleproperty: Add _gtk_css_style_property_is_animated() 2012-04-17 08:59:17 +02:00
Benjamin Otte
dcec7a5529 cssstyleproperty: Make assign_value a vfunc 2012-04-17 08:59:14 +02:00
Benjamin Otte
f7c0c7677b cssstyleproperty: Make query func a vfunc
This will be needed soon.
2012-04-17 08:59:13 +02:00
Benjamin Otte
c8e57d63ec cssstyelproperty: Rempove specified-type and computed-type props
This removes the necessity to keep a GType associated with style
properties and code can now make use of GtkCssValue completely.
2012-04-17 08:59:13 +02:00
Benjamin Otte
9b7640b898 styleproperty: Make _gtk_style_property_parse_value() return a CssValue
Also split out initial/inherit handling into a custom GtkCssValue class.
2012-04-17 08:59:11 +02:00
Benjamin Otte
718ceaec45 css: Remove _gtk_css_style_property_is_specified_type()
That check is going to be refactored away.
2012-04-17 08:59:11 +02:00
Benjamin Otte
58e4fdf911 styleproperty: Make print_func take a GtkCssValue
Also, constify GtkCssValue getters, so we can pass a const GtkCssValue
to the print_func.
2012-04-17 08:59:11 +02:00
Benjamin Otte
115c34498e styleproperty: Add a function to compare values for equality
and default to never compare them as equal.
2012-04-17 08:59:10 +02:00
Alexander Larsson
7603e6e473 css: Use GtkCssValues instead of GValue in the css machinery
Also, in places where we're computing a new CssValue based on an
old one, make sure that if nothing changes we're returning a reference
to the old one, rather than creating a new identical instance.
2012-03-08 11:03:57 +01:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Benjamin Otte
a81ac3d5cd css: Add a check function for specified types
... and use it.

It seems kinda necessary for the refactoring I'm about to do...
2012-02-02 03:14:00 +01:00
Benjamin Otte
9fa764abec styleproperty: Introduce "specified type" and "computed type"
Make the types explicit. This way, we can actually do useful stuff with
them (like sanity checks, d'oh).
2012-02-02 03:13:34 +01:00
Benjamin Otte
c3d337312a styleproperty: Move parse/print vfuncs to GtkCssStyleProperty 2012-01-09 18:37:55 +01:00
Benjamin Otte
22a65bcd82 styleproperty: Add a compute vfunc 2012-01-09 18:37:55 +01:00
Benjamin Otte
e87cf5d789 css: Redo value resolving
Instead of on-demand resolvage, we now resolve during lookup. The step
is done via
  _gtk_css_style_property_compute_value()
which currently calls into
  _gtk_css_style_compute_value()
That function has all the old resolving machinery.

The only part missing for now is the handling of win32 code. It will be
added back later.
2012-01-09 18:37:55 +01:00
Benjamin Otte
91202ef497 styleproperty: Move pspec to GtkCssCustomProperty
It's only used there.
2012-01-09 18:37:55 +01:00
Benjamin Otte
8bcfa6ef78 styleproperty: Move implementations to separate file 2012-01-09 18:37:54 +01:00
Benjamin Otte
4821e52cf2 styleproperty: Move pspec to GtkCssStyleProperty
shorthands don't use pspecs anymore.
2012-01-09 18:37:53 +01:00
Benjamin Otte
b904679a11 styleproperty: Move value printing to real properties
We can't print shorthands, so don't try.
In particular, I want to get away from shorthands being representable
using GValue, and this function kinda requires that.
2012-01-09 18:37:53 +01:00
Benjamin Otte
341a738dc6 styleproperty: Move member variables
These variables are only relevant for style properties, but not for
shorthands, so put them there.
2012-01-09 18:37:53 +01:00
Benjamin Otte
544d210a61 css: Move a bunch of functions
... from GtkStyleProperty to GtkCssStyleProperty.
2012-01-09 18:37:52 +01:00
Benjamin Otte
0a3ac5efbc styleproperty: Move id handling
only real style properties can have an id, so let
GtkCssStylePropertyClass handle it.
2012-01-09 18:37:52 +01:00
Benjamin Otte
f9485241b1 styleproperty: Split into shorthand and real style properties 2012-01-09 18:37:51 +01:00