summaryrefslogtreecommitdiff
path: root/gtk/gtkcssenumvalue.c
Commit message (Collapse)AuthorAgeFilesLines
* css: Fix text-decoration-line supportMatthias Clasen2021-01-261-52/+93
| | | | | | | | | | | | This property needs to be treated as flags, not as enum, since it should be possible to specify more than one value, e.g. text-decoration-line: underline overline; Tests included. Fixes: #3621
* css: Support overlineMatthias Clasen2021-01-261-0/+1
| | | | | We can support text-decoration-line: overline, since pango supports it now.
* Share the popcount() fallback for MSVCEmmanuele Bassi2020-12-091-44/+9
| | | | | We use __builtin_popcount() in a couple of places, so it makes sense to have it in one header.
* Use style values directlyMatthias Clasen2020-01-291-4/+4
| | | | | | | Replace uses of gtk_css_style_get_value with direct access, throughout the tree. We don't replace all uses, just those where we are dealing with a fixed property. Be careful to handle the currentColor special case for color properties.
* css: Set the is_computed flag for more valuesTimm Bäder2020-01-181-37/+40
| | | | | With these changes, we skip roughly 85% of compute() calls during widget-factory startup
* cssvalue: Add is_computed flagTimm Bäder2020-01-181-86/+86
| | | | | | | | | | | | | | | When a css value has "child" css values (e.g. a linear gradient has several color stop css values) which are all computed (won't change when compute() is called on them), we want to skip computing the entire subtree. Since css values are immutable, we can set the is_computed flag at construct time. Since GtkCssValue instances are 0-initialized in _gtk_css_value_alloc, the default for is_computed it FALSE. This commit only sets it to TRUE in a few cases, such as various "none" singleton values which will never change. Later commits will refine this and set it for more values.
* cssvalue: Add type names for all classesTimm Bäder2020-01-181-0/+20
| | | | | This is important to have for debugging and e.g. to print statistics for the individual css value types
* css: Make font-weight an integerBenjamin Otte2019-04-121-63/+21
| | | | | This conforms to what Pango does and to the CSS4 spec. And it makes the parsing code easier. So let's go for it.
* cssparser: Introduce gtk_css_parser_try_ident()Benjamin Otte2019-04-121-19/+19
| | | | ... and gtk_css_parser_has_function().
* css: Introduce the idea of dynamic valuesBenjamin Otte2018-03-161-0/+40
| | | | | | | Dynamic values are values that change their contents with the current (monotonic) time. This just introduces the GtkCssValue API for it.
* css: Merge GtkStyleProviderPrivate into GtkStyleProviderBenjamin Otte2017-10-311-18/+18
| | | | | | | | This is just lots of renaming. The interface remains private, so the public API does not change, apart from removing the definition of the Interface object to avoid subclassing.
* gtk/gtkcssenumvalue.c: Deal with __builtin_popcount on MSVCChun-wei Fan2017-10-251-0/+37
| | | | | | | | | | | | | | __builtin_popcount is a GCCism that is used to count the number of bits involved, which means any non GCC/CLang compilers won't like the code, meaning that on MSVC builds we must implement it ourselves. We first use __cpuid() to check whether the CPU supports the popcount instruction, if it does, we use the __popcnt intrinsic, otherwise (untested, since I don't have a system that does not have the instruction), we use the suggested hacks at http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel https://bugzilla.gnome.org/show_bug.cgi?id=773299
* css: Use enums instead of idents for font-variant propertiesMatthias Clasen2017-09-181-0/+567
| | | | | | | | As Benjamin says, ident should only be used if any value is valid, which is not the case here. So use enums instead, which should also be more efficient. To handle the more complicated cases like font-variant-ligatures, we have to introduce flags-like values.
* css: implement font-variant as a shorthandMatthias Clasen2017-09-181-47/+0
| | | | | | | | | Drop the current css2-style font-variant property and replace it with a shorthand as specified in the css3 fonts module. Currently, we fully support the font-variant-ligatures, font-variant-position, font-variant-caps, font-variant-numeric and font-variant-east-asian subproperties. font-variant-alternatives is only partially supported.
* css parser: Fix names for blend modesMatthias Clasen2017-03-311-4/+4
| | | | | | | When the blend modes were ported to use gsk defines, some dashes were accidentally turned into underscores. It also turns out that we were expecting 'saturate' instead of 'saturation' as per the css spec. Fix that as well.
* css: Remove -gtk-icon-effectBenjamin Otte2016-12-311-87/+0
| | | | -gtk-icon-filter replaces this now.
* css: Replace custom blend modes with GskBlendModeBenjamin Otte2016-12-201-19/+19
|
* Revert a mistaken changeMatthias Clasen2016-07-261-2/+2
| | | | | | I thought I needed ot rearrange the ordering of the animation-direction values for the parser, overlooking the fact that we already parse them backwards to address this very problem.
* Fix parsing of some css propertiesMatthias Clasen2016-07-031-3/+3
| | | | | | | | | | | Our property parser stops at the first match when looking for enums, so we need to order our values so that we don't end up with prefixes of longer names being found first. I noticed this when the parser tried to interpret background-blend-mode: color-burn; as "color, with junk at the end". It also affects animation-direction, which is also fixed here.
* css: add background-blend-mode supportGeorges Basile Stavracas Neto2016-07-031-0/+61
| | | | | | | | | | | | | | | | | CSS supports blend modes, in which a series of layers are merged together according to the given operation or set of operations. Support for blend modes landed on Cairo, which exposes all the commons and also the exquisites blend modes available. Adding support for blend modes, then, is just a matter of using the available Cairo operations. This patch adds the background-blend-mode CSS enum property, and adapts the background rendering code to blend the backgrounds using the available blend modes when they're set. https://bugzilla.gnome.org/show_bug.cgi?id=768305
* Fix the buildMatthias Clasen2016-05-011-1/+1
| | | | I forgot to add an include here.
* css: Use setters for font size and familyMatthias Clasen2016-05-011-18/+7
| | | | | This avoid creating pango font descriptions all the time, when the gtk-font-name setting hasn't actually changed.
* css: always get default font size in pixelsMatt Watson2016-04-121-15/+26
| | | | | | | | | | | | | | | Fixes a couple bugs... - Pixel font sizes in css would render as point sizes. - For em font sizes, where the parent size was set and not default, we would incorrectly convert a pixel value from points to pixels. We'll always grab the default font size in pixels so we don't keep confusing things. Worth noting that gtk css font-size will still behave differently than the web. Pango interprets font-size differently.
* Fix parsing of font-weightMatthias Clasen2015-12-201-2/+2
| | | | The parser was turning a 400 into a 200 and a 700 into a 500.
* css: Leftover renaming gtk-image-effect => icon-effectBenjamin Otte2015-12-041-5/+5
| | | | The previous renaming commit was incomplete, so here we go again.
* render: Split out icon-effect apply functionBenjamin Otte2015-12-041-0/+33
|
* css: Rename -gtk-image-effect to -gtk-icon-effectBenjamin Otte2015-12-021-9/+9
| | | | This is a property for icons, so we should name it as such.
* css: support text-decoration-stylePaolo Borelli2015-07-061-2/+52
| | | | | The support is limited to underline single, double and wavy, which is what pango has today.
* css: add support for text-decoration-linePaolo Borelli2015-07-061-0/+46
|
* css: Silence a clang warningMatthias Clasen2015-03-221-1/+1
| | | | | | Clang complains that this check can never be true. Since this is a argument range check which we do to catch bad input, convince clang to not complain instead of taking it out.
* cssvalue: Remove GtkCssDependenciesBenjamin Otte2015-03-181-10/+3
| | | | They are not used anymore.
* css: Implement animations for font-weight propertyBenjamin Otte2015-02-161-1/+17
|
* css: Implement "bolder" and "lighter" font weightsBenjamin Otte2015-02-161-2/+58
|
* css: Move scale to GtkStyleProviderPrivatewip/mir2Benjamin Otte2015-02-061-10/+8
| | | | | | 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.
* cssstyle: Rename GtkCssComputedValues => GtkCssStyleBenjamin Otte2015-01-071-7/+7
| | | | | This is literally just renaming of the object (and the associated source files). No other changes are in there.
* css: Implement font-stretchEmmanuele Bassi2014-08-281-0/+54
| | | | | | | | | | | | | | The font-stretch CSS property is defined in the Level 3 CSS Fonts module, available at: http://dev.w3.org/csswg/css-fonts/#propdef-font-stretch It allows defining a normal, condensed, or expanded face to the font description. Pango already supports it, so this is literally just the CSS parser machinery needed to bridge our CSS to the FontDescription API. https://bugzilla.gnome.org/show_bug.cgi?id=735593
* css: Fix animation-direction parsingBenjamin Otte2014-07-071-2/+5
| | | | | We were parsig "alternate-reverse" as "alternate" and then complaining about the "-reverse" junk at the end of the value.
* Revert "Fix crash"Benjamin Otte2014-05-221-1/+0
| | | | | | This reverts commit 024c11dd66dfda5efb110f55ecec93801f21c0ed. It's not a crash fix to cause a return_val_if_fail() to happen.
* Fix crashBehdad Esfahbod2014-05-221-0/+1
|
* css: Add a -gtk-icon-style propertyBenjamin Otte2014-05-141-0/+54
| | | | | | | | | | | | | The values can be: "requested" - the style as requested "regular" - use a regular full-color icon "symbolic" - use a symbolic icon The property defaults to "requested", so no changes should be seen unless CSS overrides it. It is also inherited, so that using this CSS .toolbar { -gtk-icon-style: symbolic; } is enough to force the whole toolbar to use symbolic icons.
* css: Add a GtkCssValue for GtkCssImageEffectCosimo Cecchi2013-08-201-0/+53
| | | | | | | This will allow us to use the CSS machinery to apply a highlight or dim effect when images are prelit or insensitive. https://bugzilla.gnome.org/show_bug.cgi?id=705443
* css: Add a scale argument to css-value compute vfuncAlexander Larsson2013-07-031-0/+2
| | | | | | | | 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.
* cssvalue: Fix the scaling factors for 'smaller' and 'larger'Benjamin Otte2012-12-011-2/+2
| | | | They were reversed. Looks like a bad case of copy/paste failure.
* cssvalue: Parse font sizes properlyBenjamin Otte2012-12-011-11/+11
| | | | | As the last CSS property, font-size now is a proper number (when it's not a keyword).
* cssvalue: Change order of valuesBenjamin Otte2012-12-011-3/+3
| | | | | This is necessary so that the (rather stupid) parsing code doesn't parse "small" and then is happy when it should instead parse "smaller".
* css: Fix dependencies for font lookupBenjamin Otte2012-12-011-0/+2
| | | | 'larger' and 'smaller' depend on the parent value. D'oh.
* css: Add more features to font-size codeBenjamin Otte2012-12-011-1/+146
| | | | | | | | We now support the keywords (like xx-small, medium, larger, smaller...) and I've changed the default value to be "medium". This required some shuffling of the "get default font size" code. But all is well now.
* css: Huge refactoring to avoid computing wrong valuesBenjamin Otte2012-09-281-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Add animation enum propertiesBenjamin Otte2012-09-171-0/+163
|
* 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...