Commit Graph

24 Commits

Author SHA1 Message Date
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Timm Bäder
0b2a6e34c4 cssimage: Add is_computed vfunc
Same semantics as the is_computed field of GtkCssValue
2020-01-18 08:49:51 +01:00
Timm Bäder
fc2d05ee38 cssimageradial: Use array + length instead of GArray
This makes sense since we're not going to change the (amount of) colors
after parsing.
2020-01-18 08:49:51 +01:00
Timm Bäder
67991ed0f4 Remove GtkCssRgbaValue
The differenciation between a literal color value and an RGBA value
caused problems in various situations. Just treat the two the same but
don't allow access to the rgba value of a non-literal color value.

This gets rid of around 1.6k rgba values in the widget-factory.
2020-01-18 08:49:51 +01:00
Timm Bäder
6837e80d14 css: Avoid more type checks in hot paths 2019-09-09 17:36:23 +02:00
Benjamin Otte
1cd9396154 css: Review error messages
... and move them from _gtk_css_parser_error() to the proper new error
message.
2019-04-12 19:34:28 +02:00
Benjamin Otte
1fd339c46f cssimageradial: Use gtk_css_parser_consume_function() 2019-04-12 19:34:28 +02:00
Benjamin Otte
76fb80f46c cssparser: Introduce gtk_css_parser_try_ident()
... and gtk_css_parser_has_function().
2019-04-12 19:34:28 +02:00
Benjamin Otte
73b4a62f51 snapshot: Redo debug messages
Instead of every snapshot function having debug messages, have an
explicit gtk_snapshot_push_debug() function that appends a debug node.
2018-04-24 04:06:58 +02:00
Benjamin Otte
95ddb57562 cssimage: Get rid of draw vfunc
All remaining users of that vfunc now implement snapshot using cairo
render nodes (win32 and radial).

Also, GtkCssImageClass.snapshot is now NULL, so if a subclass doesn't
implement it, it will now crash.
Previously it would try to call the draw vfunc.
2018-02-17 08: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
Matthias Clasen
d3727817ff Drop support for one-stop gradients
These have been deprecated for a while. Time to make this an
error for GTK+ 4.
2017-09-17 16:53:02 -04:00
Benjamin Otte
1b553478f6 cssimageradial: Handle "partial" gradients correctly
When the first/last color stop is not at 0%/100%, we need to start the
repeating at their offsets and not at 0%/100%.

Attached reftest demonstrates the problem.
2016-12-20 18:01:12 +01:00
Matthias Clasen
2a5a94b260 css: Improve spec compliance of the radial gradient parser
The spec says:
"If <shape> is omitted, the ending shape defaults to a circle if the <size>
is a single <length>, and to an ellipse otherwise."

Make it so.
2016-11-07 15:40:21 -05:00
Matthias Clasen
aceba7484f css: Avoid a crash while parsing radial gradients
has_size does not imply that sizes[0] is != NULL.
2016-11-07 14:46:15 -05:00
Benjamin Otte
6dddf0447e css: Fix radial-gradient() color stop computation
The copy/paste from the linear gradient code had an error.
2016-11-02 15:19:49 +01:00
Benjamin Otte
519af3f91d cssimage: Warn if gradients only have 1 color stop
GTK <= 3.20 allowed that but the CSS spec and borwsers do not.
We might want to just remove that feature, but for now, we just warn.
2016-04-18 20:52:35 +02:00
Benjamin Otte
a52ecd2be6 css: Add gtk_css_number_value_can_parse()
Use it instead of _gtk_css_parser_has_number().

We need that once we introduce calc() support.
2016-02-13 04:49:08 +01:00
Benjamin Otte
e2d966eda5 cssnumbervalue: Remove gtk_css_number_value_get_unit()
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.
2016-02-13 04:49:07 +01:00
Benjamin Otte
0645425046 cssimageradial: Don't print 2 spaces 2016-02-13 04:49:07 +01:00
Benjamin Otte
0c12601208 cssimageradial: Only allow at "<position>" after other props
Don't allow syntax like
  at top left circle
but follow the spec about requiring the at <position> right before the
comma.

This is porbably because
  circle at 10px 10px
could be interpreted as
  circle 10px at 10px
with the now disallowed syntax, too.

Test included.
2016-02-05 19:31:47 +01:00
Benjamin Otte
982da040b2 cssimageradial: Only emit one error for wrong position
Test included.
2016-02-05 19:31:47 +01:00
Matthias Clasen
9e63e61b16 Implement transitions for radial gradients
This was missing in the initial implementation.
2016-01-07 16:30:19 -05:00
Matthias Clasen
f727ee5687 Implement CSS radial gradients
Implement parsing and drawing of radial gradients according to
http://www.w3.org/TR/css3-images/#radial-gradients.

Transitions are not implemented yet.
2016-01-04 13:59:24 -05:00