Commit Graph

144 Commits

Author SHA1 Message Date
Matthias Clasen
2ddff872cd css: Drop the -gtk-icon-theme property
We want to always use the current icon theme, and only
have the minimum amount of custom properties.
2020-04-22 12:35:30 -04:00
Timm Bäder
01ba11fc71 css: Remove outline border radius properties
These are always set to the same value as the corresponding border
radius properties. They are also non-standard, so remove them and
replace them with the border radius properties everywhere.

Fixes #2414
2020-02-08 20:43:16 +01:00
Timm Bäder
98b42f6740 css: Remove unused function 2020-02-05 04:03:43 +01:00
Benjamin Otte
2d5a8974b3 selector: Hash differently
This will be relevant for a bloom filter. And bloom filters want 12bit
hashes, so we try to produce hash values < 4096.
2020-01-28 02:17:03 +01:00
Benjamin Otte
8b93ea9238 css: Get rid of GtkCssMatcher 2020-01-28 02:17:02 +01:00
Benjamin Otte
c2d69643a8 css: Move utility function
The function was not selector-specific, so putting it with all the other
utility functions makes more sense.

Also use the utility function in the node declaration printing.
2020-01-28 02:17:02 +01:00
Matthias Clasen
71ee4df357 css: Update affects flags for icons
We want to differentiate what requires recreating the
texture and what doesn't. In particular, the current
flags are not handling symbolic icons right.
2020-01-24 20:55:42 -05:00
Matthias Clasen
d0a8a717ef Bring back the reserved bit 2020-01-17 23:47:34 -05:00
Matthias Clasen
26c4c28068 Fix a few bugs in the css change flag definition
These were found by the new change flag tests.
2020-01-17 11:26:50 -05:00
Matthias Clasen
3fcbe8d5f3 Remove an unused define
We no longer use the GTK_CSS_CHANGE_RESERVED_BIT define.
2020-01-16 17:39:03 -05:00
Matthias Clasen
3c50e5324f Change the signature of gtk_css_style_get_static_style
It is clearer if this function returns a GtkCssStaticStyle.
2020-01-16 14:06:14 -05:00
Matthias Clasen
192a24fa1f css: Track selected state separately
Like the previous change, this reduces the number of
css nodes reacting to parent-state changes. The remaining
parent-state cases here are due to :link.

Before (numbers from widget-factory with Adwaita):
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2245
hover 562
disabled 859
backdrop 1080
sibling-name 63
sibling-disabled 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 236
parent-hover 5
parent-disabled 91
parent-backdrop 4

After:
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2245
hover 562
disabled 859
backdrop 1080
selected 579
sibling-name 63
sibling-disabled 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 115
parent-hover 5
parent-disabled 91
parent-backdrop 4
parent-selected 144
2020-01-16 11:26:46 -05:00
Matthias Clasen
2426b9e23a css: Track backdrop state separately
Like the previous change, this reduces the number of
css nodes reacting to parent-state changes.

Before (numbers from widget-factory with Adwaita):
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2247
hover 562
disabled 859
sibling-name 63
sibling-disabled 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 236
parent-hover 5
parent-disabled 91

After:
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2245
hover 562
disabled 859
backdrop 1080
sibling-name 63
sibling-disabled 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 236
parent-hover 5
parent-disabled 91
parent-backdrop 4
2020-01-16 11:25:04 -05:00
Matthias Clasen
64848aebf4 css: Track disabled state separately
Significantly reduces the number of nodes that react to
parent-state changes.

Before (numbers from widget-factory with Adwaita):
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2247
hover 2247
sibling-name 63
sibling-state 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 2226
parent-hover 5

After:
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2247
hover 562
disabled 859
sibling-name 63
sibling-disabled 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 236
parent-hover 5
parent-disabled 91
2020-01-16 11:23:25 -05:00
Matthias Clasen
fcceac6d11 css: Track hover state changes separately
The idea is that this reduce the amount of frequently
changing state that css nodes are sensitive to.

This is going to reduce the amount of style recomputation.
2020-01-16 11:17:48 -05:00
Matthias Clasen
112aed590f Remove builtin icons altogether
This removes support for GtkCssImageBuiltin and
GtkCssImageBuiltinType from everywhere.
2020-01-10 14:34:56 -05:00
Matthias Clasen
1932a50d36 css: Some updates to internal docs
Minor corrections to the AFFECTS flags docs.
2019-04-18 18:04:58 +00:00
Benjamin Otte
a44ac75e65 gtk: Don't include gtkstylecontext.h from gtkcsstypesprivate.h
And make sure it's included everywhere it's needed.
2019-03-19 08:53:25 +01:00
Benjamin Otte
46cb221220 Remove support for -gtk-key-bindings: css property
This is no longer used.
2019-02-21 21:49:09 +01:00
Timm Bäder
0ae7c30105 Add & use GTK_CSS_AFFECTS_TRANSFORM
This avoids invalidating the size of all widgets when updating CSS
transforms.

In theory, we don't even have to allocate the widget itself, because we
didn't change its size. But we have no way to track that.
2019-02-21 19:47:28 +01:00
Timm Bäder
e2b9f3258e css: Add transform style property 2019-02-21 19:47:28 +01:00
Timm Bäder
3f126c7fc8 Remove GTK_CSS_AFFECTS_CLIP
Clips don't exist anymore and this flag is unused outside of the style
property definitions in gtkcssstylepropertyimpl.c
2018-07-17 17:33:47 +02:00
Benjamin Otte
0afdd84a2a css: Clipping changes don't need a queue_allocate() anymore
Now that queue_draw() isn't restricted to clip anymore, we don't need to
care about clip in the CSS engine either.

We do keep GTK_CSS_AFFECTS_CLIP around though because GtkWindow does
care for the window's size.
2018-04-09 20:20:55 +02:00
Matthias Clasen
fb51e438e9 Implement font-variation-settings
This is a CSS font level 4 property that lets us
use font variation settings from css.
2018-01-03 13:07:55 -05:00
Matthias Clasen
22f9562928 Implement font-feature-settings
This is a missing part of the CSS font level 3 module.
2017-12-20 10:31:30 -05:00
Matthias Clasen
6042b82964 Update the docs for GtkCssChange
The docs were out of sync with the flags we actually have.
2017-12-20 08:46:03 -05:00
Benjamin Otte
129dc7d73b css: Add -gtk-icon-size
This will replace GtkIconSize in future patches.
2017-11-15 14:22:16 -05:00
Benjamin Otte
83fb7a649f css: Merge GtkStyleProviderPrivate into GtkStyleProvider
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.
2017-10-31 04:33:54 +01:00
Timm Bäder
4e24cb8588 css: Add GTK_CSS_AFFECTS_ICON_SIZE
And use it in GtkIconHelper. This way, we can avoid resizes when e.g.
the fg color of a symbolic icon changes.
2017-10-14 17:27:55 +02:00
Timm Bäder
9bc7581f1c css: Replace _AFFECTS_TEXT with _TEXT_SIZE and _TEXT_CLIP
It was used to mark css properties that affect widgets with text, but it
caused unnecessary invalidations. E.g. 'color' was marked as
AFFECTS_TEXT but changing just the color of a label should not
automatically queue a resize, which is what the code in
gtk_widget_real_style_updated does.

Replace this flag with GTK_CSS_AFFECTS_TEXT_SIZE and
GTK_CSS_AFFECTS_TEXT_CLIP, which GtkWidget can use only if the widget
actually has text.
2017-10-12 15:42:03 +02:00
Timm Bäder
30096de341 csstypesprivate: Remove AFFECTS_PANGO_LAYOUT mention
Doesn't even exist!
2017-10-12 15:42:03 +02:00
Matthias Clasen
6859f0a6d1 css: Use enums instead of idents for font-variant properties
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.
2017-09-18 23:22:38 -04:00
Matthias Clasen
f87dc24867 Fix a typo
The property is called font-variant-alternates, not -alternatives.
Correct this everywhere.
2017-09-18 18:10:08 -04:00
Matthias Clasen
92398bb1bb css: implement font-variant as a shorthand
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.
2017-09-18 14:27:06 -04:00
Matthias Clasen
b91f3ce331 css: Implement font-variant-east-asian
This is translated to the corresponding OpenType features.
2017-09-18 14:26:57 -04:00
Matthias Clasen
8a7f2ca0be css: Implement font-variant-alternatives
This is only a partial implementation, since we don't support
@font-feature-values. The only supported value is historical-forms,
for now.
2017-09-18 14:26:57 -04:00
Matthias Clasen
b99cb70299 css: Implement font-variant-numeric
This gets translated to the corresponding OpenType features.
2017-09-18 14:26:57 -04:00
Matthias Clasen
8525afc408 css: Implement font-variant-caps
This gets translated to the corresponding OpenType features.
2017-09-18 14:26:57 -04:00
Matthias Clasen
01ed84fbef css: Implement font-variant-position
This gets translated to the corresponding OpenType features.
2017-09-18 14:26:57 -04:00
Matthias Clasen
c4cbe5feca css: Implement font-variant-ligatures
This gets translated into corresponding OpenType features.
2017-09-18 14:26:57 -04:00
Matthias Clasen
cee4622567 css: Implement font-kerning
This gets translated to the OpenType feature kern.
2017-09-18 14:26:57 -04:00
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
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
071c9a8221 API: gdk: Add gdk_rgba_is_clear() and gdk_rgba_is_opaque()
I want to use these inside GSK, and I'm not a fan of putting GdkRGBA
APIs into it or duplicating it into GTK.

So public API it is.
2016-12-20 18:01:12 +01:00
Benjamin Otte
3e26fadb24 css: Replace custom blend modes with GskBlendMode 2016-12-20 18:01:11 +01:00
Benjamin Otte
6d012fb4ea gtk: Get rid of GtkCssCorner
We have GskCorner now which is identical.
2016-12-20 18:01:10 +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
Benjamin Otte
bcf70e3a03 API: Remove everything relating to "grip"
Grips have long been unused in GTK, so remove all support for them.
This removes the GTK_STYLE_CLASS_GRIP and the special
gtk_render_handle() code for drawing those grips.
2016-11-16 19:27:43 +01: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