summaryrefslogtreecommitdiff
path: root/gtk/gtkcssnumbervalue.c
Commit message (Collapse)AuthorAgeFilesLines
* Use an internal parameter check here as wellMatthias Clasen2017-01-101-1/+2
| | | | | We should not slow down the core parts of the css machinery with type checks.
* win32 theme: Add a way to query border of theme partsBenjamin Otte2016-02-171-2/+10
|
* win32: Add support for -gtk-win32-part-width/height to CSSBenjamin Otte2016-02-151-2/+6
| | | | It's unused by now, but I want it for min-width of checks/radios.
* css: Add a number value handling win32 sizesBenjamin Otte2016-02-151-1/+5
|
* css: Implement transitions for numbers of different unitsBenjamin Otte2016-02-131-0/+19
| | | | | | | 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.
* css: Add API to handle order when printing calc()Benjamin Otte2016-02-131-0/+21
| | | | | Also, add some tests and update old ones to print calc() statements correctly.
* css: Add support for sums to calc()Benjamin Otte2016-02-131-0/+36
| | | | | | | | | | 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.
* css: Add initial support for calc()Benjamin Otte2016-02-131-1/+6
| | | | So far, calc() only supports literals, ie it's completely useless.
* css: Add gtk_css_number_value_can_parse()Benjamin Otte2016-02-131-0/+6
| | | | | | Use it instead of _gtk_css_parser_has_number(). We need that once we introduce calc() support.
* css: Turn number values into a virtual typeBenjamin Otte2016-02-131-246/+20
| | | | | | | 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.
* cssnumbervalue: Remove gtk_css_number_value_get_unit()Benjamin Otte2016-02-131-4/+12
| | | | | | | 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.
* css: Convert numbers with GTK's dpiBenjamin Otte2016-02-051-9/+15
| | | | | | | | Don't hardcode 96 for dpi, but instead use the value of the -gtk-dpi property (that mirrors the GdkScreen's dpi if it wasn't set explicitly). This makes these values scale when the large font setting in control-center is enabled.
* css: Properly convert em, ex and rem to pixelsBenjamin Otte2016-02-051-3/+4
| | | | The previous code converted to pt.
* css: Add rem unitBenjamin Otte2016-02-041-5/+4
| | | | Good luck, Lapo.
* gtkcssnumbervalue.c: Include fallback-c89.c to fix buildChun-wei Fan2015-12-231-2/+2
| | | | | | ... on older Visual Studio versions, where isinf() is not available, and copy the isinf() implementation from gdk/fallback-c89.c to gtk/fallback-c89.c.
* fix printing of numbersMatthias Clasen2015-12-221-4/+11
| | | | We should be printing infinite, not inf.
* cssvalue: Remove GtkCssDependenciesBenjamin Otte2015-03-181-9/+5
| | | | They are not used anymore.
* css: Move scale to GtkStyleProviderPrivatewip/mir2Benjamin Otte2015-02-061-16/+15
| | | | | | This way, we can remove it as a separate argument from gtk_css_value_compute() and allow computation to only depend on one thing: the style provider.
* css: Move "border-style: none" special case to CssValueNumberSebastian Keller2015-01-211-0/+34
| | | | | This fixes the background being shifted by the border-width even though the border-style was none.
* cssstyle: Rename GtkCssComputedValues => GtkCssStyleBenjamin Otte2015-01-071-6/+6
| | | | | This is literally just renaming of the object (and the associated source files). No other changes are in there.
* css: Add a scale argument to css-value compute vfuncAlexander Larsson2013-07-031-0/+1
| | | | | | | | We need to be able to compute different GtkCssImage values depending on the scale, and we need this at compute time so that we don't need to read any images other than the scale in used (to e.g. calculate the image size). GtkStyleProviderPrivate is shared for all style contexts, so its not right.
* Add singleton for css number 1.0Alexander Larsson2013-02-071-3/+6
| | | | | | This will be nice as this is will be the default for opacity. https://bugzilla.gnome.org/show_bug.cgi?id=687842
* cssvalue: Parse font sizes properlyBenjamin Otte2012-12-011-4/+28
| | | | | As the last CSS property, font-size now is a proper number (when it's not a keyword).
* css: Move special case code for border widthsBenjamin Otte2012-10-021-34/+0
| | | | | | | | | | | | | We need to store the border widths independant of them being set to 0 by border styles, because otherwise we'd need to track that dependency and recompute on changes, and I don't want to add more entries to GtkCssDependencies just for this special case. By moving the code that does the setting to 0 from the compute stage to the query stage, we can achieve this. Now we need to just be aware that the actual value stored is not set to 0 when we use gtk_css_computed_values_get_value().
* css: Huge refactoring to avoid computing wrong valuesBenjamin Otte2012-09-281-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Here's the shortest description of the bug I can come up with: When computing values, we have 3 kinds of dependencies: (1) other properties ("currentColor" or em values) (2) inherited properties ("inherit") (3) generic things from the theme (@keyframes or @define-color) Previously, we passed the GtkStyleContext as an argument, because it provided these 3 things using: (1) _gtk_style_context_peek_property() (2) _gtk_style_context_peek_property(gtk_style_context_get_parent()) (3) context->priv->cascade However, this makes it impossible to lookup values other than the ones accessible via _gtk_style_context_peek_property(). And this is exactly what we are doing in gtk_style_context_update_cache(). So when the cache updates encountered case (1), they were looking up the values from the wrong style data. So this large patch essentially does nothing but replace the context argument in all compute functions with new arguments for the 3 cases above: (1) values (2) parent_values (3) provider We apparently have a lot of computing code.
* cssvalue: Pass property ID to transition functionBenjamin Otte2012-09-031-0/+1
| | | | | | | This is to allow animating arrays properly. I'm not really thrilled about this solution (we leak propertys into the values again...), but it's the best I can come up with - I prefer it to having N different array types...
* cssvalue: First step of proper dependency trackingBenjamin Otte2012-08-281-2/+2
| | | | | Instead of using the EVERYTHING aka FIXME value for tdependencies, actually compute the dependencies in a bunch of simple cases.
* css: Introduce dependencies for value computationsBenjamin Otte2012-08-281-3/+6
| | | | | | | | | When values are computed, they might depend on various other values and we need to track this so we can update the values when those other values change. This is the first step in making that happen. This patch does not do any dependency tracking at all, instead it uses GTK_CSS_DEPENDS_ON_EVERYTHING as a sort of FIXME.
* css: Move special case for 0px bordersBenjamin Otte2012-08-281-0/+35
| | | | This is in preparation for the next commits.
* css: Pass property_id to compute functionBenjamin Otte2012-08-281-0/+1
| | | | | | | | | | | | | | | | This is a reorganization of how value computing should be done. Previously the GtkCssStyleProperty.compute vfunc was supposed to take care of special cases when it needed those for computation. However, this proved to be very complicated in cases where values were nested and only the last value (of a common type) needed to be special cased. A common example for this was the fallback handling for unresolvable colors. Now, we pass the property's ID along with all compute functions so we can do the special casing where it's necessary. Note that no actual changes happen in this commit. This will happen in follow-ups.
* css: Introduce _gtk_css_value_compute()Benjamin Otte2012-08-281-61/+60
| | | | | | | 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.
* css: Remove GtkCssNumberBenjamin Otte2012-04-171-14/+0
| | | | It's completely replaced by GtkCssNumberValue now.
* cssvalue: Convert border-image-width to border valueBenjamin Otte2012-04-171-0/+8
|
* css: Add <time> type to css number stuffBenjamin Otte2012-04-171-0/+6
|
* stylecontext: Convert _gtk_style_context_peek_property()Benjamin Otte2012-04-171-2/+2
| | | | Take the property id instead of the name.
* cssvalue: Add _gtk_css_value_transition()Benjamin Otte2012-04-171-0/+15
| | | | | | | Returns a value that transitions between start and end or %NULL if the values cannot be transitioned. So far, all implementations but numbers and rgba return NULL.
* cssvalue: Do a hacky conversion of font-size to a number valueBenjamin Otte2012-04-171-2/+4
| | | | | | Just store the value as px for now. The font-size property needs a complete makeover anyway.
* cssvalue: Split number values into their own classBenjamin Otte2012-04-171-0/+194