Commit Graph

12 Commits

Author SHA1 Message Date
Benjamin Otte
7ad0f7fc52 css: Mark some hot functions as G_GNUC_PURE
By doing that, gcc will generate code that avoids calling these
functions when not needed.
2019-02-15 06:53:22 +01:00
Benjamin Otte
fb47a8d714 css: Remove deprecated number-as-pixels compatibility
Previously, for compatibility with GTK 3.0, we allowed specifying
numbers without units and interpreted them as pixels, even when the CSS
specification didn't.

Remove that now that we can break API.
2017-01-18 04:13:56 +01:00
Benjamin Otte
93eec3e52f css: Implement transitions for numbers of different units
We now can transition from 10px to 100%.

Note that this requires a teensy tiny hack in
gtk_css_value_transition(), but so be it.
2016-02-13 04:49:08 +01:00
Benjamin Otte
4a9fa1e750 css: Add API to handle order when printing calc()
Also, add some tests and update old ones to print calc() statements
correctly.
2016-02-13 04:49:08 +01:00
Benjamin Otte
65dd9da44a css: Add support for sums to calc()
This requires adding code to do math on number values:
  gtk_css_number_value_multiply()
and
  gtk_css_number_value_try_add()
were added to achieve that.

Some tests are included.
2016-02-13 04:49:08 +01:00
Benjamin Otte
a52ecd2be6 css: Add gtk_css_number_value_can_parse()
Use it instead of _gtk_css_parser_has_number().

We need that once we introduce calc() support.
2016-02-13 04:49:08 +01:00
Benjamin Otte
b246d55472 css: Turn number values into a virtual type
GtkCssNumberValue is now a base class for numbers.

Actual numbers are now implemented in GtkCssDimensionValue. The name is
borrowed from the CSS spec, so there.
2016-02-13 04:49:07 +01:00
Benjamin Otte
e2d966eda5 cssnumbervalue: Remove gtk_css_number_value_get_unit()
This is in preparation for calc(), as calc(50% - 5px) is valid CSS
but has 2 units. Instead, add a function to query a value's dimension
(so we can differentiate lengths from numbers) and add a function to
query if the value contains percentages.
2016-02-13 04:49:07 +01:00
Benjamin Otte
9b953829fb css: Introduce _gtk_css_value_compute()
This commit is essentially a large reorganization. Instead of all value
subtypes having their own compute function, there is the general
_gtk_css_value_compute() function that then calls a vfunc on the
subtype.
2012-08-28 15:40:56 +02:00
Benjamin Otte
dcd54e20d1 css: Remove GtkCssNumber
It's completely replaced by GtkCssNumberValue now.
2012-04-17 08:59:19 +02:00
Benjamin Otte
1170ecfd2e cssvalue: Convert border-image-width to border value 2012-04-17 08:59:19 +02:00
Benjamin Otte
a33df2d1d6 cssvalue: Split number values into their own class 2012-04-17 08:59:13 +02:00