Commit Graph

172 Commits

Author SHA1 Message Date
Benjamin Otte
aa917ce3b7 css: Redo GtkCssAffects
We now have GTK_CSS_AFFECTS_CONTENT for properties that have an effect
on content rendering.

Using GTK_CSS_AFFECTS_ICON is wrong for icon-transform and icon-filter
as they don't change the icon, just how the icon is rendered, so we use
GTK_CSS_AFFECTS_CONTENT for those.

We also introduce GTK_CSS_AFFECTS_POSTEFFECT for opacity and filter -
properties that affect the whole drawing of the widget by applying an
effect after everything is said and done.
2017-01-01 19:53:36 +01:00
Benjamin Otte
959f80e6e9 css: Implement filter
So far, it's only implemented for widgets, not for gadgets.

Not sure how to do it for gadgets without conflicts for widget gadgets
yet...
2016-12-31 02:49:47 +01:00
Benjamin Otte
45fbc25e5e css: Remove -gtk-icon-effect
-gtk-icon-filter replaces this now.
2016-12-31 02:49:47 +01:00
Benjamin Otte
2645b5a7d7 gtk: Implement -gtk-icon-filter
This uses the new GskColorMatrixNode to implement a filter that applies
to icons. It's meant to replace -gtk-icon-effect.
2016-12-31 02:49:47 +01:00
Benjamin Otte
3e26fadb24 css: Replace custom blend modes with GskBlendMode 2016-12-20 18:01:11 +01:00
Benjamin Otte
d7148a4718 css: Add "border-spacing" CSS property
It's using a GtkCssPositionValue, even though that name is wrong. But
the functionality of managing 2 lengths is exactly what we want.

Nobody is using this yet.
2016-12-10 04:32:55 +01:00
Matthias Clasen
d674e9c8fa Drop support for -gtk-gradient
The standard CSS radial-gradient can be used instead, and Adwaita
and HighContrast have been ported over.
2016-11-07 14:46:41 -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
Timm Bäder
f2c455fedb Remove GtkThemingEngine
As well as the corresponding GtkCssEngineValue used to parse it in css.
2016-10-16 18:17:21 +02:00
Timm Bäder
73b949173e stylepropertyimpl: Remove double assignment 2016-08-20 09:54:44 +02:00
Benjamin Otte
f422208040 css: Rename functions
I don't want to use a generic function for font sizes as font sizes are
special. Plus, the function is only used in one place.
2016-07-28 11:42:54 -04:00
Georges Basile Stavracas Neto
369db4a406 css: add background-blend-mode support
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
2016-07-03 17:24:47 -04: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
Matthias Clasen
31a12c6a23 css style: Rename some static functions
Make the font property functions follow the general naming
scheme, and remove pango from the names.
2016-04-18 11:46:58 -04:00
Benjamin Otte
1548b680fc css: Make outline-offset animatable
CSS claims it should be, so we make it.
2016-02-21 01:02:51 +01:00
Benjamin Otte
23b3774e6b css: Mark outline properties as affecting clip when they do 2016-02-21 01:02:51 +01:00
Christoph Reiter
3a15aa2a95 Add -gtk-image-effect alias for -gtk-icon-effect
The property name was changed in 2396265523. This makes sure
apps using it don't break and get a helpful warning instead.
2016-02-16 15:54:13 +01:00
Benjamin Otte
a620a1d688 win32: Remove unused functions / header includes 2016-02-11 03:44:48 +01:00
Timm Bäder
0ec4c76d8f stylepropertyimpl: Use GTK_CSS_AFFECTS_SYMBOLIC_ICON
Things like color affect symbolic icons, but not colored icons, while
other css properties like -gtk-icon-effect affect colored icons, but not
symbolic ones.
2016-02-07 19:16:26 +01:00
Benjamin Otte
74c3468d64 cssstyleproperty: Don't allow assigning min-width/min-height 2016-01-22 14:18:15 +01:00
Carlos Garcia Campos
0f7b4dad0f cssstyleproperty: Make it possible to query CSS opacity with gtk_style_context_get()
Add a query implementation to opacity property. Also fix the assert in
gtk_css_style_property_register() to allow registering properties with
query but without assign function.

https://bugzilla.gnome.org/show_bug.cgi?id=760933
2016-01-21 14:58:57 +01:00
Florian Müllner
ea69bf8c17 cssstyleproperty: Expose min-width/height 2016-01-14 17:20:51 +01:00
Matthias Clasen
34c263683c Move the -gtk-icon-palette property up
Other properties will start depending on it in subsequent
commits, so move it up to prevent ordering problems.
2016-01-13 16:16:39 -05:00
Matthias Clasen
fdba244c38 Add the caret-color CSS property
This property is defined in http://www.w3.org/TR/css3-ui/#caret-color.
We also add a -gtk-secondary-caret-color property, since GTK+ has
supported differently colored split cursors in the past. Unlike
CSS, we don't support the weakly defined auto keyword, and just
use currentColor as the initial value.
2016-01-08 07:33:20 -05:00
Matthias Clasen
f61b7ba797 Prefix outline radius CSS properties
These are not in any CSS specifications, so mark them as GTK+
additions by giving them a -gtk prefix. The old names still work.
2015-12-22 16:18:10 -05:00
Benjamin Otte
0fb01decba css: Add min-width/height CSS properties 2015-12-15 08:41:16 -05:00
Benjamin Otte
1b835fc7ce css: Leftover renaming gtk-image-effect => icon-effect
The previous renaming commit was incomplete, so here we go again.
2015-12-04 17:44:51 +01:00
Benjamin Otte
7fa37e4bf8 css: Introduct -gtk-icon-palette
This borrows heavily from the CSS4 fonts draft's font-palette, currently
found at https://drafts.csswg.org/css-fonts-4/#font-palette-control

The palette is mainly meant to trigger invalidations when colors used for
symbolic icons change, to potentially allow extending supported colors
in symbolic icons and to recolor all colors of a symbolic icon, not just
the main one.

The syntax for the property goes like this:
Name:        -gtk-icon-palette
Value:       default | name <color> [ , name <color> ]*
Initial:     default
Applies to:  all elements with icons
Inherited:   yes
Animatable:  yes, each color animated separately

The property defines a list of named colors to be used when looking up
icons. If a name is not defined, the value of the current "color"
property is used. Which names are relevant depends on the icons in use.
Currently symbolic icons make use of the names "success", "warning" and
"error".

"default" is the current behavior of the GTK when coloring symbolic
icons and is equal to the string
  success @success_color, warning @warning_color, error @error_color

Animation is crudely implemented by animating colors that are in both
palettes that are animated and otherwise keeping the color from the
palette that defined it. Note that this can cause a sharp cut at the
beginning or end of the animation when the color goes away and will
therefore be replaced with the color property.

You can see an example of animations at
http://gfycat.com/CautiousPeacefulIaerismetalmark
2015-12-03 00:47:00 +01:00
Benjamin Otte
da6beb994e css: Add ability to specify icontheme in CSS
-gtk-icontheme: "oxygen" works now.

This is a very crude implementation. It's meant for testing only.
2015-12-02 03:54:41 +01:00
Benjamin Otte
2396265523 css: Rename -gtk-image-effect to -gtk-icon-effect
This is a property for icons, so we should name it as such.
2015-12-02 00:29:31 +01:00
Matthias Clasen
d267b8e028 Rename the gtk-key-bindings property
This is not a standard CSS property, so rename it to
-gtk-key-bindings. We still support the old name, with a
deprecation warning.
2015-11-20 20:35:39 -05:00
Matthias Clasen
5f73e8a720 Rename the icon-shadow property
This is not a standard CSS property, so rename it to
-gtk-icon-shadow. We still support the old name, with a
deprecation warning.
2015-11-20 20:35:39 -05:00
Benjamin Otte
7f8de66c0a css: text-decoration-style is not inherited 2015-07-08 05:48:59 +02:00
Paolo Borelli
1eb1481bdf css: support text-decoration-style
The support is limited to underline single, double and wavy, which
is what pango has today.
2015-07-06 20:06:20 +02:00
Paolo Borelli
a57e6731c4 css: support text-decoration-color 2015-07-06 00:04:06 +02:00
Paolo Borelli
384df61c90 css: add support for text-decoration-line 2015-07-06 00:04:06 +02:00
Paolo Borelli
a19331f231 label: add support for CSS letter-spacing property
Support letter-spacing CSS property on GtkLabel.
Reftest is included.
2015-07-06 00:04:05 +02:00
Benjamin Otte
295b8aab0c css: Implement animations for font-weight property 2015-02-16 23:57:03 +01:00
Benjamin Otte
89f635fee1 css: Add -gtk-dpi CSS property hack
This property is necessary to ensure widgets automatically update after
the text scale factor is changed desktop-wide.

And if I'm already doing a property like this, I can make it
overridable. So now you can override the dpi per-widget with CSS like
GtkSwitch {
  -gtk-dpi: 48;
}
if you want to debug things.

Long-term, we want to get rid of this property and insist on dpi being
96 everywhere and people can change the font size to get larger fonts.
2015-02-05 18:57:29 +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
Benjamin Otte
11d70f1ac3 css: Add a -gtk-icon-theme CSS property
The property is useless to set (it only allows 'initial', 'inherit' and
'unset' as values), but it is used to track changes to the icon theme.
And as such, it can ensure that widgets can track when they need to
reload icons.

https://bugzilla.gnome.org/show_bug.cgi?id=743341
2015-01-27 05:04:34 +01:00
Benjamin Otte
9ce8ce1198 css: Move icon properties to the end
The order in which properties are defined depends on the order in which
they are computed. And that means that properties can only depend on
other properties that are defined before them.

The next patches will need this reordering.
2015-01-20 06:30:19 +01:00
Matthias Clasen
31f502a9ae css: Handle font-size changes properly
Changing font size does not cause widgets to update their size
properly anymore, since we forgot an invalidation flag. The
problem can be observed e.g. by running gtk3-demo and calling

gsettings set org.gnome.desktop.interface font-name "Cantarell 22"
2014-12-23 21:11:00 -05:00
Benjamin Otte
433c20e59d styleproperties: Remove header where it's not used 2014-10-24 21:31:40 +02:00
Benjamin Otte
8abc6e06b2 css: Add "-gtk-icon-source: builtin"
... and make it the default. This takes over the meaning from "none" for
this property in that it draws the fallback builtin image.
"none" now literally means no image will be drawn.
2014-10-21 05:53:19 +02:00
Benjamin Otte
e683e915b8 css: Queue resize for properties that affect clip
This fixes shadows that are animated not updating the clip of the widget
they are drawn on. An example of this are the buttons in the CSS shadows
example in gtk-demo.

Reftest included
2014-10-03 06:18:04 +02:00
Benjamin Otte
f7ee61c833 css: Have finer-grained definitions for effects of CSS props
This adds the GtkCssAffects enum and implements it for all style
properties.
So far, this is not exposed outside of the implementation file.
2014-10-03 06:18:04 +02:00
Matthias Clasen
e014b89310 Move gtkthemingengine to deprecated directory
This is the place for wholly-deprecated sources.
2014-08-29 16:35:37 -04:00
Emmanuele Bassi
5ad60caa3c css: Implement font-stretch
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
2014-08-28 13:41:40 +01:00