Commit Graph

43 Commits

Author SHA1 Message Date
Matthias Clasen
d923402934 css: Add line-height property
This adds the plumbing to parse the line-height
property from CSS. Widgets are not picking it
up yet.
2021-08-22 15:15:50 -04:00
Matthias Clasen
344f9fcf05 css: Implement transform-origin
Implement most of transform-origin. We only
handle the xy components currently, which lets
us reuse the position value implementation that
is used for background-position.
2021-01-24 22:49:08 -05:00
Timm Bäder
1b10020b6e css: Make GtkStyleAnimation and subclasses non-objects
Making them GObjects is unnecessary. This enables further optimizations
down the road. The only place we use them in is gtkcssanimatedstyle.c
after all.
2020-05-10 08:44:20 +02:00
Timm Bäder
06460ea50c css: Drop a few dynamic type checks
We hit these code paths a lot
2020-05-10 08:44:20 +02:00
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
Matthias Clasen
5e95e15a03 animatedstyle: Fix the debug build
This wasn't caught by our ci.
2020-01-29 14:10:24 +01:00
Matthias Clasen
10e4c04e61 Use style values directly
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.
2020-01-29 11:07:32 +01:00
Matthias Clasen
5776d0dd99 css: Split styles into groups
Introduce refcounted structs for groups of related css properties,
and use them to store the style values. Both GtkCssStaticStyle and
GtkCssAnimatedStyle fill in the structs in GtkCssStyle, and we
can avoid vfuncs for value access, which should be much faster.
We can even start accessing style->core->color directly.
2020-01-29 11:07:32 +01: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
b2b89f6c57 css: Add gtk_css_style_get_static_style
This lets us avoid poking directly at the GtkCssAnimatedStyle
struct in gtkcssnode.c.
2020-01-16 12:02:44 -05:00
Timm Bäder
ceb8aedf97 cssanimatedstyle: Keep transition_info_add from recursing
The slowest part of that fuction is the type check for
GtkCssShorthandProperty. Subproperties of shorthand properties never
refer to more shorthand properties however, so we don't want to have the
type check for those.
2019-09-09 17:36:24 +02:00
Timm Bäder
75a48aed0b cssanimatedstyle: Make set_animated_value transfer-full 2019-09-09 17:36:24 +02:00
Timm Bäder
4b4b77ca04 cssanimatedstyle: Save animation in array 2019-09-09 17:36:23 +02:00
Timm Bäder
a231648607 cssanimatedstyle: Avoid type check in loop
We can just do the check once as source is not going to change within
the loop.
2019-09-09 17:36:23 +02:00
Timm Bäder
eeb5cd2321 cssanimatedstyle: Avoid unnecessary transition work
No need to do all the transition work if the transition duration will be
0 for all of them.
2019-09-09 17:36:23 +02:00
Timm Bäder
36a1b69a19 cssanimatedstyle: Remove some casts in hot paths
gtk_css_animated_style_create_css_transitions down from 16% to 11%
when repeatedly clicking on a spinbutton button in the widget factory.
2019-09-09 17:36:23 +02:00
Benjamin Otte
04d24b7cd2 csssection: Make printing functions public 2019-04-12 19:34:28 +02:00
Timm Bäder
df1f036a95 cssanimatedstyle: Avoid some type checks and unnecessary work 2019-01-29 05:03:26 +01:00
Benjamin Otte
a721d8b78f css: Implement support for dynamic values
This adds a new GtkStyleAnimation called GtkCssDynamic (for lack of a
better name) that is spawned whenever at least one dynamic value is part
of the GtkCssStyle.
2018-03-16 06:04:43 +01: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
Alexander Larsson
882290b479 Skip dynamic type check in css value getters
This gets called a lot during snapshotting, and this change
alone brings down snapshot time by almost 10% in a syntethic
snapshot test.
2017-01-11 09:20:30 +01:00
Matthias Clasen
d9bc675cba Refactor some css transition code slightly
Reshuffling things a bit to avoid a bunch of NULL and
type checks.
2017-01-10 19:55:57 -05:00
Matt Watson
a970ba5ef6 animatedstyle: don't share styleanimations
Because of our port of css animation and css transition to
progress tracker, we should not think of animated styles as
immutable objects that can map any timestamp to css values.
Rather, timestamps can correspond to different values depending
on the value of GTK_SLOWDOWN over the course of the animation.

To keep animated styles and style animations totally immutable,
we will not share styleanimations between animatedstyles, and
make a new copy of a styleanimation for each timestamp.
2016-04-08 16:09:30 -07:00
Matt Watson
7b68bdb831 animatedstyle: just ref current style if timestamp the same 2016-04-08 16:09:30 -07:00
Matt Watson
6a88ac3b4c animatedstyle: fail to create new style if timestamp goes backwards
With slowdown factor, we will only we be able to handle timestamps
that monotonically increase.
2016-04-08 16:09:30 -07:00
Matt Watson
2800b00e1d cssanimation: port to progress tracker 2016-04-08 16:09:30 -07:00
Matt Watson
50e057e025 csstransition: port to progress tracker 2016-04-08 16:09:30 -07:00
Benjamin Otte
a3ba7f0a20 css: Don't start transitions when the value didn't change
This stops us from starting a lot of useless transitions. And it's even
conformant with the CSS spec!
2016-02-18 23:57:39 +01:00
Benjamin Otte
759d8dafd9 cssstyle: Add gtk_css_style_is_static()
Gets rid of the need to do

  if (ANIMATED_STYLE() &&
      animated_style_is_static(ANIMATED_STYLE(style))
2015-03-18 15:23:33 +01:00
Benjamin Otte
fbe796f293 cssstyle: Handle 0 timestamp to mean "don't animate" 2015-03-18 15:23:32 +01:00
Benjamin Otte
1116914ea0 css: Move scale to GtkStyleProviderPrivate
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.
2015-02-06 11:26:31 +01:00
Benjamin Otte
9645daf48f cssstyle: Move function from vfunc to static func
compute_dependencies() is only used internally by GtkCssStaticStyle,
so there's no need to have it elsewhere.
2015-01-07 14:26:47 +01:00
Benjamin Otte
b7be202089 stylecontext: Refactor update_properties()
It now always returns a new instance.
2015-01-07 14:26:47 +01:00
Benjamin Otte
7493e814a9 cssanimatedstyle: Apply animation values after creation
This makes GtkCssAnimatedStyle immutable.
2015-01-07 14:26:47 +01:00
Benjamin Otte
a3bf910585 cssanimatedstyle: Make advancing the style return a new style
This is another step towards making CssStyles immutable.
2015-01-07 14:26:47 +01:00
Benjamin Otte
f3f021106d cssanimatedstyle: Avoid creating animation
... when no animation exists.

This makes the function name kinda wrong, but I'm not sure what else to
call it.
2015-01-07 14:26:47 +01:00
Benjamin Otte
682abc345f cssanimatedstyle: Remove unused function 2015-01-07 14:26:47 +01:00
Benjamin Otte
980923c761 cssanimatedstyle: Merge two functions 2015-01-07 14:26:47 +01:00
Benjamin Otte
79f7392109 stylecontext: Make static styles static
Instead of keeping an animated style everywhere, we replace it with the
static style when nothing gets animated.

Apart from making the code cleaner, this gets rid of a bunch of animated
style values that do nothing but wrap a static style.
2015-01-07 14:26:47 +01:00
Benjamin Otte
270e73bfcc stylecontext: Always pass the static style
... to build_properties.
There is always one available, so we can insist on that one.

This simplifies a bunch of code.
2015-01-07 14:26:47 +01:00
Benjamin Otte
ac215ffc8f cssstyle: Add GtkCssStaticStyle
For now, this is only an implementation detail of the animated style.

The idea is to use GtkCssStaticStyle as the result of CSS queries and
then put a GtkCssAnimatedStyle on top that manages the animations. The
neat thing about this is that you can cache the static values.
2015-01-07 14:26:47 +01:00
Benjamin Otte
4168e0385e cssstyle: Split into GtkCssStyle and GtkCssAnimatedStyle
GtkCssStyle is the base class to be used for all types of styles that do
exist.

GtkCssAnimatedStyle is the only implementation so far, that is exactly a
copy/paste of the old GtkCssStyle code.
2015-01-07 14:26:46 +01:00