Compare commits
133 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7778430a31 | |||
| accabe3eee | |||
| d4c25c9ec0 | |||
| b69df2bc4d | |||
| 01d86eab66 | |||
| 09e85aa809 | |||
| d49816d2e6 | |||
| 59a00d6768 | |||
| be2ff60787 | |||
| ecbe6a421e | |||
| 9b42377347 | |||
| 7372a845fb | |||
| d4899fdf1f | |||
| 4142c4d79e | |||
| ca442f8641 | |||
| 3c1491423a | |||
| eb4993d3fb | |||
| aa057da1ca | |||
| 1de09d59fb | |||
| 130a6fe0cf | |||
| e1f7c027d7 | |||
| 396ef5ebe5 | |||
| 840a20db3b | |||
| 8c6f7d1ae9 | |||
| c69fa6221b | |||
| 3c92c81705 | |||
| 297de981c4 | |||
| 53beb054b6 | |||
| 0431492284 | |||
| aed9cc1874 | |||
| c15804d124 | |||
| 1bd208d937 | |||
| b70bcd6bfe | |||
| 74a1d45238 | |||
| 3ada35460d | |||
| 1f133c3d64 | |||
| 4440ce874e | |||
| db302df82a | |||
| b550b58e8f | |||
| ed889b951b | |||
| b603479fe2 | |||
| 7c39b2cea3 | |||
| b1bce7a62b | |||
| fa73e17fba | |||
| dee2150a04 | |||
| f647fc3fe2 | |||
| 6bae80c331 | |||
| 2aeb80f490 | |||
| 8a2f434443 | |||
| d4134430fc | |||
| 73f64971c8 | |||
| ecc2c953e5 | |||
| e353117937 | |||
| 492ae6df35 | |||
| a19d0471e9 | |||
| 5b5ba36999 | |||
| 89b64cbf47 | |||
| e65d1f2122 | |||
| 2756496d47 | |||
| 8b653f21cc | |||
| 4e6759a126 | |||
| d20e0b0370 | |||
| ed8255993f | |||
| f5d69fa0c5 | |||
| e1431f31c1 | |||
| f191fc0047 | |||
| b60c60f03b | |||
| af0c277bba | |||
| 88203fbf4d | |||
| 970c9eef63 | |||
| 2439876bd3 | |||
| 97582ae9ad | |||
| a5b85f0dc5 | |||
| aefb16510b | |||
| 4360d433b5 | |||
| 5927319589 | |||
| 25db645f65 | |||
| b3c6a98132 | |||
| 031109aec3 | |||
| 18d2f9c8a4 | |||
| 0ae721f144 | |||
| 7898d1b46d | |||
| 3648398f6d | |||
| 019916c5b9 | |||
| ebb31590ae | |||
| 32ea1cf32d | |||
| 172cdf8e21 | |||
| dc07bcf3a3 | |||
| bd96c10563 | |||
| 76299396cf | |||
| a96dd2ad0a | |||
| 1e210e83bb | |||
| 14f1a91bff | |||
| 3f2bcdf82e | |||
| c61d8bc188 | |||
| 4e5976427b | |||
| 7fcdb0205f | |||
| 4814c5f653 | |||
| eb24e3548f | |||
| 87f0f374a9 | |||
| 0cd95951e6 | |||
| c45815c217 | |||
| b914869715 | |||
| ff5699e097 | |||
| 8846f85874 | |||
| fc1c6cfb1a | |||
| 77028362ab | |||
| 496aee5b02 | |||
| b2fb624496 | |||
| f2ef5d85ea | |||
| 7eca32edf0 | |||
| 7775bcf2fb | |||
| ed35f6f8b8 | |||
| 307942e1f7 | |||
| 92b7231168 | |||
| 14d7eb97d2 | |||
| fed1c3d3fc | |||
| e1ac97a185 | |||
| 08a48dd97e | |||
| 50df3ebb46 | |||
| df77f22740 | |||
| 2437a551ec | |||
| 46ab71fc8a | |||
| f922ff8597 | |||
| 690c06109e | |||
| 94505987fe | |||
| c6d7b704cb | |||
| 349509c332 | |||
| 84fd420271 | |||
| 0c40defaf1 | |||
| d665274eb1 | |||
| 81b6251073 | |||
| bcf78aeb39 |
@@ -1,11 +1,20 @@
|
||||
Overview of Changes in 4.15.1, xx-xx-xxxx
|
||||
Overview of Changes in 4.15.2, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
Overview of Changes in 4.15.1, 21-05-2024
|
||||
=========================================
|
||||
|
||||
* GtkGraphicsOffload:
|
||||
- Don't crash without a child
|
||||
|
||||
* GtkSpinner:
|
||||
- Don't animate when unmapped
|
||||
|
||||
* CSS:
|
||||
- Support the :root selector
|
||||
- Support variables and custom properties (https://www.w3.org/TR/css-variables-1/)
|
||||
- Implement math functions (https://www.w3.org/TR/css-values-4/)
|
||||
- Support modern syntax and calc in rgb() and hsl()
|
||||
|
||||
* Icontheme:
|
||||
- Make symbolic svg loading more efficient
|
||||
@@ -14,19 +23,22 @@ Overview of Changes in 4.15.1, xx-xx-xxxx
|
||||
* Accessibility:
|
||||
- Make the gtk-demo sidebar search more accessible
|
||||
- Stop emitting focus events
|
||||
- Realize child contexts when necessary
|
||||
|
||||
* GDK:
|
||||
- Support XDG_ACTIVATION_TOKEN
|
||||
- dmabuf: Be more defensive when importing unknown formats to GL
|
||||
- dmabuf: Use narrow range for YUV
|
||||
- vulkan: Recreate swapchains when necessary or beneficial
|
||||
|
||||
* GSK:
|
||||
- Improve logging for GDK_DEBUG=offload
|
||||
- Improve logging for GSK_DEBUG=renderer
|
||||
- gpu: Warn about inefficient texture import
|
||||
- gpu: Handle tiny offscreens correctly
|
||||
- gpu: Handle tiny offscreens correctly
|
||||
- vulkan: Add profiler marks in various places
|
||||
- vulkan: Fix a problem with imported dmabufs showing up black
|
||||
- cairo: Speed up mask nodes, since we use them for symbolic icons
|
||||
|
||||
* Wayland:
|
||||
- Use wl_compositor version 6
|
||||
@@ -39,13 +51,22 @@ Overview of Changes in 4.15.1, xx-xx-xxxx
|
||||
|
||||
* Debugging:
|
||||
- Show more texture details in the recorder
|
||||
- Use GTK_DEBUG=css to see CSS deprecations
|
||||
|
||||
* macOS:
|
||||
- Fix problems with events handed back to the OS
|
||||
- Respect GDK_DEBUG=default-settings
|
||||
- Allow applictions to handle Dock > Quit
|
||||
|
||||
* Deprecations:
|
||||
- Use of @name colors in CSS
|
||||
|
||||
* Translation updates:
|
||||
Catalan
|
||||
Georgian
|
||||
Hungarian
|
||||
Korean
|
||||
Portuguese
|
||||
Turkish
|
||||
|
||||
|
||||
|
||||
@@ -15,16 +15,16 @@ spec.
|
||||
The following units are supported for basic datatypes:
|
||||
|
||||
Length
|
||||
: px, pt, em, ex, rem, pc, in, cm, mm, calc()
|
||||
: px, pt, em, ex, rem, pc, in, cm, mm
|
||||
|
||||
Percentage
|
||||
: %, calc()
|
||||
: %
|
||||
|
||||
Angle
|
||||
: deg, grad, turn, calc()
|
||||
: deg, rad, grad, turn
|
||||
|
||||
Time
|
||||
: s, ms, calc()
|
||||
: s, ms
|
||||
|
||||
Length values with the em or ex units are resolved using the font
|
||||
size value, unless they occur in setting the font-size itself, in
|
||||
@@ -33,11 +33,15 @@ which case they are resolved using the inherited font size value.
|
||||
The rem unit is resolved using the initial font size value, which is
|
||||
not quite the same as the CSS definition of rem.
|
||||
|
||||
The calc() notation adds considerable expressive power. There are limits
|
||||
on what types can be combined in such an expression (e.g. it does not make
|
||||
sense to add a number and a time). For the full details, see the
|
||||
[CSS3 Values and Units](https://www.w3.org/TR/css3-values/#calc-notation)
|
||||
spec.
|
||||
Length values using physical units (pt, pc, in, cm, mm) are translated
|
||||
to px using the dpi value specified by the -gtk-dpi property, which is
|
||||
different from the CSS definition, which uses a fixed dpi of 96.
|
||||
|
||||
The calc() notation adds considerable expressive power to all of these
|
||||
datatypes. There are limits on what types can be combined in such an
|
||||
expression (e.g. it does not make sense to add a number and a time).
|
||||
For the full details, see the
|
||||
[CSS Values and Units](https://www.w3.org/TR/css-values-4/) spec.
|
||||
|
||||
A common pattern among shorthand properties (called 'four sides') is one
|
||||
where one to four values can be specified, to determine a value for each
|
||||
@@ -82,36 +86,53 @@ color: var(--prop, green);
|
||||
|
||||
## Colors
|
||||
|
||||
### CSS Colors
|
||||
|
||||
Colors can be expressed in numerous ways in CSS (see the
|
||||
[Color Module](https://www.w3.org/TR/css-color-5/). GTK supports
|
||||
many (but not all) of these.
|
||||
|
||||
You can use rgb(), rgba(), hsl() with both the legacy or the modern CSS
|
||||
syntax, and calc() can be used as well in color expressions.
|
||||
|
||||
### Non-CSS Colors
|
||||
|
||||
GTK extends the CSS syntax with several additional ways to specify colors.
|
||||
|
||||
These extensions are deprecated and should be replaced by the equivalent
|
||||
standard CSS notions.
|
||||
|
||||
The first is a reference to a color defined via a @define-color rule in CSS.
|
||||
The syntax for @define-color rules is as follows:
|
||||
|
||||
```
|
||||
@define-color Name Color
|
||||
@define-color name color
|
||||
```
|
||||
|
||||
To refer to the color defined by a @define-color rule, prefix the name with @.
|
||||
|
||||
The standard CSS mechanisms that should be used instead of @define-color are
|
||||
custom properties, :root and var().
|
||||
|
||||
GTK also supports color expressions, which allow colors to be transformed to
|
||||
new ones. Color expressions can be nested, providing a rich language to
|
||||
define colors. Color expressions resemble functions, taking 1 or more colors
|
||||
and in some cases a number as arguments.
|
||||
|
||||
`lighter(Color)`
|
||||
: produces a brighter variant of Color
|
||||
`lighter(color)`
|
||||
: produces a brighter variant of `color`.
|
||||
|
||||
`darker(Color)`
|
||||
: produces a darker variant of Color
|
||||
`darker(color)`
|
||||
: produces a darker variant of `color`.
|
||||
|
||||
`shade(Color, Number)`
|
||||
: changes the lightness of Color. The number ranges from 0 for black to 2 for white.
|
||||
`shade(color, number)`
|
||||
: changes the lightness of `color`. The `number` ranges from 0 for black to 2 for white.
|
||||
|
||||
`alpha(Color, Number)`
|
||||
: replaces the alpha value of color with number (between 0 and 1)
|
||||
`alpha(color, number)`
|
||||
: multiplies the alpha value of `color` by `number` (between 0 and 1).
|
||||
|
||||
`mix(Color1, Color2, Number)`
|
||||
: interpolates between the two colors
|
||||
`mix(color1, color2, number)`
|
||||
: interpolates between the two colors.
|
||||
|
||||
## Images
|
||||
|
||||
@@ -119,7 +140,7 @@ GTK extends the CSS syntax for images and also uses it for specifying icons.
|
||||
To load a themed icon, use
|
||||
|
||||
```
|
||||
-gtk-icontheme(Name)
|
||||
-gtk-icontheme(name)
|
||||
```
|
||||
|
||||
The specified icon name is used to look up a themed icon, while taking into
|
||||
@@ -148,14 +169,14 @@ and the
|
||||
syntax makes this available. -gtk-recolor requires a url as first argument.
|
||||
The remaining arguments specify the color palette to use. If the palette is
|
||||
not explicitly specified, the current value of the -gtk-icon-palette property
|
||||
is used.
|
||||
is used.
|
||||
|
||||
GTK supports scaled rendering on hi-resolution displays. This works best if
|
||||
images can specify normal and hi-resolution variants. From CSS, this can be
|
||||
done with
|
||||
|
||||
```
|
||||
-gtk-scaled(Image1, Image2)
|
||||
-gtk-scaled(image1, image2)
|
||||
```
|
||||
|
||||
## GTK CSS Properties
|
||||
|
||||
+16
-8
@@ -41,8 +41,10 @@ G_BEGIN_DECLS
|
||||
|
||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||
#define GDK_ARRAY_REAL_SIZE(_size) ((_size) + 1)
|
||||
#define GDK_ARRAY_MAX_SIZE (G_MAXSIZE / sizeof (_T_) - 1)
|
||||
#else
|
||||
#define GDK_ARRAY_REAL_SIZE(_size) (_size)
|
||||
#define GDK_ARRAY_MAX_SIZE (G_MAXSIZE / sizeof (_T_))
|
||||
#endif
|
||||
|
||||
/* make this readable */
|
||||
@@ -177,18 +179,23 @@ G_GNUC_UNUSED static inline void
|
||||
gdk_array(reserve) (GdkArray *self,
|
||||
gsize n)
|
||||
{
|
||||
gsize new_size, size;
|
||||
gsize new_capacity, size, capacity;
|
||||
|
||||
if (n <= gdk_array(get_capacity) (self))
|
||||
return;
|
||||
if (G_UNLIKELY (n > GDK_ARRAY_MAX_SIZE))
|
||||
g_error ("requesting array size of %zu, but maximum size is %zu", n, GDK_ARRAY_MAX_SIZE);
|
||||
|
||||
capacity = gdk_array(get_capacity) (self);
|
||||
if (n <= capacity)
|
||||
return;
|
||||
|
||||
size = gdk_array(get_size) (self);
|
||||
new_size = ((gsize) 1) << g_bit_storage (MAX (GDK_ARRAY_REAL_SIZE (n), 16) - 1);
|
||||
/* capacity * 2 can overflow, that's why we MAX() */
|
||||
new_capacity = MAX (GDK_ARRAY_REAL_SIZE (n), capacity * 2);
|
||||
|
||||
#ifdef GDK_ARRAY_PREALLOC
|
||||
if (self->start == self->preallocated)
|
||||
{
|
||||
self->start = g_new (_T_, new_size);
|
||||
self->start = g_new (_T_, new_capacity);
|
||||
memcpy (self->start, self->preallocated, sizeof (_T_) * GDK_ARRAY_REAL_SIZE (size));
|
||||
}
|
||||
else
|
||||
@@ -196,15 +203,15 @@ gdk_array(reserve) (GdkArray *self,
|
||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||
if (self->start == NULL)
|
||||
{
|
||||
self->start = g_new (_T_, new_size);
|
||||
self->start = g_new (_T_, new_capacity);
|
||||
*self->start = *(_T_[1]) { 0 };
|
||||
}
|
||||
else
|
||||
#endif
|
||||
self->start = g_renew (_T_, self->start, new_size);
|
||||
self->start = g_renew (_T_, self->start, new_capacity);
|
||||
|
||||
self->end = self->start + size;
|
||||
self->end_allocation = self->start + new_size;
|
||||
self->end_allocation = self->start + new_capacity;
|
||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||
self->end_allocation--;
|
||||
#endif
|
||||
@@ -312,6 +319,7 @@ gdk_array(get) (const GdkArray *self,
|
||||
#undef gdk_array_paste
|
||||
#undef gdk_array
|
||||
#undef GDK_ARRAY_REAL_SIZE
|
||||
#undef GDK_ARRAY_MAX_SIZE
|
||||
|
||||
#undef GDK_ARRAY_BY_VALUE
|
||||
#undef GDK_ARRAY_ELEMENT_TYPE
|
||||
|
||||
@@ -522,8 +522,6 @@ gdk_clipboard_get_content (GdkClipboard *clipboard)
|
||||
*
|
||||
* If the clipboard is not local, this function does nothing but report success.
|
||||
*
|
||||
* The @callback must call [method@Gdk.Clipboard.store_finish].
|
||||
*
|
||||
* The purpose of this call is to preserve clipboard contents beyond the
|
||||
* lifetime of an application, so this function is typically called on
|
||||
* exit. Depending on the platform, the functionality may not be available
|
||||
@@ -638,9 +636,6 @@ gdk_clipboard_read_internal (GdkClipboard *clipboard,
|
||||
* Asynchronously requests an input stream to read the @clipboard's
|
||||
* contents from.
|
||||
*
|
||||
* When the operation is finished @callback will be called. You must then
|
||||
* call [method@Gdk.Clipboard.read_finish] to get the result of the operation.
|
||||
*
|
||||
* The clipboard will choose the most suitable mime type from the given list
|
||||
* to fulfill the request, preferring the ones listed first.
|
||||
*/
|
||||
@@ -834,9 +829,6 @@ gdk_clipboard_read_value_internal (GdkClipboard *clipboard,
|
||||
* Asynchronously request the @clipboard contents converted to the given
|
||||
* @type.
|
||||
*
|
||||
* When the operation is finished @callback will be called. You must then call
|
||||
* [method@Gdk.Clipboard.read_value_finish] to get the resulting `GValue`.
|
||||
*
|
||||
* For local clipboard contents that are available in the given `GType`,
|
||||
* the value will be copied directly. Otherwise, GDK will try to use
|
||||
* [func@content_deserialize_async] to convert the clipboard's data.
|
||||
@@ -895,9 +887,6 @@ gdk_clipboard_read_value_finish (GdkClipboard *clipboard,
|
||||
*
|
||||
* Asynchronously request the @clipboard contents converted to a `GdkPixbuf`.
|
||||
*
|
||||
* When the operation is finished @callback will be called. You must then
|
||||
* call [method@Gdk.Clipboard.read_texture_finish] to get the result.
|
||||
*
|
||||
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
|
||||
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
||||
* need more control over the operation.
|
||||
@@ -960,9 +949,6 @@ gdk_clipboard_read_texture_finish (GdkClipboard *clipboard,
|
||||
*
|
||||
* Asynchronously request the @clipboard contents converted to a string.
|
||||
*
|
||||
* When the operation is finished @callback will be called. You must then
|
||||
* call [method@Gdk.Clipboard.read_text_finish] to get the result.
|
||||
*
|
||||
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
|
||||
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
||||
* need more control over the operation.
|
||||
|
||||
@@ -540,9 +540,6 @@ deserialize_not_found (GdkContentDeserializer *deserializer)
|
||||
*
|
||||
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
||||
* indicate a higher priority.
|
||||
*
|
||||
* When the operation is finished, @callback will be called. You must then
|
||||
* call [func@Gdk.content_deserialize_finish] to get the result of the operation.
|
||||
*/
|
||||
void
|
||||
gdk_content_deserialize_async (GInputStream *stream,
|
||||
|
||||
@@ -279,10 +279,6 @@ gdk_content_provider_content_changed (GdkContentProvider *provider)
|
||||
* Asynchronously writes the contents of @provider to @stream in the given
|
||||
* @mime_type.
|
||||
*
|
||||
* When the operation is finished @callback will be called. You must then call
|
||||
* [method@Gdk.ContentProvider.write_mime_type_finish] to get the result
|
||||
* of the operation.
|
||||
*
|
||||
* The given mime type does not need to be listed in the formats returned by
|
||||
* [method@Gdk.ContentProvider.ref_formats]. However, if the given `GType` is
|
||||
* not supported, `G_IO_ERROR_NOT_SUPPORTED` will be reported.
|
||||
|
||||
@@ -546,9 +546,6 @@ serialize_not_found (GdkContentSerializer *serializer)
|
||||
*
|
||||
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
||||
* indicate a higher priority.
|
||||
*
|
||||
* When the operation is finished, @callback will be called. You must then
|
||||
* call [func@Gdk.content_serialize_finish] to get the result of the operation.
|
||||
*/
|
||||
void
|
||||
gdk_content_serialize_async (GOutputStream *stream,
|
||||
|
||||
+2
-6
@@ -134,7 +134,7 @@ gdk_drop_read_local_async (GdkDrop *self,
|
||||
|
||||
g_object_get (priv->drag, "content", &content, NULL);
|
||||
content_formats = gdk_content_provider_ref_formats (content);
|
||||
g_object_unref (content);
|
||||
g_object_unref (content);
|
||||
content_formats = gdk_content_formats_union_serialize_mime_types (content_formats);
|
||||
mime_type = gdk_content_formats_match_mime_type (content_formats, formats);
|
||||
|
||||
@@ -784,7 +784,7 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
||||
GdkContentFormats *formats;
|
||||
GValue *value;
|
||||
GTask *task;
|
||||
|
||||
|
||||
g_return_if_fail (priv->state != GDK_DROP_STATE_FINISHED);
|
||||
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
@@ -849,10 +849,6 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
||||
* Asynchronously request the drag operation's contents converted
|
||||
* to the given @type.
|
||||
*
|
||||
* When the operation is finished @callback will be called. You must
|
||||
* then call [method@Gdk.Drop.read_value_finish] to get the resulting
|
||||
* `GValue`.
|
||||
*
|
||||
* For local drag-and-drop operations that are available in the given
|
||||
* `GType`, the value will be copied directly. Otherwise, GDK will
|
||||
* try to use [func@Gdk.content_deserialize_async] to convert the data.
|
||||
|
||||
@@ -767,9 +767,6 @@ gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel,
|
||||
* This function asynchronously obtains a handle for a toplevel surface
|
||||
* that can be passed to other processes.
|
||||
*
|
||||
* When a handle has been obtained, @callback will be called, and can
|
||||
* receive the handle via [method@Gdk.Toplevel.export_handle_finish].
|
||||
*
|
||||
* It is an error to call this function on a surface that is already
|
||||
* exported.
|
||||
*
|
||||
|
||||
@@ -607,7 +607,8 @@ physical_device_check_features (VkPhysicalDevice device)
|
||||
features |= GDK_VULKAN_FEATURE_YCBCR;
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
|
||||
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME))
|
||||
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME) &&
|
||||
physical_device_supports_extension (device, VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME))
|
||||
features |= GDK_VULKAN_FEATURE_DMABUF;
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME))
|
||||
@@ -1517,6 +1518,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME);
|
||||
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
|
||||
|
||||
@@ -96,12 +96,12 @@ _gdk_macos_drag_surface_constructed (GObject *object)
|
||||
defer:NO
|
||||
screen:screen];
|
||||
|
||||
_gdk_macos_surface_set_native (self, window);
|
||||
|
||||
[window setOpaque:NO];
|
||||
[window setBackgroundColor:[NSColor clearColor]];
|
||||
[window setDecorated:NO];
|
||||
|
||||
_gdk_macos_surface_set_native (self, window);
|
||||
|
||||
frame_clock = _gdk_frame_clock_idle_new ();
|
||||
gdk_surface_set_frame_clock (surface, frame_clock);
|
||||
g_object_unref (frame_clock);
|
||||
|
||||
@@ -52,6 +52,7 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
||||
GdkRectangle bounds;
|
||||
GdkRectangle final_rect;
|
||||
int x, y;
|
||||
int shadow_left, shadow_right, shadow_top, shadow_bottom;
|
||||
|
||||
g_assert (GDK_IS_MACOS_POPUP_SURFACE (self));
|
||||
g_assert (layout != NULL);
|
||||
@@ -68,10 +69,19 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
||||
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
|
||||
gdk_macos_monitor_get_workarea (monitor, &bounds);
|
||||
|
||||
gdk_popup_layout_get_shadow_width (layout,
|
||||
&shadow_left,
|
||||
&shadow_right,
|
||||
&shadow_top,
|
||||
&shadow_bottom);
|
||||
|
||||
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
|
||||
width,
|
||||
height,
|
||||
0, 0, 0, 0, /* shadow-left/right/top/bottom */
|
||||
shadow_left,
|
||||
shadow_right,
|
||||
shadow_top,
|
||||
shadow_bottom,
|
||||
monitor,
|
||||
&bounds,
|
||||
self->layout,
|
||||
@@ -306,14 +316,14 @@ _gdk_macos_popup_surface_constructed (GObject *object)
|
||||
defer:NO
|
||||
screen:screen];
|
||||
|
||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||
|
||||
[window setOpaque:NO];
|
||||
[window setBackgroundColor:[NSColor clearColor]];
|
||||
[window setDecorated:NO];
|
||||
[window setExcludedFromWindowsMenu:YES];
|
||||
[window setLevel:NSPopUpMenuWindowLevel];
|
||||
|
||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||
|
||||
gdk_surface_set_frame_clock (surface, gdk_surface_get_frame_clock (surface->parent));
|
||||
|
||||
GDK_END_MACOS_ALLOC_POOL;
|
||||
|
||||
@@ -591,11 +591,11 @@ _gdk_macos_toplevel_surface_constructed (GObject *object)
|
||||
defer:NO
|
||||
screen:screen];
|
||||
|
||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||
|
||||
/* Allow NSWindow to go fullscreen */
|
||||
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
|
||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||
|
||||
frame_clock = _gdk_frame_clock_idle_new ();
|
||||
gdk_surface_set_frame_clock (surface, frame_clock);
|
||||
g_object_unref (frame_clock);
|
||||
|
||||
+1
-1
@@ -128,8 +128,8 @@ install_headers(gdk_deprecated_headers, subdir: 'gtk-4.0/gdk/deprecated')
|
||||
gdk_sources = gdk_public_sources + gdk_deprecated_sources
|
||||
|
||||
gdk_private_h_sources = files([
|
||||
'gdkeventsprivate.h',
|
||||
'gdkdevicetoolprivate.h',
|
||||
'gdkeventsprivate.h',
|
||||
'gdkhslaprivate.h',
|
||||
'gdkmonitorprivate.h',
|
||||
'gdkseatdefaultprivate.h',
|
||||
|
||||
@@ -165,25 +165,29 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
double *scale)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
int desired_scale_factor;
|
||||
|
||||
desired_scale_factor = (int) ceil (desired_scale);
|
||||
|
||||
if (gdk_cursor_get_name (cursor))
|
||||
{
|
||||
struct wl_cursor *c;
|
||||
int scale_factor;
|
||||
|
||||
if (g_str_equal (gdk_cursor_get_name (cursor), "none"))
|
||||
goto none;
|
||||
{
|
||||
*hotspot_x = *hotspot_y = 0;
|
||||
*width = *height = 0;
|
||||
*scale = 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
scale_factor = (int) ceil (desired_scale);
|
||||
|
||||
c = gdk_wayland_cursor_load_for_name (display,
|
||||
_gdk_wayland_display_get_cursor_theme (display),
|
||||
desired_scale_factor,
|
||||
display->cursor_theme,
|
||||
scale_factor,
|
||||
gdk_cursor_get_name (cursor));
|
||||
if (c && c->image_count > 0)
|
||||
{
|
||||
struct wl_cursor_image *image;
|
||||
int cursor_scale;
|
||||
|
||||
if (image_index >= c->image_count)
|
||||
{
|
||||
@@ -195,23 +199,23 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
|
||||
image = c->images[image_index];
|
||||
|
||||
cursor_scale = desired_scale_factor;
|
||||
if ((image->width % cursor_scale != 0) ||
|
||||
(image->height % cursor_scale != 0))
|
||||
*width = display->cursor_theme_size;
|
||||
*height = display->cursor_theme_size;
|
||||
*scale = image->width / (double) *width;
|
||||
*hotspot_x = image->hotspot_x / scale_factor;
|
||||
*hotspot_y = image->hotspot_y / scale_factor;
|
||||
|
||||
if (*scale != scale_factor && !use_viewporter)
|
||||
{
|
||||
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer "
|
||||
"multiple of scale (%d)", image->width, image->height,
|
||||
cursor_scale);
|
||||
cursor_scale = 1;
|
||||
g_warning (G_STRLOC " cursor image size (%d) not an integer "
|
||||
"multiple of theme size (%d)", image->width, *width);
|
||||
*width = image->width;
|
||||
*height = image->height;
|
||||
*hotspot_x = image->hotspot_x;
|
||||
*hotspot_y = image->hotspot_y;
|
||||
*scale = 1;
|
||||
}
|
||||
|
||||
*hotspot_x = image->hotspot_x / cursor_scale;
|
||||
*hotspot_y = image->hotspot_y / cursor_scale;
|
||||
|
||||
*width = image->width / cursor_scale;
|
||||
*height = image->height / cursor_scale;
|
||||
*scale = cursor_scale;
|
||||
|
||||
return wl_cursor_image_get_buffer (image);
|
||||
}
|
||||
}
|
||||
@@ -257,7 +261,7 @@ from_texture:
|
||||
else
|
||||
{
|
||||
if (!use_viewporter)
|
||||
*scale = desired_scale_factor;
|
||||
*scale = ceil (desired_scale);
|
||||
else
|
||||
*scale = desired_scale;
|
||||
|
||||
@@ -294,28 +298,23 @@ from_texture:
|
||||
}
|
||||
|
||||
if (gdk_cursor_get_fallback (cursor))
|
||||
return _gdk_wayland_cursor_get_buffer (display,
|
||||
gdk_cursor_get_fallback (cursor),
|
||||
desired_scale,
|
||||
use_viewporter,
|
||||
image_index,
|
||||
hotspot_x, hotspot_y,
|
||||
width, height,
|
||||
scale);
|
||||
{
|
||||
return _gdk_wayland_cursor_get_buffer (display,
|
||||
gdk_cursor_get_fallback (cursor),
|
||||
desired_scale,
|
||||
use_viewporter,
|
||||
image_index,
|
||||
hotspot_x, hotspot_y,
|
||||
width, height,
|
||||
scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default");
|
||||
goto from_texture;
|
||||
}
|
||||
|
||||
none:
|
||||
*hotspot_x = 0;
|
||||
*hotspot_y = 0;
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
*scale = 1;
|
||||
|
||||
return NULL;
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
guint
|
||||
|
||||
@@ -37,6 +37,7 @@ static struct {
|
||||
{ "appstarting", IDC_APPSTARTING },
|
||||
{ "arrow", IDC_ARROW },
|
||||
{ "cross", IDC_CROSS },
|
||||
{ "dnd-move", IDC_ARROW },
|
||||
{ "hand", IDC_HAND },
|
||||
{ "help", IDC_HELP },
|
||||
{ "ibeam", IDC_IBEAM },
|
||||
|
||||
@@ -1776,11 +1776,6 @@ _gdk_x11_display_is_root_window (GdkDisplay *display,
|
||||
return GDK_SCREEN_XROOTWIN (display_x11->screen) == xroot_window;
|
||||
}
|
||||
|
||||
struct XPointerUngrabInfo {
|
||||
GdkDisplay *display;
|
||||
guint32 time;
|
||||
};
|
||||
|
||||
static void
|
||||
device_grab_update_callback (GdkDisplay *display,
|
||||
gpointer data,
|
||||
|
||||
@@ -70,7 +70,10 @@ gsk_gl_frame_cleanup (GskGpuFrame *frame)
|
||||
if (self->sync)
|
||||
{
|
||||
glClientWaitSync (self->sync, 0, -1);
|
||||
g_clear_pointer (&self->sync, glDeleteSync);
|
||||
|
||||
/* can't use g_clear_pointer() on glDeleteSync(), see MR !7294 */
|
||||
glDeleteSync (self->sync);
|
||||
self->sync = NULL;
|
||||
}
|
||||
|
||||
self->next_texture_slot = 0;
|
||||
|
||||
@@ -249,7 +249,13 @@ gsk_gl_texture_data_free (gpointer user_data)
|
||||
|
||||
gdk_gl_context_make_current (data->context);
|
||||
|
||||
g_clear_pointer (&data->sync, glDeleteSync);
|
||||
/* can't use g_clear_pointer() on glDeleteSync(), see MR !7294 */
|
||||
if (data->sync)
|
||||
{
|
||||
glDeleteSync (data->sync);
|
||||
data->sync = NULL;
|
||||
}
|
||||
|
||||
glDeleteTextures (1, &data->texture_id);
|
||||
g_object_unref (data->context);
|
||||
|
||||
|
||||
@@ -1261,7 +1261,7 @@ gsk_vulkan_device_find_allocator (GskVulkanDevice *self,
|
||||
|
||||
g_assert (found < properties.memoryTypeCount);
|
||||
|
||||
return gsk_vulkan_allocator_ref (gsk_vulkan_device_get_allocator (self, i, &properties.memoryTypes[i]));
|
||||
return gsk_vulkan_allocator_ref (gsk_vulkan_device_get_allocator (self, found, &properties.memoryTypes[found]));
|
||||
}
|
||||
|
||||
GskVulkanAllocator *
|
||||
|
||||
@@ -6397,6 +6397,10 @@ gsk_mask_node_draw (GskRenderNode *node,
|
||||
graphene_matrix_t color_matrix;
|
||||
graphene_vec4_t color_offset;
|
||||
|
||||
/* clip so the push_group() creates a smaller surface */
|
||||
gsk_cairo_rectangle (cr, &node->bounds);
|
||||
cairo_clip (cr);
|
||||
|
||||
if (has_empty_clip (cr))
|
||||
return;
|
||||
|
||||
|
||||
@@ -530,6 +530,15 @@ handle_accessible_method (GDBusConnection *connection,
|
||||
g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{ss}"));
|
||||
g_variant_builder_add (&builder, "{ss}", "toolkit", "GTK");
|
||||
|
||||
if (gtk_at_context_has_accessible_property (GTK_AT_CONTEXT (self), GTK_ACCESSIBLE_PROPERTY_LEVEL))
|
||||
{
|
||||
GtkAccessibleValue *value = gtk_at_context_get_accessible_property (GTK_AT_CONTEXT (self),
|
||||
GTK_ACCESSIBLE_PROPERTY_LEVEL);
|
||||
char *level = g_strdup_printf ("%d", gtk_int_accessible_value_get (value));
|
||||
g_variant_builder_add (&builder, "{ss}", "level", level);
|
||||
g_free (level);
|
||||
}
|
||||
|
||||
if (gtk_at_context_has_accessible_property (GTK_AT_CONTEXT (self), GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER))
|
||||
{
|
||||
GtkAccessibleValue *value;
|
||||
@@ -1257,10 +1266,13 @@ gtk_at_spi_context_child_change (GtkATContext *ctx,
|
||||
}
|
||||
|
||||
if (change & GTK_ACCESSIBLE_CHILD_CHANGE_ADDED)
|
||||
{
|
||||
gtk_at_context_realize (child_context);
|
||||
emit_children_changed (self,
|
||||
GTK_AT_SPI_CONTEXT (child_context),
|
||||
idx,
|
||||
GTK_ACCESSIBLE_CHILD_STATE_ADDED);
|
||||
}
|
||||
else if (change & GTK_ACCESSIBLE_CHILD_CHANGE_REMOVED)
|
||||
emit_children_changed (self,
|
||||
GTK_AT_SPI_CONTEXT (child_context),
|
||||
|
||||
+61
-27
@@ -26,6 +26,11 @@
|
||||
#include "gtkcsserror.h"
|
||||
#include "gtkcsslocationprivate.h"
|
||||
|
||||
/* We cannot include gtkdebug.h, so we must keep this in sync */
|
||||
extern unsigned int gtk_get_debug_flags (void);
|
||||
#define DEBUG_CSS (1 << 20)
|
||||
#define DEBUG_CHECK_CSS ((gtk_get_debug_flags () & DEBUG_CSS) != 0)
|
||||
|
||||
static void clear_ref (GtkCssVariableValueReference *ref);
|
||||
|
||||
#define GDK_ARRAY_NAME gtk_css_parser_references
|
||||
@@ -49,7 +54,7 @@ struct _GtkCssParserBlock
|
||||
#define GDK_ARRAY_NAME gtk_css_parser_blocks
|
||||
#define GDK_ARRAY_TYPE_NAME GtkCssParserBlocks
|
||||
#define GDK_ARRAY_ELEMENT_TYPE GtkCssParserBlock
|
||||
#define GDK_ARRAY_PREALLOC 32
|
||||
#define GDK_ARRAY_PREALLOC 12
|
||||
#define GDK_ARRAY_NO_MEMSET 1
|
||||
#include "gdk/gdkarrayimpl.c"
|
||||
|
||||
@@ -626,7 +631,7 @@ void
|
||||
gtk_css_parser_skip (GtkCssParser *self)
|
||||
{
|
||||
const GtkCssToken *token;
|
||||
|
||||
|
||||
token = gtk_css_parser_get_token (self);
|
||||
if (gtk_css_token_is_preserved (token, NULL))
|
||||
{
|
||||
@@ -659,7 +664,7 @@ gtk_css_parser_skip_until (GtkCssParser *self,
|
||||
GtkCssTokenType token_type)
|
||||
{
|
||||
const GtkCssToken *token;
|
||||
|
||||
|
||||
for (token = gtk_css_parser_get_token (self);
|
||||
!gtk_css_token_is (token, token_type) &&
|
||||
!gtk_css_token_is (token, GTK_CSS_TOKEN_EOF);
|
||||
@@ -812,6 +817,29 @@ gtk_css_parser_warn_syntax (GtkCssParser *self,
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_parser_warn_deprecated (GtkCssParser *self,
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
if (DEBUG_CHECK_CSS)
|
||||
{
|
||||
va_list args;
|
||||
GError *error;
|
||||
|
||||
va_start (args, format);
|
||||
error = g_error_new_valist (GTK_CSS_PARSER_WARNING,
|
||||
GTK_CSS_PARSER_WARNING_DEPRECATED,
|
||||
format, args);
|
||||
gtk_css_parser_emit_error (self,
|
||||
gtk_css_parser_get_start_location (self),
|
||||
gtk_css_parser_get_end_location (self),
|
||||
error);
|
||||
g_error_free (error);
|
||||
va_end (args);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_css_parser_consume_function (GtkCssParser *self,
|
||||
guint min_args,
|
||||
@@ -1133,7 +1161,7 @@ gtk_css_parser_parse_url_arg (GtkCssParser *parser,
|
||||
*out_url = gtk_css_parser_consume_string (parser);
|
||||
if (*out_url == NULL)
|
||||
return 0;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1179,7 +1207,7 @@ gtk_css_parser_consume_url (GtkCssParser *self)
|
||||
gtk_css_parser_error_syntax (self, "Expected a URL");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -1300,6 +1328,9 @@ gtk_css_parser_has_references (GtkCssParser *self)
|
||||
gboolean ret = FALSE;
|
||||
int inner_blocks = 0, i;
|
||||
|
||||
/* We don't want gtk_css_parser_ensure_token to expand references on us here */
|
||||
g_assert (self->n_refs == 0);
|
||||
|
||||
gtk_css_tokenizer_save (tokenizer);
|
||||
|
||||
do {
|
||||
@@ -1315,7 +1346,7 @@ gtk_css_parser_has_references (GtkCssParser *self)
|
||||
if (gtk_css_token_is (token, GTK_CSS_TOKEN_CLOSE_PARENS) ||
|
||||
gtk_css_token_is (token, GTK_CSS_TOKEN_CLOSE_SQUARE))
|
||||
{
|
||||
goto error;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1338,7 +1369,7 @@ gtk_css_parser_has_references (GtkCssParser *self)
|
||||
inner_blocks++;
|
||||
gtk_css_parser_start_block (self);
|
||||
|
||||
if (!ret && is_var)
|
||||
if (is_var)
|
||||
{
|
||||
token = gtk_css_parser_get_token (self);
|
||||
|
||||
@@ -1346,18 +1377,18 @@ gtk_css_parser_has_references (GtkCssParser *self)
|
||||
{
|
||||
const char *var_name = gtk_css_token_get_string (token);
|
||||
|
||||
if (var_name[0] != '-' || var_name[1] != '-')
|
||||
goto error;
|
||||
if (strlen (var_name) < 3 || var_name[0] != '-' || var_name[1] != '-')
|
||||
goto done;
|
||||
|
||||
gtk_css_parser_consume_token (self);
|
||||
|
||||
if (!gtk_css_parser_has_token (self, GTK_CSS_TOKEN_EOF) &&
|
||||
!gtk_css_parser_has_token (self, GTK_CSS_TOKEN_COMMA))
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
goto done;
|
||||
|
||||
ret = TRUE;
|
||||
/* We got our answer. Now get it out as fast as possible! */
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1365,18 +1396,7 @@ gtk_css_parser_has_references (GtkCssParser *self)
|
||||
while (!gtk_css_parser_has_token (self, GTK_CSS_TOKEN_SEMICOLON) &&
|
||||
!gtk_css_parser_has_token (self, GTK_CSS_TOKEN_CLOSE_CURLY));
|
||||
|
||||
if (inner_blocks > 0)
|
||||
goto error;
|
||||
|
||||
g_assert (tokenizer == get_tokenizer (self));
|
||||
|
||||
gtk_css_tokenizer_restore (tokenizer);
|
||||
self->location = *gtk_css_tokenizer_get_location (tokenizer);
|
||||
gtk_css_tokenizer_read_token (tokenizer, &self->token, NULL);
|
||||
|
||||
return ret;
|
||||
|
||||
error:
|
||||
done:
|
||||
for (i = 0; i < inner_blocks; i++)
|
||||
gtk_css_parser_end_block (self);
|
||||
|
||||
@@ -1386,7 +1406,7 @@ error:
|
||||
self->location = *gtk_css_tokenizer_get_location (tokenizer);
|
||||
gtk_css_tokenizer_read_token (tokenizer, &self->token, NULL);
|
||||
|
||||
return FALSE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1482,9 +1502,9 @@ gtk_css_parser_parse_value_into_token_stream (GtkCssParser *self)
|
||||
GtkCssVariableValueReference ref;
|
||||
char *var_name = g_strdup (gtk_css_token_get_string (token));
|
||||
|
||||
if (var_name[0] != '-' || var_name[1] != '-')
|
||||
if (strlen (var_name) < 3 || var_name[0] != '-' || var_name[1] != '-')
|
||||
{
|
||||
gtk_css_parser_error_value (self, "Invalid variable name: %s", var_name);
|
||||
gtk_css_parser_error_syntax (self, "Invalid variable name: %s", var_name);
|
||||
g_free (var_name);
|
||||
goto error;
|
||||
}
|
||||
@@ -1527,6 +1547,20 @@ gtk_css_parser_parse_value_into_token_stream (GtkCssParser *self)
|
||||
|
||||
gtk_css_parser_references_append (&refs, &ref);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gtk_css_token_is (token, GTK_CSS_TOKEN_EOF))
|
||||
{
|
||||
gtk_css_parser_error_syntax (self, "Missing variable name");
|
||||
}
|
||||
else
|
||||
{
|
||||
char *s = gtk_css_token_to_string (token);
|
||||
gtk_css_parser_error_syntax (self, "Expected a variable name, not %s", s);
|
||||
g_free (s);
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +120,9 @@ void gtk_css_parser_warn (GtkCssParser
|
||||
void gtk_css_parser_warn_syntax (GtkCssParser *self,
|
||||
const char *format,
|
||||
...) G_GNUC_PRINTF(2, 3);
|
||||
void gtk_css_parser_warn_deprecated (GtkCssParser *self,
|
||||
const char *format,
|
||||
...) G_GNUC_PRINTF(2, 3);
|
||||
|
||||
|
||||
gboolean gtk_css_parser_has_token (GtkCssParser *self,
|
||||
|
||||
@@ -253,7 +253,7 @@ gtk_cell_renderer_spinner_update_size (GtkCellRendererSpinner *cell,
|
||||
node = gtk_style_context_get_node (context);
|
||||
gtk_icon_size_set_style_classes (node, priv->icon_size);
|
||||
style = gtk_css_node_get_style (node);
|
||||
priv->size = _gtk_css_number_value_get (style->icon->icon_size, 100);
|
||||
priv->size = gtk_css_number_value_get (style->icon->icon_size, 100);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ static int
|
||||
calc_indicator_size (GtkStyleContext *context)
|
||||
{
|
||||
GtkCssStyle *style = gtk_style_context_lookup_style (context);
|
||||
return _gtk_css_number_value_get (style->icon->icon_size, 100);
|
||||
return gtk_css_number_value_get (style->icon->icon_size, 100);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -62,7 +62,7 @@ struct _GtkMessageDialog
|
||||
*
|
||||
* > Please note that %GTK_BUTTONS_OK, %GTK_BUTTONS_YES_NO
|
||||
* > and %GTK_BUTTONS_OK_CANCEL are discouraged by the
|
||||
* > [GNOME Human Interface Guidelines](http://library.gnome.org/devel/hig-book/stable/).
|
||||
* > [GNOME Human Interface Guidelines](https://developer.gnome.org/hig/).
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
|
||||
@@ -99,7 +99,6 @@ window_handle_exported (GtkWindow *window,
|
||||
* a given uri.
|
||||
*
|
||||
* The @callback will be called when the launch is completed.
|
||||
* It should call gtk_show_uri_full_finish() to obtain the result.
|
||||
*
|
||||
* This is the recommended call to be used as it passes information
|
||||
* necessary for sandbox helpers to parent their dialogs properly.
|
||||
@@ -153,8 +152,8 @@ gtk_show_uri_full (GtkWindow *parent,
|
||||
* Returns: %TRUE if the URI was shown successfully.
|
||||
* Otherwise, %FALSE is returned and @error is set
|
||||
*
|
||||
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch_finish] or
|
||||
* [method@Gtk.UriLauncher.launch_finish] instead
|
||||
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch] or
|
||||
* [method@Gtk.UriLauncher.launch] instead
|
||||
*/
|
||||
gboolean
|
||||
gtk_show_uri_full_finish (GtkWindow *parent,
|
||||
|
||||
@@ -778,15 +778,15 @@ gtk_style_context_resolve_color (GtkStyleContext *context,
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
g_return_val_if_fail (result != NULL, FALSE);
|
||||
|
||||
val = _gtk_css_color_value_resolve (color,
|
||||
GTK_STYLE_PROVIDER (priv->cascade),
|
||||
_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR),
|
||||
NULL);
|
||||
val = gtk_css_color_value_resolve (color,
|
||||
GTK_STYLE_PROVIDER (priv->cascade),
|
||||
_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
|
||||
|
||||
if (val == NULL)
|
||||
return FALSE;
|
||||
|
||||
*result = *gtk_css_color_value_get_rgba (val);
|
||||
_gtk_css_value_unref (val);
|
||||
gtk_css_value_unref (val);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -860,10 +860,10 @@ gtk_style_context_get_border (GtkStyleContext *context,
|
||||
|
||||
style = gtk_style_context_lookup_style (context);
|
||||
|
||||
border->top = round (_gtk_css_number_value_get (style->border->border_top_width, 100));
|
||||
border->right = round (_gtk_css_number_value_get (style->border->border_right_width, 100));
|
||||
border->bottom = round (_gtk_css_number_value_get (style->border->border_bottom_width, 100));
|
||||
border->left = round (_gtk_css_number_value_get (style->border->border_left_width, 100));
|
||||
border->top = round (gtk_css_number_value_get (style->border->border_top_width, 100));
|
||||
border->right = round (gtk_css_number_value_get (style->border->border_right_width, 100));
|
||||
border->bottom = round (gtk_css_number_value_get (style->border->border_bottom_width, 100));
|
||||
border->left = round (gtk_css_number_value_get (style->border->border_left_width, 100));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -886,10 +886,10 @@ gtk_style_context_get_padding (GtkStyleContext *context,
|
||||
|
||||
style = gtk_style_context_lookup_style (context);
|
||||
|
||||
padding->top = round (_gtk_css_number_value_get (style->size->padding_top, 100));
|
||||
padding->right = round (_gtk_css_number_value_get (style->size->padding_right, 100));
|
||||
padding->bottom = round (_gtk_css_number_value_get (style->size->padding_bottom, 100));
|
||||
padding->left = round (_gtk_css_number_value_get (style->size->padding_left, 100));
|
||||
padding->top = round (gtk_css_number_value_get (style->size->padding_top, 100));
|
||||
padding->right = round (gtk_css_number_value_get (style->size->padding_right, 100));
|
||||
padding->bottom = round (gtk_css_number_value_get (style->size->padding_bottom, 100));
|
||||
padding->left = round (gtk_css_number_value_get (style->size->padding_left, 100));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -912,10 +912,10 @@ gtk_style_context_get_margin (GtkStyleContext *context,
|
||||
|
||||
style = gtk_style_context_lookup_style (context);
|
||||
|
||||
margin->top = round (_gtk_css_number_value_get (style->size->margin_top, 100));
|
||||
margin->right = round (_gtk_css_number_value_get (style->size->margin_right, 100));
|
||||
margin->bottom = round (_gtk_css_number_value_get (style->size->margin_bottom, 100));
|
||||
margin->left = round (_gtk_css_number_value_get (style->size->margin_left, 100));
|
||||
margin->top = round (gtk_css_number_value_get (style->size->margin_top, 100));
|
||||
margin->right = round (gtk_css_number_value_get (style->size->margin_right, 100));
|
||||
margin->bottom = round (gtk_css_number_value_get (style->size->margin_bottom, 100));
|
||||
margin->left = round (gtk_css_number_value_get (style->size->margin_left, 100));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -2691,8 +2691,8 @@ gtk_tree_view_get_expander_size (GtkTreeView *tree_view)
|
||||
gtk_style_context_add_class (context, "expander");
|
||||
|
||||
style = gtk_style_context_lookup_style (context);
|
||||
min_width = _gtk_css_number_value_get (style->size->min_width, 100);
|
||||
min_height = _gtk_css_number_value_get (style->size->min_height, 100);
|
||||
min_width = gtk_css_number_value_get (style->size->min_width, 100);
|
||||
min_height = gtk_css_number_value_get (style->size->min_height, 100);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
@@ -5521,7 +5521,7 @@ get_separator_height (GtkTreeView *tree_view)
|
||||
gtk_style_context_add_class (context, "separator");
|
||||
|
||||
style = gtk_style_context_lookup_style (context);
|
||||
d = _gtk_css_number_value_get (style->size->min_height, 100);
|
||||
d = gtk_css_number_value_get (style->size->min_height, 100);
|
||||
|
||||
if (d < 1)
|
||||
min_size = ceil (d);
|
||||
|
||||
@@ -33,8 +33,7 @@
|
||||
* are needed to present a message to the user.
|
||||
*
|
||||
* The message is shown with the [method@Gtk.AlertDialog.choose]
|
||||
* function. This API follows the GIO async pattern, and the result can
|
||||
* be obtained by calling [method@Gtk.AlertDialog.choose_finish].
|
||||
* function.
|
||||
*
|
||||
* If you don't need to wait for a button to be clicked, you can use
|
||||
* [method@Gtk.AlertDialog.show].
|
||||
@@ -687,10 +686,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
*
|
||||
* This function shows the alert to the user.
|
||||
*
|
||||
* The @callback will be called when the alert is dismissed.
|
||||
* It should call [method@Gtk.AlertDialog.choose_finish]
|
||||
* to obtain the result.
|
||||
*
|
||||
* It is ok to pass `NULL` for the callback if the alert
|
||||
* does not have more than one button. A simpler API for
|
||||
* this case is [method@Gtk.AlertDialog.show].
|
||||
|
||||
@@ -76,13 +76,19 @@ G_DEFINE_TYPE (GtkApplicationImplQuartz, gtk_application_impl_quartz, GTK_TYPE_A
|
||||
|
||||
-(NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)sender
|
||||
{
|
||||
/* We have no way to give our message other than to pop up a dialog
|
||||
* ourselves, which we should not do since the OS will already show
|
||||
* one when we return NSTerminateNow.
|
||||
*
|
||||
* Just let the OS show the generic message...
|
||||
*/
|
||||
return quartz->quit_inhibit == 0 ? NSTerminateNow : NSTerminateCancel;
|
||||
const gchar *quit_action_name = "quit";
|
||||
GActionGroup *action_group = G_ACTION_GROUP (quartz->impl.application);
|
||||
|
||||
if (quartz->quit_inhibit != 0)
|
||||
return NSTerminateCancel;
|
||||
|
||||
if (g_action_group_has_action (action_group, quit_action_name))
|
||||
{
|
||||
g_action_group_activate_action (action_group, quit_action_name, NULL);
|
||||
return NSTerminateCancel;
|
||||
}
|
||||
|
||||
return NSTerminateNow;
|
||||
}
|
||||
|
||||
-(void)application:(NSApplication *)theApplication openFiles:(NSArray *)filenames
|
||||
|
||||
@@ -84,7 +84,7 @@ gtk_builtin_icon_measure (GtkWidget *widget,
|
||||
|
||||
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
|
||||
|
||||
*minimum = *natural = _gtk_css_number_value_get (style->icon->icon_size, 100);
|
||||
*minimum = *natural = gtk_css_number_value_get (style->icon->icon_size, 100);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -36,9 +36,7 @@
|
||||
* should be modal.
|
||||
*
|
||||
* The dialog is shown with the [method@Gtk.ColorDialog.choose_rgba]
|
||||
* function. This API follows the GIO async pattern, and the
|
||||
* result can be obtained by calling
|
||||
* [method@Gtk.ColorDialog.choose_rgba_finish].
|
||||
* function.
|
||||
*
|
||||
* See [class@Gtk.ColorDialogButton] for a convenient control
|
||||
* that uses `GtkColorDialog` and presents the results.
|
||||
@@ -436,10 +434,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
* This function initiates a color choice operation by
|
||||
* presenting a color chooser dialog to the user.
|
||||
*
|
||||
* The @callback will be called when the dialog is dismissed.
|
||||
* It should call [method@Gtk.ColorDialog.choose_rgba_finish]
|
||||
* to obtain the result.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
void
|
||||
|
||||
+135
-1
@@ -32,7 +32,9 @@
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gtkcolorutils.h"
|
||||
#include "gtkcolorutilsprivate.h"
|
||||
#include "gdkhslaprivate.h"
|
||||
#include <math.h>
|
||||
|
||||
/* Converts from RGB to HSV */
|
||||
static void
|
||||
@@ -226,3 +228,135 @@ gtk_rgb_to_hsv (float r, float g, float b,
|
||||
if (v)
|
||||
*v = b;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_rgb_to_hwb (float red, float green, float blue,
|
||||
float *hue, float *white, float *black)
|
||||
{
|
||||
GdkRGBA rgba = (GdkRGBA) { red, green, blue, 1 };
|
||||
GdkHSLA hsla;
|
||||
|
||||
_gdk_hsla_init_from_rgba (&hsla, &rgba);
|
||||
|
||||
*hue = hsla.hue;
|
||||
*white = MIN (MIN (red, green), blue);
|
||||
*black = (1 - MAX (MAX (red, green), blue));
|
||||
}
|
||||
|
||||
void
|
||||
gtk_hwb_to_rgb (float hue, float white, float black,
|
||||
float *red, float *green, float *blue)
|
||||
{
|
||||
GdkHSLA hsla;
|
||||
GdkRGBA rgba;
|
||||
|
||||
if (white + black >= 1)
|
||||
{
|
||||
float gray = white / (white + black);
|
||||
|
||||
*red = gray;
|
||||
*green = gray;
|
||||
*blue = gray;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
hsla.hue = hue;
|
||||
hsla.saturation = 1.0;
|
||||
hsla.lightness = 0.5;
|
||||
|
||||
_gdk_rgba_init_from_hsla (&rgba, &hsla);
|
||||
|
||||
*red = rgba.red * (1 - white - black) + white;
|
||||
*green = rgba.green * (1 - white - black) + white;
|
||||
*blue = rgba.blue * (1 - white - black) + white;
|
||||
}
|
||||
|
||||
#define DEG_TO_RAD(x) ((x) * G_PI / 180)
|
||||
#define RAD_TO_DEG(x) ((x) * 180 / G_PI)
|
||||
|
||||
void
|
||||
gtk_oklab_to_oklch (float L, float a, float b,
|
||||
float *L2, float *C, float *H)
|
||||
{
|
||||
*L2 = L;
|
||||
*C = sqrtf (a * a + b * b);
|
||||
*H = atan2 (b, a);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_oklch_to_oklab (float L, float C, float H,
|
||||
float *L2, float *a, float *b)
|
||||
{
|
||||
*L2 = L;
|
||||
|
||||
if (H == 0)
|
||||
{
|
||||
*a = *b = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*a = C * cosf (DEG_TO_RAD (H));
|
||||
*b = C * sinf (DEG_TO_RAD (H));
|
||||
}
|
||||
}
|
||||
|
||||
static float
|
||||
apply_gamma (float v)
|
||||
{
|
||||
if (v > 0.0031308)
|
||||
return 1.055 * pow (v, 1/2.4) - 0.055;
|
||||
else
|
||||
return 12.92 * v;
|
||||
}
|
||||
|
||||
static float
|
||||
unapply_gamma (float v)
|
||||
{
|
||||
if (v >= 0.04045)
|
||||
return pow (((v + 0.055)/(1 + 0.055)), 2.4);
|
||||
else
|
||||
return v / 12.92;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_oklab_to_rgb (float L, float a, float b,
|
||||
float *red, float *green, float *blue)
|
||||
{
|
||||
float l = L + 0.3963377774f * a + 0.2158037573f * b;
|
||||
float m = L - 0.1055613458f * a - 0.0638541728f * b;
|
||||
float s = L - 0.0894841775f * a - 1.2914855480f * b;
|
||||
|
||||
l = powf (l, 3);
|
||||
m = powf (m, 3);
|
||||
s = powf (s, 3);
|
||||
|
||||
float linear_red = +4.0767416621f * l - 3.3077115913f * m + 0.2309699292f * s;
|
||||
float linear_green = -1.2684380046f * l + 2.6097574011f * m - 0.3413193965f * s;
|
||||
float linear_blue = -0.0041960863f * l - 0.7034186147f * m + 1.7076147010f * s;
|
||||
|
||||
*red = apply_gamma (linear_red);
|
||||
*green = apply_gamma (linear_green);
|
||||
*blue = apply_gamma (linear_blue);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_rgb_to_oklab (float red, float green, float blue,
|
||||
float *L, float *a, float *b)
|
||||
{
|
||||
float linear_red = unapply_gamma (red);
|
||||
float linear_green = unapply_gamma (green);
|
||||
float linear_blue = unapply_gamma (blue);
|
||||
|
||||
float l = 0.4122214708f * linear_red + 0.5363325363f * linear_green + 0.0514459929f * linear_blue;
|
||||
float m = 0.2119034982f * linear_red + 0.6806995451f * linear_green + 0.1073969566f * linear_blue;
|
||||
float s = 0.0883024619f * linear_red + 0.2817188376f * linear_green + 0.6299787005f * linear_blue;
|
||||
|
||||
l = cbrtf (l);
|
||||
m = cbrtf (m);
|
||||
s = cbrtf (s);
|
||||
|
||||
*L = 0.2104542553f*l + 0.7936177850f*m - 0.0040720468f*s;
|
||||
*a = 1.9779984951f*l - 2.4285922050f*m + 0.4505937099f*s;
|
||||
*b = 0.0259040371f*l + 0.7827717662f*m - 0.8086757660f*s;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2024 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gtkcolorutils.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gtk_rgb_to_hwb (float red, float green, float blue,
|
||||
float *hue, float *white, float *black);
|
||||
void gtk_hwb_to_rgb (float hue, float white, float black,
|
||||
float *red, float *green, float *blue);
|
||||
|
||||
void gtk_oklab_to_oklch (float L, float a, float b,
|
||||
float *L2, float *C, float *H);
|
||||
void gtk_oklch_to_oklab (float L, float C, float H,
|
||||
float *L2, float *a, float *b);
|
||||
|
||||
void gtk_oklab_to_rgb (float L, float a, float b,
|
||||
float *red, float *green, float *blue);
|
||||
void gtk_rgb_to_oklab (float red, float green, float blue,
|
||||
float *L, float *a, float *b);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+3
-1
@@ -2188,7 +2188,8 @@ gtk_column_view_set_header_factory (GtkColumnView *self,
|
||||
/**
|
||||
* gtk_column_view_scroll_to:
|
||||
* @self: The columnview to scroll in
|
||||
* @pos: position of the item
|
||||
* @pos: position of the item. Must be less than the number of
|
||||
* items in the view.
|
||||
* @column: (nullable) (transfer none): The column to scroll to
|
||||
* or %NULL to not scroll columns.
|
||||
* @flags: actions to perform
|
||||
@@ -2211,6 +2212,7 @@ gtk_column_view_scroll_to (GtkColumnView *self,
|
||||
GtkScrollInfo *scroll)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_COLUMN_VIEW (self));
|
||||
g_return_if_fail (pos < gtk_list_base_get_n_items (GTK_LIST_BASE (self->listview)));
|
||||
g_return_if_fail (column == NULL || GTK_IS_COLUMN_VIEW_COLUMN (column));
|
||||
if (column)
|
||||
{
|
||||
|
||||
+97
-31
@@ -42,9 +42,37 @@
|
||||
|
||||
G_DEFINE_TYPE (GtkCssAnimatedStyle, gtk_css_animated_style, GTK_TYPE_CSS_STYLE)
|
||||
|
||||
static inline gboolean
|
||||
property_has_color (guint id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case GTK_CSS_PROPERTY_COLOR:
|
||||
case GTK_CSS_PROPERTY_ICON_PALETTE:
|
||||
case GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR:
|
||||
case GTK_CSS_PROPERTY_TEXT_SHADOW:
|
||||
case GTK_CSS_PROPERTY_BOX_SHADOW:
|
||||
case GTK_CSS_PROPERTY_BORDER_TOP_COLOR:
|
||||
case GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR:
|
||||
case GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR:
|
||||
case GTK_CSS_PROPERTY_BORDER_LEFT_COLOR:
|
||||
case GTK_CSS_PROPERTY_OUTLINE_COLOR:
|
||||
case GTK_CSS_PROPERTY_BACKGROUND_IMAGE:
|
||||
case GTK_CSS_PROPERTY_ICON_SOURCE:
|
||||
case GTK_CSS_PROPERTY_ICON_SHADOW:
|
||||
case GTK_CSS_PROPERTY_CARET_COLOR:
|
||||
case GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
#define DEFINE_VALUES(ENUM, TYPE, NAME) \
|
||||
static inline void \
|
||||
gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated) \
|
||||
gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated, \
|
||||
GtkCssComputeContext *context, \
|
||||
GtkCssAnimationChange change) \
|
||||
{ \
|
||||
GtkCssStyle *style = (GtkCssStyle *)animated; \
|
||||
GtkCssValue **values = (GtkCssValue **)((guint8*)(animated->style->NAME) + sizeof (GtkCssValues)); \
|
||||
@@ -54,6 +82,7 @@ gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated) \
|
||||
{ \
|
||||
guint id = NAME ## _props[i]; \
|
||||
GtkCssValue *original, *computed; \
|
||||
gboolean needs_recompute = FALSE; \
|
||||
\
|
||||
if (values[i] == NULL) \
|
||||
continue; \
|
||||
@@ -62,16 +91,27 @@ gtk_css_ ## NAME ## _values_recompute (GtkCssAnimatedStyle *animated) \
|
||||
if (original == NULL) \
|
||||
continue; \
|
||||
\
|
||||
computed = _gtk_css_value_compute (original, \
|
||||
id, \
|
||||
animated->provider, \
|
||||
style, \
|
||||
animated->parent_style, \
|
||||
NULL); \
|
||||
if ((change & GTK_CSS_ANIMATION_CHANGE_VARIABLES) && \
|
||||
gtk_css_value_contains_variables (original)) \
|
||||
needs_recompute = TRUE; \
|
||||
\
|
||||
if ((change & GTK_CSS_ANIMATION_CHANGE_COLOR) && \
|
||||
property_has_color (id)) \
|
||||
needs_recompute = TRUE; \
|
||||
\
|
||||
if (!needs_recompute) \
|
||||
continue; \
|
||||
\
|
||||
computed = gtk_css_value_compute (original, \
|
||||
id, \
|
||||
context); \
|
||||
if (computed == NULL) \
|
||||
continue; \
|
||||
\
|
||||
gtk_css_animated_style_set_animated_value (animated, id, computed); \
|
||||
\
|
||||
if (id == GTK_CSS_PROPERTY_COLOR) \
|
||||
change |= GTK_CSS_ANIMATION_CHANGE_COLOR; \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -605,15 +645,20 @@ gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style,
|
||||
return gtk_css_style_get_value (style->style, id);
|
||||
}
|
||||
|
||||
void
|
||||
gboolean
|
||||
gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||
int id,
|
||||
GtkCssVariableValue *value)
|
||||
{
|
||||
GtkCssStyle *style = (GtkCssStyle *)animated;
|
||||
GtkCssVariableValue *old_value;
|
||||
|
||||
gtk_internal_return_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style));
|
||||
gtk_internal_return_if_fail (value != NULL);
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (style), FALSE);
|
||||
gtk_internal_return_val_if_fail (value != NULL, FALSE);
|
||||
|
||||
old_value = gtk_css_style_get_custom_property (style, id);
|
||||
if (gtk_css_variable_value_equal (old_value, value))
|
||||
return FALSE;
|
||||
|
||||
if (style->variables == NULL)
|
||||
{
|
||||
@@ -630,17 +675,38 @@ gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||
|
||||
gtk_css_variable_set_add (style->variables, id, value);
|
||||
|
||||
gtk_css_core_values_recompute (animated);
|
||||
gtk_css_background_values_recompute (animated);
|
||||
gtk_css_border_values_recompute (animated);
|
||||
gtk_css_icon_values_recompute (animated);
|
||||
gtk_css_outline_values_recompute (animated);
|
||||
gtk_css_font_values_recompute (animated);
|
||||
gtk_css_font_variant_values_recompute (animated);
|
||||
gtk_css_animation_values_recompute (animated);
|
||||
gtk_css_transition_values_recompute (animated);
|
||||
gtk_css_size_values_recompute (animated);
|
||||
gtk_css_other_values_recompute (animated);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_animated_style_recompute (GtkCssAnimatedStyle *style,
|
||||
GtkCssAnimationChange change)
|
||||
{
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
GtkCssValue *shorthands[GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES] = { NULL, };
|
||||
|
||||
context.provider = style->provider;
|
||||
context.style = style->style;
|
||||
context.parent_style = style->parent_style;
|
||||
context.shorthands = shorthands;
|
||||
|
||||
gtk_css_core_values_recompute (style, &context, change);
|
||||
gtk_css_background_values_recompute (style, &context, change);
|
||||
gtk_css_border_values_recompute (style, &context, change);
|
||||
gtk_css_icon_values_recompute (style, &context, change);
|
||||
gtk_css_outline_values_recompute (style, &context, change);
|
||||
gtk_css_font_values_recompute (style, &context, change);
|
||||
gtk_css_font_variant_values_recompute (style, &context, change);
|
||||
gtk_css_animation_values_recompute (style, &context, change);
|
||||
gtk_css_transition_values_recompute (style, &context, change);
|
||||
gtk_css_size_values_recompute (style, &context, change);
|
||||
gtk_css_other_values_recompute (style, &context, change);
|
||||
|
||||
for (unsigned int i = 0; i < GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES; i++)
|
||||
{
|
||||
if (shorthands[i])
|
||||
gtk_css_value_unref (shorthands[i]);
|
||||
}
|
||||
}
|
||||
|
||||
GtkCssVariableValue *
|
||||
@@ -789,8 +855,8 @@ gtk_css_animated_style_create_css_transitions (GPtrArray *animations,
|
||||
|
||||
if (_gtk_css_array_value_get_n_values (durations) == 1 &&
|
||||
_gtk_css_array_value_get_n_values (delays) == 1 &&
|
||||
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, 0), 100) +
|
||||
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, 0), 100) == 0)
|
||||
gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, 0), 100) +
|
||||
gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, 0), 100) == 0)
|
||||
return animations;
|
||||
|
||||
transition_infos_set (transitions, base_style->transition->transition_property);
|
||||
@@ -805,8 +871,8 @@ gtk_css_animated_style_create_css_transitions (GPtrArray *animations,
|
||||
if (!transitions[i].pending)
|
||||
continue;
|
||||
|
||||
duration = _gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, transitions[i].index), 100);
|
||||
delay = _gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, transitions[i].index), 100);
|
||||
duration = gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, transitions[i].index), 100);
|
||||
delay = gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, transitions[i].index), 100);
|
||||
if (duration + delay == 0.0)
|
||||
continue;
|
||||
|
||||
@@ -815,7 +881,7 @@ gtk_css_animated_style_create_css_transitions (GPtrArray *animations,
|
||||
start = gtk_css_animated_style_get_intrinsic_value ((GtkCssAnimatedStyle *)source, i);
|
||||
end = gtk_css_style_get_value (base_style, i);
|
||||
|
||||
if (_gtk_css_value_equal (start, end))
|
||||
if (gtk_css_value_equal (start, end))
|
||||
{
|
||||
animation = gtk_css_animated_style_find_transition ((GtkCssAnimatedStyle *)source, i);
|
||||
if (animation)
|
||||
@@ -831,8 +897,8 @@ gtk_css_animated_style_create_css_transitions (GPtrArray *animations,
|
||||
}
|
||||
}
|
||||
|
||||
if (_gtk_css_value_equal (gtk_css_style_get_value (source, i),
|
||||
gtk_css_style_get_value (base_style, i)))
|
||||
if (gtk_css_value_equal (gtk_css_style_get_value (source, i),
|
||||
gtk_css_style_get_value (base_style, i)))
|
||||
continue;
|
||||
|
||||
animation = _gtk_css_transition_new (i,
|
||||
@@ -938,13 +1004,13 @@ gtk_css_animated_style_create_css_animations (GPtrArray *animations,
|
||||
animation = _gtk_css_animation_new (name,
|
||||
keyframes,
|
||||
timestamp,
|
||||
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, i), 100) * G_USEC_PER_SEC,
|
||||
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, i), 100) * G_USEC_PER_SEC,
|
||||
gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, i), 100) * G_USEC_PER_SEC,
|
||||
gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, i), 100) * G_USEC_PER_SEC,
|
||||
_gtk_css_array_value_get_nth (timing_functions, i),
|
||||
_gtk_css_direction_value_get (_gtk_css_array_value_get_nth (directions, i)),
|
||||
_gtk_css_play_state_value_get (_gtk_css_array_value_get_nth (play_states, i)),
|
||||
_gtk_css_fill_mode_value_get (_gtk_css_array_value_get_nth (fill_modes, i)),
|
||||
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (iteration_counts, i), 100));
|
||||
gtk_css_number_value_get (_gtk_css_array_value_get_nth (iteration_counts, i), 100));
|
||||
}
|
||||
|
||||
if (!animations)
|
||||
|
||||
@@ -70,9 +70,17 @@ void gtk_css_animated_style_set_animated_value(GtkCssAnimated
|
||||
GtkCssValue * gtk_css_animated_style_get_intrinsic_value (GtkCssAnimatedStyle *style,
|
||||
guint id);
|
||||
|
||||
void gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||
gboolean gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
|
||||
int id,
|
||||
GtkCssVariableValue *value);
|
||||
|
||||
typedef enum {
|
||||
GTK_CSS_ANIMATION_CHANGE_VARIABLES = 1 << 0,
|
||||
GTK_CSS_ANIMATION_CHANGE_COLOR = 1 << 1,
|
||||
} GtkCssAnimationChange;
|
||||
|
||||
void gtk_css_animated_style_recompute (GtkCssAnimatedStyle *style,
|
||||
GtkCssAnimationChange change);
|
||||
GtkCssVariableValue * gtk_css_animated_style_get_intrinsic_custom_value (GtkCssAnimatedStyle *style,
|
||||
int id);
|
||||
|
||||
|
||||
+13
-5
@@ -95,6 +95,7 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
||||
GtkCssKeyframes *resolved_keyframes;
|
||||
double progress;
|
||||
guint i;
|
||||
GtkCssAnimationChange change = 0;
|
||||
|
||||
if (!gtk_css_animation_is_executing (animation))
|
||||
return;
|
||||
@@ -125,7 +126,8 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
||||
if (!value)
|
||||
continue;
|
||||
|
||||
gtk_css_animated_style_set_animated_custom_value (style, variable_id, value);
|
||||
if (gtk_css_animated_style_set_animated_custom_value (style, variable_id, value))
|
||||
change |= GTK_CSS_ANIMATION_CHANGE_VARIABLES;
|
||||
|
||||
gtk_css_variable_value_unref (value);
|
||||
}
|
||||
@@ -134,7 +136,7 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
||||
{
|
||||
GtkCssValue *value;
|
||||
guint property_id;
|
||||
|
||||
|
||||
property_id = _gtk_css_keyframes_get_property_id (resolved_keyframes, i);
|
||||
|
||||
value = _gtk_css_keyframes_get_value (resolved_keyframes,
|
||||
@@ -142,8 +144,14 @@ gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
|
||||
progress,
|
||||
gtk_css_animated_style_get_intrinsic_value (style, property_id));
|
||||
gtk_css_animated_style_set_animated_value (style, property_id, value);
|
||||
|
||||
if (property_id == GTK_CSS_PROPERTY_COLOR)
|
||||
change |= GTK_CSS_ANIMATION_CHANGE_COLOR;
|
||||
}
|
||||
|
||||
if (change != 0)
|
||||
gtk_css_animated_style_recompute (style, change);
|
||||
|
||||
_gtk_css_keyframes_unref (resolved_keyframes);
|
||||
}
|
||||
|
||||
@@ -171,7 +179,7 @@ gtk_css_animation_free (GtkStyleAnimation *animation)
|
||||
|
||||
g_free (self->name);
|
||||
_gtk_css_keyframes_unref (self->keyframes);
|
||||
_gtk_css_value_unref (self->ease);
|
||||
gtk_css_value_unref (self->ease);
|
||||
|
||||
g_free (self);
|
||||
}
|
||||
@@ -211,7 +219,7 @@ _gtk_css_animation_new (const char *name,
|
||||
|
||||
animation->name = g_strdup (name);
|
||||
animation->keyframes = _gtk_css_keyframes_ref (keyframes);
|
||||
animation->ease = _gtk_css_value_ref (ease);
|
||||
animation->ease = gtk_css_value_ref (ease);
|
||||
animation->direction = direction;
|
||||
animation->play_state = play_state;
|
||||
animation->fill_mode = fill_mode;
|
||||
@@ -242,7 +250,7 @@ _gtk_css_animation_advance_with_play_state (GtkCssAnimation *source,
|
||||
|
||||
animation->name = g_strdup (source->name);
|
||||
animation->keyframes = _gtk_css_keyframes_ref (source->keyframes);
|
||||
animation->ease = _gtk_css_value_ref (source->ease);
|
||||
animation->ease = gtk_css_value_ref (source->ease);
|
||||
animation->direction = source->direction;
|
||||
animation->play_state = play_state;
|
||||
animation->fill_mode = source->fill_mode;
|
||||
|
||||
+37
-39
@@ -35,18 +35,15 @@ gtk_css_value_array_free (GtkCssValue *value)
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < value->n_values; i++)
|
||||
_gtk_css_value_unref (value->values[i]);
|
||||
gtk_css_value_unref (value->values[i]);
|
||||
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_array_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_array_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
GtkCssValue *i_value;
|
||||
@@ -55,24 +52,24 @@ gtk_css_value_array_compute (GtkCssValue *value,
|
||||
result = NULL;
|
||||
for (i = 0; i < value->n_values; i++)
|
||||
{
|
||||
i_value = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, variables);
|
||||
i_value = gtk_css_value_compute (value->values[i], property_id, context);
|
||||
|
||||
if (result == NULL &&
|
||||
i_value != value->values[i])
|
||||
{
|
||||
result = _gtk_css_array_value_new_from_array (value->values, value->n_values);
|
||||
for (j = 0; j < i; j++)
|
||||
_gtk_css_value_ref (result->values[j]);
|
||||
gtk_css_value_ref (result->values[j]);
|
||||
}
|
||||
|
||||
if (result != NULL)
|
||||
result->values[i] = i_value;
|
||||
else
|
||||
_gtk_css_value_unref (i_value);
|
||||
gtk_css_value_unref (i_value);
|
||||
}
|
||||
|
||||
if (result == NULL)
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -88,8 +85,8 @@ gtk_css_value_array_equal (const GtkCssValue *value1,
|
||||
|
||||
for (i = 0; i < value1->n_values; i++)
|
||||
{
|
||||
if (!_gtk_css_value_equal (value1->values[i],
|
||||
value2->values[i]))
|
||||
if (!gtk_css_value_equal (value1->values[i],
|
||||
value2->values[i]))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -128,14 +125,14 @@ gtk_css_value_array_transition_repeat (GtkCssValue *start,
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
transitions[i] = _gtk_css_value_transition (start->values[i % start->n_values],
|
||||
end->values[i % end->n_values],
|
||||
property_id,
|
||||
progress);
|
||||
transitions[i] = gtk_css_value_transition (start->values[i % start->n_values],
|
||||
end->values[i % end->n_values],
|
||||
property_id,
|
||||
progress);
|
||||
if (transitions[i] == NULL)
|
||||
{
|
||||
while (i--)
|
||||
_gtk_css_value_unref (transitions[i]);
|
||||
gtk_css_value_unref (transitions[i]);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -169,14 +166,14 @@ gtk_css_value_array_transition_extend (GtkCssValue *start,
|
||||
|
||||
for (i = 0; i < MIN (start->n_values, end->n_values); i++)
|
||||
{
|
||||
transitions[i] = _gtk_css_value_transition (start->values[i],
|
||||
end->values[i],
|
||||
property_id,
|
||||
progress);
|
||||
transitions[i] = gtk_css_value_transition (start->values[i],
|
||||
end->values[i],
|
||||
property_id,
|
||||
progress);
|
||||
if (transitions[i] == NULL)
|
||||
{
|
||||
while (i--)
|
||||
_gtk_css_value_unref (transitions[i]);
|
||||
gtk_css_value_unref (transitions[i]);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -189,28 +186,28 @@ gtk_css_value_array_transition_extend (GtkCssValue *start,
|
||||
|
||||
for (; i < start->n_values; i++)
|
||||
{
|
||||
transitions[i] = _gtk_css_value_transition (start->values[i],
|
||||
default_value,
|
||||
property_id,
|
||||
progress);
|
||||
transitions[i] = gtk_css_value_transition (start->values[i],
|
||||
default_value,
|
||||
property_id,
|
||||
progress);
|
||||
if (transitions[i] == NULL)
|
||||
{
|
||||
while (i--)
|
||||
_gtk_css_value_unref (transitions[i]);
|
||||
gtk_css_value_unref (transitions[i]);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (; i < end->n_values; i++)
|
||||
{
|
||||
transitions[i] = _gtk_css_value_transition (default_value,
|
||||
end->values[i],
|
||||
property_id,
|
||||
progress);
|
||||
transitions[i] = gtk_css_value_transition (default_value,
|
||||
end->values[i],
|
||||
property_id,
|
||||
progress);
|
||||
if (transitions[i] == NULL)
|
||||
{
|
||||
while (i--)
|
||||
_gtk_css_value_unref (transitions[i]);
|
||||
gtk_css_value_unref (transitions[i]);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -328,17 +325,17 @@ gtk_css_value_array_get_dynamic_value (GtkCssValue *value,
|
||||
{
|
||||
result = _gtk_css_array_value_new_from_array (value->values, value->n_values);
|
||||
for (j = 0; j < i; j++)
|
||||
_gtk_css_value_ref (result->values[j]);
|
||||
gtk_css_value_ref (result->values[j]);
|
||||
}
|
||||
|
||||
if (result != NULL)
|
||||
result->values[i] = i_value;
|
||||
else
|
||||
_gtk_css_value_unref (i_value);
|
||||
gtk_css_value_unref (i_value);
|
||||
}
|
||||
|
||||
if (result == NULL)
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -359,7 +356,7 @@ gtk_css_value_array_print (const GtkCssValue *value,
|
||||
{
|
||||
if (i > 0)
|
||||
g_string_append (string, ", ");
|
||||
_gtk_css_value_print (value->values[i], string);
|
||||
gtk_css_value_print (value->values[i], string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -395,11 +392,12 @@ _gtk_css_array_value_new_from_array (GtkCssValue **values,
|
||||
if (n_values == 1)
|
||||
return values[0];
|
||||
|
||||
result = _gtk_css_value_alloc (>K_CSS_VALUE_ARRAY, sizeof (GtkCssValue) + sizeof (GtkCssValue *) * (n_values - 1));
|
||||
result = gtk_css_value_alloc (>K_CSS_VALUE_ARRAY, sizeof (GtkCssValue) + sizeof (GtkCssValue *) * (n_values - 1));
|
||||
result->n_values = n_values;
|
||||
memcpy (&result->values[0], values, sizeof (GtkCssValue *) * n_values);
|
||||
|
||||
result->is_computed = TRUE;
|
||||
result->contains_variables = FALSE;
|
||||
for (i = 0; i < n_values; i ++)
|
||||
{
|
||||
if (!gtk_css_value_is_computed (values[i]))
|
||||
@@ -430,7 +428,7 @@ _gtk_css_array_value_parse (GtkCssParser *parser,
|
||||
if (value == NULL)
|
||||
{
|
||||
for (i = 0; i < n_values; i ++)
|
||||
_gtk_css_value_unref (values[i]);
|
||||
gtk_css_value_unref (values[i]);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+35
-38
@@ -33,42 +33,39 @@ static void
|
||||
gtk_css_value_bg_size_free (GtkCssValue *value)
|
||||
{
|
||||
if (value->x)
|
||||
_gtk_css_value_unref (value->x);
|
||||
gtk_css_value_unref (value->x);
|
||||
if (value->y)
|
||||
_gtk_css_value_unref (value->y);
|
||||
gtk_css_value_unref (value->y);
|
||||
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_bg_size_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_bg_size_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
if (value->x == NULL && value->y == NULL)
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
|
||||
x = y = NULL;
|
||||
|
||||
if (value->x)
|
||||
x = _gtk_css_value_compute (value->x, property_id, provider, style, parent_style, variables);
|
||||
x = gtk_css_value_compute (value->x, property_id, context);
|
||||
|
||||
if (value->y)
|
||||
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style, variables);
|
||||
y = gtk_css_value_compute (value->y, property_id, context);
|
||||
|
||||
if (x == value->x && y == value->y)
|
||||
{
|
||||
if (x)
|
||||
_gtk_css_value_unref (x);
|
||||
gtk_css_value_unref (x);
|
||||
if (y)
|
||||
_gtk_css_value_unref (y);
|
||||
gtk_css_value_unref (y);
|
||||
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
return _gtk_css_bg_size_value_new (value->x ? x : NULL,
|
||||
@@ -83,10 +80,10 @@ gtk_css_value_bg_size_equal (const GtkCssValue *value1,
|
||||
value1->contain == value2->contain &&
|
||||
(value1->x == value2->x ||
|
||||
(value1->x != NULL && value2->x != NULL &&
|
||||
_gtk_css_value_equal (value1->x, value2->x))) &&
|
||||
gtk_css_value_equal (value1->x, value2->x))) &&
|
||||
(value1->y == value2->y ||
|
||||
(value1->y != NULL && value2->y != NULL &&
|
||||
_gtk_css_value_equal (value1->y, value2->y)));
|
||||
gtk_css_value_equal (value1->y, value2->y)));
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -98,9 +95,9 @@ gtk_css_value_bg_size_transition (GtkCssValue *start,
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
if (start->cover)
|
||||
return end->cover ? _gtk_css_value_ref (end) : NULL;
|
||||
return end->cover ? gtk_css_value_ref (end) : NULL;
|
||||
if (start->contain)
|
||||
return end->contain ? _gtk_css_value_ref (end) : NULL;
|
||||
return end->contain ? gtk_css_value_ref (end) : NULL;
|
||||
|
||||
if ((start->x != NULL) ^ (end->x != NULL) ||
|
||||
(start->y != NULL) ^ (end->y != NULL))
|
||||
@@ -108,7 +105,7 @@ gtk_css_value_bg_size_transition (GtkCssValue *start,
|
||||
|
||||
if (start->x)
|
||||
{
|
||||
x = _gtk_css_value_transition (start->x, end->x, property_id, progress);
|
||||
x = gtk_css_value_transition (start->x, end->x, property_id, progress);
|
||||
if (x == NULL)
|
||||
return NULL;
|
||||
}
|
||||
@@ -117,10 +114,10 @@ gtk_css_value_bg_size_transition (GtkCssValue *start,
|
||||
|
||||
if (start->y)
|
||||
{
|
||||
y = _gtk_css_value_transition (start->y, end->y, property_id, progress);
|
||||
y = gtk_css_value_transition (start->y, end->y, property_id, progress);
|
||||
if (y == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
gtk_css_value_unref (x);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -143,12 +140,12 @@ gtk_css_value_bg_size_print (const GtkCssValue *value,
|
||||
if (value->x == NULL)
|
||||
g_string_append (string, "auto");
|
||||
else
|
||||
_gtk_css_value_print (value->x, string);
|
||||
gtk_css_value_print (value->x, string);
|
||||
|
||||
if (value->y)
|
||||
{
|
||||
g_string_append_c (string, ' ');
|
||||
_gtk_css_value_print (value->y, string);
|
||||
gtk_css_value_print (value->y, string);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -175,9 +172,9 @@ _gtk_css_bg_size_value_new (GtkCssValue *x,
|
||||
GtkCssValue *result;
|
||||
|
||||
if (x == NULL && y == NULL)
|
||||
return _gtk_css_value_ref (&auto_singleton);
|
||||
return gtk_css_value_ref (&auto_singleton);
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_BG_SIZE);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_BG_SIZE);
|
||||
result->x = x;
|
||||
result->y = y;
|
||||
result->is_computed = (!x || gtk_css_value_is_computed (x)) &&
|
||||
@@ -192,18 +189,18 @@ _gtk_css_bg_size_value_parse (GtkCssParser *parser)
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
if (gtk_css_parser_try_ident (parser, "cover"))
|
||||
return _gtk_css_value_ref (&cover_singleton);
|
||||
return gtk_css_value_ref (&cover_singleton);
|
||||
else if (gtk_css_parser_try_ident (parser, "contain"))
|
||||
return _gtk_css_value_ref (&contain_singleton);
|
||||
return gtk_css_value_ref (&contain_singleton);
|
||||
|
||||
if (gtk_css_parser_try_ident (parser, "auto"))
|
||||
x = NULL;
|
||||
else
|
||||
{
|
||||
x = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
x = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
if (x == NULL)
|
||||
return NULL;
|
||||
}
|
||||
@@ -214,13 +211,13 @@ _gtk_css_bg_size_value_parse (GtkCssParser *parser)
|
||||
y = NULL;
|
||||
else
|
||||
{
|
||||
y = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
y = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
if (y == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
gtk_css_value_unref (x);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -283,8 +280,8 @@ _gtk_css_bg_size_value_compute_size (const GtkCssValue *value,
|
||||
double x, y;
|
||||
|
||||
/* note: 0 does the right thing later for 'auto' */
|
||||
x = value->x ? _gtk_css_number_value_get (value->x, area_width) : 0;
|
||||
y = value->y ? _gtk_css_number_value_get (value->y, area_height) : 0;
|
||||
x = value->x ? gtk_css_number_value_get (value->x, area_width) : 0;
|
||||
y = value->y ? gtk_css_number_value_get (value->y, area_height) : 0;
|
||||
|
||||
if ((x <= 0 && value->x) ||
|
||||
(y <= 0 && value->y))
|
||||
|
||||
+17
-20
@@ -35,19 +35,16 @@ gtk_css_value_border_free (GtkCssValue *value)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (value->values[i])
|
||||
_gtk_css_value_unref (value->values[i]);
|
||||
gtk_css_value_unref (value->values[i]);
|
||||
}
|
||||
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_border_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_border_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *values[4];
|
||||
GtkCssValue *computed;
|
||||
@@ -58,7 +55,7 @@ gtk_css_value_border_compute (GtkCssValue *value,
|
||||
{
|
||||
if (value->values[i])
|
||||
{
|
||||
values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style, variables);
|
||||
values[i] = gtk_css_value_compute (value->values[i], property_id, context);
|
||||
changed |= (values[i] != value->values[i]);
|
||||
}
|
||||
else
|
||||
@@ -72,9 +69,9 @@ gtk_css_value_border_compute (GtkCssValue *value,
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (values[i] != NULL)
|
||||
_gtk_css_value_unref (values[i]);
|
||||
gtk_css_value_unref (values[i]);
|
||||
}
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
computed = _gtk_css_border_value_new (values[0], values[1], values[2], values[3]);
|
||||
@@ -94,7 +91,7 @@ gtk_css_value_border_equal (const GtkCssValue *value1,
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (!_gtk_css_value_equal0 (value1->values[i], value2->values[i]))
|
||||
if (!gtk_css_value_equal0 (value1->values[i], value2->values[i]))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -116,11 +113,11 @@ gtk_css_value_border_print (const GtkCssValue *value,
|
||||
{
|
||||
guint i, n;
|
||||
|
||||
if (!_gtk_css_value_equal0 (value->values[GTK_CSS_RIGHT], value->values[GTK_CSS_LEFT]))
|
||||
if (!gtk_css_value_equal0 (value->values[GTK_CSS_RIGHT], value->values[GTK_CSS_LEFT]))
|
||||
n = 4;
|
||||
else if (!_gtk_css_value_equal0 (value->values[GTK_CSS_TOP], value->values[GTK_CSS_BOTTOM]))
|
||||
else if (!gtk_css_value_equal0 (value->values[GTK_CSS_TOP], value->values[GTK_CSS_BOTTOM]))
|
||||
n = 3;
|
||||
else if (!_gtk_css_value_equal0 (value->values[GTK_CSS_TOP], value->values[GTK_CSS_RIGHT]))
|
||||
else if (!gtk_css_value_equal0 (value->values[GTK_CSS_TOP], value->values[GTK_CSS_RIGHT]))
|
||||
n = 2;
|
||||
else
|
||||
n = 1;
|
||||
@@ -133,7 +130,7 @@ gtk_css_value_border_print (const GtkCssValue *value,
|
||||
if (value->values[i] == NULL)
|
||||
g_string_append (string, "auto");
|
||||
else
|
||||
_gtk_css_value_print (value->values[i], string);
|
||||
gtk_css_value_print (value->values[i], string);
|
||||
}
|
||||
|
||||
if (value->fill)
|
||||
@@ -159,7 +156,7 @@ _gtk_css_border_value_new (GtkCssValue *top,
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_BORDER);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_BORDER);
|
||||
result->values[GTK_CSS_TOP] = top;
|
||||
result->values[GTK_CSS_RIGHT] = right;
|
||||
result->values[GTK_CSS_BOTTOM] = bottom;
|
||||
@@ -194,10 +191,10 @@ _gtk_css_border_value_parse (GtkCssParser *parser,
|
||||
if (!gtk_css_number_value_can_parse (parser))
|
||||
break;
|
||||
|
||||
result->values[i] = _gtk_css_number_value_parse (parser, flags);
|
||||
result->values[i] = gtk_css_number_value_parse (parser, flags);
|
||||
if (result->values[i] == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (result);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -205,7 +202,7 @@ _gtk_css_border_value_parse (GtkCssParser *parser,
|
||||
if (i == 0)
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected a number");
|
||||
_gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -215,7 +212,7 @@ _gtk_css_border_value_parse (GtkCssParser *parser,
|
||||
for (; i < 4; i++)
|
||||
{
|
||||
if (result->values[(i - 1) >> 1])
|
||||
result->values[i] = _gtk_css_value_ref (result->values[(i - 1) >> 1]);
|
||||
result->values[i] = gtk_css_value_ref (result->values[(i - 1) >> 1]);
|
||||
}
|
||||
|
||||
result->is_computed = TRUE;
|
||||
|
||||
@@ -84,17 +84,17 @@ gtk_css_boxes_rect_grow (GskRoundedRect *dest,
|
||||
if (gtk_css_dimension_value_is_zero (right))
|
||||
dest->bounds.size.width = src->bounds.size.width;
|
||||
else
|
||||
dest->bounds.size.width = src->bounds.size.width + _gtk_css_number_value_get (right, 100);
|
||||
dest->bounds.size.width = src->bounds.size.width + gtk_css_number_value_get (right, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
const double left_value = _gtk_css_number_value_get (left, 100);
|
||||
const double left_value = gtk_css_number_value_get (left, 100);
|
||||
|
||||
dest->bounds.origin.x = src->bounds.origin.x - left_value;
|
||||
if (gtk_css_dimension_value_is_zero (right))
|
||||
dest->bounds.size.width = src->bounds.size.width + left_value;
|
||||
else
|
||||
dest->bounds.size.width = src->bounds.size.width + left_value + _gtk_css_number_value_get (right, 100);
|
||||
dest->bounds.size.width = src->bounds.size.width + left_value + gtk_css_number_value_get (right, 100);
|
||||
|
||||
}
|
||||
|
||||
@@ -105,17 +105,17 @@ gtk_css_boxes_rect_grow (GskRoundedRect *dest,
|
||||
if (gtk_css_dimension_value_is_zero (bottom))
|
||||
dest->bounds.size.height = src->bounds.size.height;
|
||||
else
|
||||
dest->bounds.size.height = src->bounds.size.height + _gtk_css_number_value_get (bottom, 100);
|
||||
dest->bounds.size.height = src->bounds.size.height + gtk_css_number_value_get (bottom, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
const double top_value = _gtk_css_number_value_get (top, 100);
|
||||
const double top_value = gtk_css_number_value_get (top, 100);
|
||||
|
||||
dest->bounds.origin.y = src->bounds.origin.y - top_value;
|
||||
if (gtk_css_dimension_value_is_zero (bottom))
|
||||
dest->bounds.size.height = src->bounds.size.height + top_value;
|
||||
else
|
||||
dest->bounds.size.height = src->bounds.size.height + top_value + _gtk_css_number_value_get (bottom, 100);
|
||||
dest->bounds.size.height = src->bounds.size.height + top_value + gtk_css_number_value_get (bottom, 100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,10 +127,10 @@ gtk_css_boxes_rect_shrink (GskRoundedRect *dest,
|
||||
GtkCssValue *bottom_value,
|
||||
GtkCssValue *left_value)
|
||||
{
|
||||
double top = _gtk_css_number_value_get (top_value, 100);
|
||||
double right = _gtk_css_number_value_get (right_value, 100);
|
||||
double bottom = _gtk_css_number_value_get (bottom_value, 100);
|
||||
double left = _gtk_css_number_value_get (left_value, 100);
|
||||
double top = gtk_css_number_value_get (top_value, 100);
|
||||
double right = gtk_css_number_value_get (right_value, 100);
|
||||
double bottom = gtk_css_number_value_get (bottom_value, 100);
|
||||
double left = gtk_css_number_value_get (left_value, 100);
|
||||
|
||||
/* FIXME: Do we need underflow checks here? */
|
||||
dest->bounds.origin.x = src->bounds.origin.x + left;
|
||||
@@ -255,8 +255,8 @@ gtk_css_boxes_compute_outline_rect (GtkCssBoxes *boxes)
|
||||
dest = &boxes->box[GTK_CSS_AREA_OUTLINE_BOX].bounds;
|
||||
src = &boxes->box[GTK_CSS_AREA_BORDER_BOX].bounds;
|
||||
|
||||
d = _gtk_css_number_value_get (boxes->style->outline->outline_offset, 100) +
|
||||
_gtk_css_number_value_get (boxes->style->outline->outline_width, 100);
|
||||
d = gtk_css_number_value_get (boxes->style->outline->outline_offset, 100) +
|
||||
gtk_css_number_value_get (boxes->style->outline->outline_width, 100);
|
||||
|
||||
dest->origin.x = src->origin.x - d;
|
||||
dest->origin.y = src->origin.y - d;
|
||||
@@ -483,8 +483,8 @@ gtk_css_boxes_compute_outline_box (GtkCssBoxes *boxes)
|
||||
src = &boxes->box[GTK_CSS_AREA_BORDER_BOX];
|
||||
dest = &boxes->box[GTK_CSS_AREA_OUTLINE_BOX];
|
||||
|
||||
d = _gtk_css_number_value_get (boxes->style->outline->outline_offset, 100) +
|
||||
_gtk_css_number_value_get (boxes->style->outline->outline_width, 100);
|
||||
d = gtk_css_number_value_get (boxes->style->outline->outline_offset, 100) +
|
||||
gtk_css_number_value_get (boxes->style->outline->outline_width, 100);
|
||||
|
||||
/* Grow border rect into outline rect */
|
||||
dest->bounds.origin.x = src->bounds.origin.x - d;
|
||||
|
||||
+317
-13
@@ -60,7 +60,7 @@ gtk_css_calc_value_parse_value (GtkCssParser *parser,
|
||||
return result;
|
||||
}
|
||||
|
||||
return _gtk_css_number_value_parse (parser, flags);
|
||||
return gtk_css_number_value_parse (parser, flags);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -96,11 +96,11 @@ gtk_css_calc_value_parse_product (GtkCssParser *parser,
|
||||
if (value == NULL)
|
||||
goto fail;
|
||||
if (is_number (value))
|
||||
temp = gtk_css_number_value_multiply (result, _gtk_css_number_value_get (value, 100));
|
||||
temp = gtk_css_number_value_multiply (result, gtk_css_number_value_get (value, 100));
|
||||
else
|
||||
temp = gtk_css_number_value_multiply (value, _gtk_css_number_value_get (result, 100));
|
||||
_gtk_css_value_unref (value);
|
||||
_gtk_css_value_unref (result);
|
||||
temp = gtk_css_number_value_multiply (value, gtk_css_number_value_get (result, 100));
|
||||
gtk_css_value_unref (value);
|
||||
gtk_css_value_unref (result);
|
||||
result = temp;
|
||||
}
|
||||
else if (gtk_css_parser_try_delim (parser, '/'))
|
||||
@@ -108,9 +108,9 @@ gtk_css_calc_value_parse_product (GtkCssParser *parser,
|
||||
value = gtk_css_calc_value_parse_product (parser, GTK_CSS_PARSE_NUMBER);
|
||||
if (value == NULL)
|
||||
goto fail;
|
||||
temp = gtk_css_number_value_multiply (result, 1.0 / _gtk_css_number_value_get (value, 100));
|
||||
_gtk_css_value_unref (value);
|
||||
_gtk_css_value_unref (result);
|
||||
temp = gtk_css_number_value_multiply (result, 1.0 / gtk_css_number_value_get (value, 100));
|
||||
gtk_css_value_unref (value);
|
||||
gtk_css_value_unref (result);
|
||||
result = temp;
|
||||
}
|
||||
else
|
||||
@@ -132,7 +132,7 @@ gtk_css_calc_value_parse_product (GtkCssParser *parser,
|
||||
return result;
|
||||
|
||||
fail:
|
||||
_gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ gtk_css_calc_value_parse_sum (GtkCssParser *parser,
|
||||
if (temp == NULL)
|
||||
goto fail;
|
||||
next = gtk_css_number_value_multiply (temp, -1);
|
||||
_gtk_css_value_unref (temp);
|
||||
gtk_css_value_unref (temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -178,15 +178,15 @@ gtk_css_calc_value_parse_sum (GtkCssParser *parser,
|
||||
}
|
||||
|
||||
temp = gtk_css_number_value_add (result, next);
|
||||
_gtk_css_value_unref (result);
|
||||
_gtk_css_value_unref (next);
|
||||
gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (next);
|
||||
result = temp;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
fail:
|
||||
_gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -232,3 +232,307 @@ gtk_css_calc_value_parse (GtkCssParser *parser,
|
||||
return data.value;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkCssNumberParseFlags flags;
|
||||
GPtrArray *values;
|
||||
} ParseArgnData;
|
||||
|
||||
static guint
|
||||
gtk_css_argn_value_parse_arg (GtkCssParser *parser,
|
||||
guint arg,
|
||||
gpointer data_)
|
||||
{
|
||||
ParseArgnData *data = data_;
|
||||
GtkCssValue *value;
|
||||
|
||||
value = gtk_css_calc_value_parse_sum (parser, data->flags);
|
||||
if (value == NULL)
|
||||
return 0;
|
||||
|
||||
g_ptr_array_add (data->values, value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkCssNumberParseFlags flags;
|
||||
GtkCssValue *values[3];
|
||||
} ParseClampData;
|
||||
|
||||
static guint
|
||||
gtk_css_clamp_value_parse_arg (GtkCssParser *parser,
|
||||
guint arg,
|
||||
gpointer data_)
|
||||
{
|
||||
ParseClampData *data = data_;
|
||||
|
||||
if ((arg == 0 || arg == 2))
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, "none"))
|
||||
{
|
||||
data->values[arg] = NULL;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
data->values[arg] = gtk_css_calc_value_parse_sum (parser, data->flags);
|
||||
if (data->values[arg] == NULL)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
gtk_css_clamp_value_parse (GtkCssParser *parser,
|
||||
GtkCssNumberParseFlags flags,
|
||||
guint type)
|
||||
{
|
||||
ParseClampData data;
|
||||
GtkCssValue *result = NULL;
|
||||
|
||||
if (!gtk_css_parser_has_function (parser, "clamp"))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected 'clamp('");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This can only be handled at compute time, we allow '-' after all */
|
||||
data.flags = flags & ~GTK_CSS_POSITIVE_ONLY;
|
||||
data.values[0] = NULL;
|
||||
data.values[1] = NULL;
|
||||
data.values[2] = NULL;
|
||||
|
||||
if (gtk_css_parser_consume_function (parser, 3, 3, gtk_css_clamp_value_parse_arg, &data))
|
||||
{
|
||||
GtkCssDimension dim = gtk_css_number_value_get_dimension (data.values[1]);
|
||||
if ((data.values[0] && gtk_css_number_value_get_dimension (data.values[0]) != dim) ||
|
||||
(data.values[2] && gtk_css_number_value_get_dimension (data.values[2]) != dim))
|
||||
gtk_css_parser_error_syntax (parser, "Inconsistent types in 'clamp('");
|
||||
else
|
||||
result = gtk_css_math_value_new (type, 0, data.values, 3);
|
||||
}
|
||||
|
||||
if (result == NULL)
|
||||
{
|
||||
g_clear_pointer (&data.values[0], gtk_css_value_unref);
|
||||
g_clear_pointer (&data.values[1], gtk_css_value_unref);
|
||||
g_clear_pointer (&data.values[2], gtk_css_value_unref);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GtkCssNumberParseFlags flags;
|
||||
guint mode;
|
||||
gboolean has_mode;
|
||||
GtkCssValue *values[2];
|
||||
} ParseRoundData;
|
||||
|
||||
static guint
|
||||
gtk_css_round_value_parse_arg (GtkCssParser *parser,
|
||||
guint arg,
|
||||
gpointer data_)
|
||||
{
|
||||
ParseRoundData *data = data_;
|
||||
|
||||
if (arg == 0)
|
||||
{
|
||||
const char *modes[] = { "nearest", "up", "down", "to-zero" };
|
||||
|
||||
for (guint i = 0; i < G_N_ELEMENTS (modes); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, modes[i]))
|
||||
{
|
||||
data->mode = i;
|
||||
data->has_mode = TRUE;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
data->values[0] = gtk_css_calc_value_parse_sum (parser, data->flags);
|
||||
if (data->values[0] == NULL)
|
||||
return 0;
|
||||
}
|
||||
else if (arg == 1)
|
||||
{
|
||||
GtkCssValue *value = gtk_css_calc_value_parse_sum (parser, data->flags);
|
||||
|
||||
if (value == NULL)
|
||||
return 0;
|
||||
|
||||
if (data->has_mode)
|
||||
data->values[0] = value;
|
||||
else
|
||||
data->values[1] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!data->has_mode)
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Too many argument for 'round'");
|
||||
return 0;
|
||||
}
|
||||
|
||||
data->values[1] = gtk_css_calc_value_parse_sum (parser, data->flags);
|
||||
|
||||
if (data->values[1] == NULL)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
gtk_css_round_value_parse (GtkCssParser *parser,
|
||||
GtkCssNumberParseFlags flags,
|
||||
guint type)
|
||||
{
|
||||
ParseRoundData data;
|
||||
GtkCssValue *result = NULL;
|
||||
|
||||
if (!gtk_css_parser_has_function (parser, "round"))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected 'round('");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data.flags = flags & ~GTK_CSS_POSITIVE_ONLY;
|
||||
data.mode = ROUND_NEAREST;
|
||||
data.has_mode = FALSE;
|
||||
data.values[0] = NULL;
|
||||
data.values[1] = NULL;
|
||||
|
||||
if (gtk_css_parser_consume_function (parser, 1, 3, gtk_css_round_value_parse_arg, &data) &&
|
||||
data.values[0] != NULL)
|
||||
{
|
||||
if (data.values[1] != NULL &&
|
||||
gtk_css_number_value_get_dimension (data.values[0]) !=
|
||||
gtk_css_number_value_get_dimension (data.values[1]))
|
||||
gtk_css_parser_error_syntax (parser, "Inconsistent types in 'round('");
|
||||
else if (data.values[1] == NULL &&
|
||||
gtk_css_number_value_get_dimension (data.values[0]) != GTK_CSS_DIMENSION_NUMBER)
|
||||
gtk_css_parser_error_syntax (parser, "Can't omit second argument to 'round(' here");
|
||||
else
|
||||
result = gtk_css_math_value_new (type, data.mode, data.values, data.values[1] != NULL ? 2 : 1);
|
||||
}
|
||||
|
||||
if (result == NULL)
|
||||
{
|
||||
g_clear_pointer (&data.values[0], gtk_css_value_unref);
|
||||
g_clear_pointer (&data.values[1], gtk_css_value_unref);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GtkCssNumberParseFlags flags;
|
||||
GtkCssValue *values[2];
|
||||
} ParseArg2Data;
|
||||
|
||||
static guint
|
||||
gtk_css_arg2_value_parse_arg (GtkCssParser *parser,
|
||||
guint arg,
|
||||
gpointer data_)
|
||||
{
|
||||
ParseArg2Data *data = data_;
|
||||
|
||||
data->values[arg] = gtk_css_calc_value_parse_sum (parser, data->flags);
|
||||
if (data->values[arg] == NULL)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
gtk_css_arg2_value_parse (GtkCssParser *parser,
|
||||
GtkCssNumberParseFlags flags,
|
||||
guint min_args,
|
||||
guint max_args,
|
||||
const char *function,
|
||||
guint type)
|
||||
{
|
||||
ParseArg2Data data;
|
||||
GtkCssValue *result = NULL;
|
||||
|
||||
g_assert (1 <= min_args && min_args <= max_args && max_args <= 2);
|
||||
|
||||
if (!gtk_css_parser_has_function (parser, function))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected '%s('", function);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data.flags = flags & ~GTK_CSS_POSITIVE_ONLY;
|
||||
data.values[0] = NULL;
|
||||
data.values[1] = NULL;
|
||||
|
||||
if (gtk_css_parser_consume_function (parser, min_args, max_args, gtk_css_arg2_value_parse_arg, &data))
|
||||
{
|
||||
if (data.values[1] != NULL &&
|
||||
gtk_css_number_value_get_dimension (data.values[0]) !=
|
||||
gtk_css_number_value_get_dimension (data.values[1]))
|
||||
gtk_css_parser_error_syntax (parser, "Inconsistent types in '%s('", function);
|
||||
else
|
||||
result = gtk_css_math_value_new (type, 0, data.values, data.values[1] != NULL ? 2 : 1);
|
||||
}
|
||||
|
||||
if (result == NULL)
|
||||
{
|
||||
g_clear_pointer (&data.values[0], gtk_css_value_unref);
|
||||
g_clear_pointer (&data.values[1], gtk_css_value_unref);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
gtk_css_argn_value_parse (GtkCssParser *parser,
|
||||
GtkCssNumberParseFlags flags,
|
||||
const char *function,
|
||||
guint type)
|
||||
{
|
||||
ParseArgnData data;
|
||||
GtkCssValue *result = NULL;
|
||||
|
||||
if (!gtk_css_parser_has_function (parser, function))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Expected '%s('", function);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This can only be handled at compute time, we allow '-' after all */
|
||||
data.flags = flags & ~GTK_CSS_POSITIVE_ONLY;
|
||||
data.values = g_ptr_array_new ();
|
||||
|
||||
if (gtk_css_parser_consume_function (parser, 1, G_MAXUINT, gtk_css_argn_value_parse_arg, &data))
|
||||
{
|
||||
GtkCssValue *val = (GtkCssValue *) g_ptr_array_index (data.values, 0);
|
||||
GtkCssDimension dim = gtk_css_number_value_get_dimension (val);
|
||||
guint i;
|
||||
for (i = 1; i < data.values->len; i++)
|
||||
{
|
||||
val = (GtkCssValue *) g_ptr_array_index (data.values, i);
|
||||
if (gtk_css_number_value_get_dimension (val) != dim)
|
||||
break;
|
||||
}
|
||||
if (i < data.values->len)
|
||||
gtk_css_parser_error_syntax (parser, "Inconsistent types in '%s('", function);
|
||||
else
|
||||
result = gtk_css_math_value_new (type, 0, (GtkCssValue **)data.values->pdata, data.values->len);
|
||||
}
|
||||
|
||||
if (result == NULL)
|
||||
{
|
||||
for (guint i = 0; i < data.values->len; i++)
|
||||
gtk_css_value_unref ((GtkCssValue *)g_ptr_array_index (data.values, i));
|
||||
}
|
||||
|
||||
g_ptr_array_unref (data.values);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,21 @@ G_BEGIN_DECLS
|
||||
|
||||
GtkCssValue * gtk_css_calc_value_parse (GtkCssParser *parser,
|
||||
GtkCssNumberParseFlags flags);
|
||||
GtkCssValue * gtk_css_clamp_value_parse (GtkCssParser *parser,
|
||||
GtkCssNumberParseFlags flags,
|
||||
guint type);
|
||||
GtkCssValue * gtk_css_round_value_parse (GtkCssParser *parser,
|
||||
GtkCssNumberParseFlags flags,
|
||||
guint type);
|
||||
GtkCssValue * gtk_css_arg2_value_parse (GtkCssParser *parser,
|
||||
GtkCssNumberParseFlags flags,
|
||||
guint min_args,
|
||||
guint max_args,
|
||||
const char *function,
|
||||
guint type);
|
||||
GtkCssValue * gtk_css_argn_value_parse (GtkCssParser *parser,
|
||||
GtkCssNumberParseFlags flags,
|
||||
const char *function,
|
||||
guint type);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+746
-166
File diff suppressed because it is too large
Load Diff
@@ -27,24 +27,23 @@ G_BEGIN_DECLS
|
||||
|
||||
GtkCssValue * gtk_css_color_value_new_transparent (void) G_GNUC_PURE;
|
||||
GtkCssValue * gtk_css_color_value_new_white (void) G_GNUC_PURE;
|
||||
GtkCssValue * _gtk_css_color_value_new_literal (const GdkRGBA *color) G_GNUC_PURE;
|
||||
GtkCssValue * _gtk_css_color_value_new_name (const char *name) G_GNUC_PURE;
|
||||
GtkCssValue * _gtk_css_color_value_new_shade (GtkCssValue *color,
|
||||
GtkCssValue * gtk_css_color_value_new_literal (const GdkRGBA *color) G_GNUC_PURE;
|
||||
GtkCssValue * gtk_css_color_value_new_name (const char *name) G_GNUC_PURE;
|
||||
GtkCssValue * gtk_css_color_value_new_shade (GtkCssValue *color,
|
||||
double factor) G_GNUC_PURE;
|
||||
GtkCssValue * _gtk_css_color_value_new_alpha (GtkCssValue *color,
|
||||
GtkCssValue * gtk_css_color_value_new_alpha (GtkCssValue *color,
|
||||
double factor) G_GNUC_PURE;
|
||||
GtkCssValue * _gtk_css_color_value_new_mix (GtkCssValue *color1,
|
||||
GtkCssValue * gtk_css_color_value_new_mix (GtkCssValue *color1,
|
||||
GtkCssValue *color2,
|
||||
double factor) G_GNUC_PURE;
|
||||
GtkCssValue * _gtk_css_color_value_new_current_color (void) G_GNUC_PURE;
|
||||
GtkCssValue * gtk_css_color_value_new_current_color (void) G_GNUC_PURE;
|
||||
|
||||
gboolean gtk_css_color_value_can_parse (GtkCssParser *parser);
|
||||
GtkCssValue * _gtk_css_color_value_parse (GtkCssParser *parser);
|
||||
GtkCssValue * gtk_css_color_value_parse (GtkCssParser *parser);
|
||||
|
||||
GtkCssValue * _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
GtkCssValue * gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssValue *current,
|
||||
GSList *cycle_list);
|
||||
GtkCssValue *current);
|
||||
const GdkRGBA * gtk_css_color_value_get_rgba (const GtkCssValue *color) G_GNUC_CONST;
|
||||
|
||||
|
||||
|
||||
+31
-34
@@ -30,29 +30,26 @@ struct _GtkCssValue {
|
||||
static void
|
||||
gtk_css_value_corner_free (GtkCssValue *value)
|
||||
{
|
||||
_gtk_css_value_unref (value->x);
|
||||
_gtk_css_value_unref (value->y);
|
||||
gtk_css_value_unref (value->x);
|
||||
gtk_css_value_unref (value->y);
|
||||
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_corner_compute (GtkCssValue *corner,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_corner_compute (GtkCssValue *corner,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
x = _gtk_css_value_compute (corner->x, property_id, provider, style, parent_style, variables);
|
||||
y = _gtk_css_value_compute (corner->y, property_id, provider, style, parent_style, variables);
|
||||
x = gtk_css_value_compute (corner->x, property_id, context);
|
||||
y = gtk_css_value_compute (corner->y, property_id, context);
|
||||
if (x == corner->x && y == corner->y)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
_gtk_css_value_unref (y);
|
||||
return _gtk_css_value_ref (corner);
|
||||
gtk_css_value_unref (x);
|
||||
gtk_css_value_unref (y);
|
||||
return gtk_css_value_ref (corner);
|
||||
}
|
||||
|
||||
return _gtk_css_corner_value_new (x, y);
|
||||
@@ -62,8 +59,8 @@ static gboolean
|
||||
gtk_css_value_corner_equal (const GtkCssValue *corner1,
|
||||
const GtkCssValue *corner2)
|
||||
{
|
||||
return _gtk_css_value_equal (corner1->x, corner2->x)
|
||||
&& _gtk_css_value_equal (corner1->y, corner2->y);
|
||||
return gtk_css_value_equal (corner1->x, corner2->x)
|
||||
&& gtk_css_value_equal (corner1->y, corner2->y);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -74,13 +71,13 @@ gtk_css_value_corner_transition (GtkCssValue *start,
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
x = _gtk_css_value_transition (start->x, end->x, property_id, progress);
|
||||
x = gtk_css_value_transition (start->x, end->x, property_id, progress);
|
||||
if (x == NULL)
|
||||
return NULL;
|
||||
y = _gtk_css_value_transition (start->y, end->y, property_id, progress);
|
||||
y = gtk_css_value_transition (start->y, end->y, property_id, progress);
|
||||
if (y == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
gtk_css_value_unref (x);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -91,11 +88,11 @@ static void
|
||||
gtk_css_value_corner_print (const GtkCssValue *corner,
|
||||
GString *string)
|
||||
{
|
||||
_gtk_css_value_print (corner->x, string);
|
||||
if (!_gtk_css_value_equal (corner->x, corner->y))
|
||||
gtk_css_value_print (corner->x, string);
|
||||
if (!gtk_css_value_equal (corner->x, corner->y))
|
||||
{
|
||||
g_string_append_c (string, ' ');
|
||||
_gtk_css_value_print (corner->y, string);
|
||||
gtk_css_value_print (corner->y, string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +158,7 @@ _gtk_css_corner_value_new (GtkCssValue *x,
|
||||
}
|
||||
}
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_CORNER);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_CORNER);
|
||||
result->x = x;
|
||||
result->y = y;
|
||||
|
||||
@@ -173,24 +170,24 @@ _gtk_css_corner_value_parse (GtkCssParser *parser)
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
x = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
x = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
if (x == NULL)
|
||||
return NULL;
|
||||
|
||||
if (!gtk_css_number_value_can_parse (parser))
|
||||
y = _gtk_css_value_ref (x);
|
||||
y = gtk_css_value_ref (x);
|
||||
else
|
||||
{
|
||||
y = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
y = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
if (y == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
gtk_css_value_unref (x);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -205,7 +202,7 @@ _gtk_css_corner_value_get_x (const GtkCssValue *corner,
|
||||
g_return_val_if_fail (corner != NULL, 0.0);
|
||||
g_return_val_if_fail (corner->class == >K_CSS_VALUE_CORNER, 0.0);
|
||||
|
||||
return _gtk_css_number_value_get (corner->x, one_hundred_percent);
|
||||
return gtk_css_number_value_get (corner->x, one_hundred_percent);
|
||||
}
|
||||
|
||||
double
|
||||
@@ -215,7 +212,7 @@ _gtk_css_corner_value_get_y (const GtkCssValue *corner,
|
||||
g_return_val_if_fail (corner != NULL, 0.0);
|
||||
g_return_val_if_fail (corner->class == >K_CSS_VALUE_CORNER, 0.0);
|
||||
|
||||
return _gtk_css_number_value_get (corner->y, one_hundred_percent);
|
||||
return gtk_css_number_value_get (corner->y, one_hundred_percent);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
||||
@@ -50,14 +50,11 @@ gtk_css_value_ease_free (GtkCssValue *value)
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_ease_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_ease_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -159,7 +156,7 @@ _gtk_css_ease_value_new_cubic_bezier (double x1,
|
||||
g_return_val_if_fail (x2 >= 0.0, NULL);
|
||||
g_return_val_if_fail (x2 <= 1.0, NULL);
|
||||
|
||||
value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_EASE);
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_EASE);
|
||||
|
||||
value->type = GTK_CSS_EASE_CUBIC_BEZIER;
|
||||
value->u.cubic.x1 = x1;
|
||||
@@ -179,7 +176,7 @@ _gtk_css_ease_value_new_steps (guint n_steps,
|
||||
|
||||
g_return_val_if_fail (n_steps > 0, NULL);
|
||||
|
||||
value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_EASE);
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_EASE);
|
||||
|
||||
value->type = GTK_CSS_EASE_STEPS;
|
||||
value->u.steps.steps = n_steps;
|
||||
|
||||
+61
-66
@@ -41,14 +41,11 @@ gtk_css_value_enum_free (GtkCssValue *value)
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_enum_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_enum_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -105,7 +102,7 @@ _gtk_css_border_style_value_new (GtkBorderStyle border_style)
|
||||
{
|
||||
g_return_val_if_fail (border_style < G_N_ELEMENTS (border_style_values), NULL);
|
||||
|
||||
return _gtk_css_value_ref (&border_style_values[border_style]);
|
||||
return gtk_css_value_ref (&border_style_values[border_style]);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
@@ -118,7 +115,7 @@ _gtk_css_border_style_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (border_style_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, border_style_values[i].name))
|
||||
return _gtk_css_value_ref (&border_style_values[i]);
|
||||
return gtk_css_value_ref (&border_style_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -169,7 +166,7 @@ _gtk_css_blend_mode_value_new (GskBlendMode blend_mode)
|
||||
{
|
||||
g_return_val_if_fail (blend_mode < G_N_ELEMENTS (blend_mode_values), NULL);
|
||||
|
||||
return _gtk_css_value_ref (&blend_mode_values[blend_mode]);
|
||||
return gtk_css_value_ref (&blend_mode_values[blend_mode]);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
@@ -182,7 +179,7 @@ _gtk_css_blend_mode_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (blend_mode_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, blend_mode_values[i].name))
|
||||
return _gtk_css_value_ref (&blend_mode_values[i]);
|
||||
return gtk_css_value_ref (&blend_mode_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -201,7 +198,7 @@ _gtk_css_blend_mode_value_get (const GtkCssValue *value)
|
||||
static double
|
||||
get_dpi (GtkCssStyle *style)
|
||||
{
|
||||
return _gtk_css_number_value_get (style->core->dpi, 96);
|
||||
return gtk_css_number_value_get (style->core->dpi, 96);
|
||||
}
|
||||
|
||||
/* XXX: Kinda bad to have that machinery here, nobody expects vital font
|
||||
@@ -230,13 +227,14 @@ gtk_css_font_size_get_default_px (GtkStyleProvider *provider,
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkStyleProvider *provider = context->provider;
|
||||
GtkCssStyle *style = context->style;
|
||||
GtkCssStyle *parent_style = context->parent_style;
|
||||
|
||||
double font_size;
|
||||
|
||||
switch (value->value)
|
||||
@@ -267,7 +265,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
break;
|
||||
case GTK_CSS_FONT_SIZE_SMALLER:
|
||||
if (parent_style)
|
||||
font_size = _gtk_css_number_value_get (parent_style->core->font_size, 100);
|
||||
font_size = gtk_css_number_value_get (parent_style->core->font_size, 100);
|
||||
else
|
||||
font_size = gtk_css_font_size_get_default_px (provider, style);
|
||||
/* This is what WebKit does... */
|
||||
@@ -275,7 +273,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
break;
|
||||
case GTK_CSS_FONT_SIZE_LARGER:
|
||||
if (parent_style)
|
||||
font_size = _gtk_css_number_value_get (parent_style->core->font_size, 100);
|
||||
font_size = gtk_css_number_value_get (parent_style->core->font_size, 100);
|
||||
else
|
||||
font_size = gtk_css_font_size_get_default_px (provider, style);
|
||||
/* This is what WebKit does... */
|
||||
@@ -283,7 +281,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
break;
|
||||
}
|
||||
|
||||
return _gtk_css_number_value_new (font_size, GTK_CSS_PX);
|
||||
return gtk_css_number_value_new (font_size, GTK_CSS_PX);
|
||||
}
|
||||
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_FONT_SIZE = {
|
||||
@@ -314,7 +312,7 @@ _gtk_css_font_size_value_new (GtkCssFontSize font_size)
|
||||
{
|
||||
g_return_val_if_fail (font_size < G_N_ELEMENTS (font_size_values), NULL);
|
||||
|
||||
return _gtk_css_value_ref (&font_size_values[font_size]);
|
||||
return gtk_css_value_ref (&font_size_values[font_size]);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
@@ -327,7 +325,7 @@ _gtk_css_font_size_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (font_size_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, font_size_values[i].name))
|
||||
return _gtk_css_value_ref (&font_size_values[i]);
|
||||
return gtk_css_value_ref (&font_size_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -365,7 +363,7 @@ _gtk_css_font_style_value_new (PangoStyle font_style)
|
||||
{
|
||||
g_return_val_if_fail (font_style < G_N_ELEMENTS (font_style_values), NULL);
|
||||
|
||||
return _gtk_css_value_ref (&font_style_values[font_style]);
|
||||
return gtk_css_value_ref (&font_style_values[font_style]);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
@@ -378,7 +376,7 @@ _gtk_css_font_style_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (font_style_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, font_style_values[i].name))
|
||||
return _gtk_css_value_ref (&font_style_values[i]);
|
||||
return gtk_css_value_ref (&font_style_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -398,21 +396,18 @@ _gtk_css_font_style_value_get (const GtkCssValue *value)
|
||||
#define LIGHTER -2
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_font_weight_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_font_weight_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
PangoWeight new_weight;
|
||||
int parent_value;
|
||||
|
||||
if (value->value >= 0)
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
|
||||
if (parent_style)
|
||||
parent_value = _gtk_css_number_value_get (parent_style->font->font_weight, 100);
|
||||
if (context->parent_style)
|
||||
parent_value = gtk_css_number_value_get (context->parent_style->font->font_weight, 100);
|
||||
else
|
||||
parent_value = 400;
|
||||
|
||||
@@ -440,7 +435,7 @@ gtk_css_value_font_weight_compute (GtkCssValue *value,
|
||||
new_weight = PANGO_WEIGHT_NORMAL;
|
||||
}
|
||||
|
||||
return _gtk_css_number_value_new (new_weight, GTK_CSS_NUMBER);
|
||||
return gtk_css_number_value_new (new_weight, GTK_CSS_NUMBER);
|
||||
}
|
||||
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
|
||||
@@ -469,13 +464,13 @@ gtk_css_font_weight_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (font_weight_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, font_weight_values[i].name))
|
||||
return _gtk_css_value_ref (&font_weight_values[i]);
|
||||
return gtk_css_value_ref (&font_weight_values[i]);
|
||||
}
|
||||
|
||||
if (gtk_css_parser_try_ident (parser, "normal"))
|
||||
return _gtk_css_number_value_new (PANGO_WEIGHT_NORMAL, GTK_CSS_NUMBER);
|
||||
return gtk_css_number_value_new (PANGO_WEIGHT_NORMAL, GTK_CSS_NUMBER);
|
||||
if (gtk_css_parser_try_ident (parser, "bold"))
|
||||
return _gtk_css_number_value_new (PANGO_WEIGHT_BOLD, GTK_CSS_NUMBER);
|
||||
return gtk_css_number_value_new (PANGO_WEIGHT_BOLD, GTK_CSS_NUMBER);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -521,7 +516,7 @@ _gtk_css_font_stretch_value_new (PangoStretch font_stretch)
|
||||
{
|
||||
g_return_val_if_fail (font_stretch < G_N_ELEMENTS (font_stretch_values), NULL);
|
||||
|
||||
return _gtk_css_value_ref (&font_stretch_values[font_stretch]);
|
||||
return gtk_css_value_ref (&font_stretch_values[font_stretch]);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
@@ -534,7 +529,7 @@ _gtk_css_font_stretch_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (font_stretch_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, font_stretch_values[i].name))
|
||||
return _gtk_css_value_ref (&font_stretch_values[i]);
|
||||
return gtk_css_value_ref (&font_stretch_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -572,7 +567,7 @@ _gtk_css_text_decoration_style_value_new (GtkTextDecorationStyle style)
|
||||
{
|
||||
g_return_val_if_fail (style < G_N_ELEMENTS (text_decoration_style_values), NULL);
|
||||
|
||||
return _gtk_css_value_ref (&text_decoration_style_values[style]);
|
||||
return gtk_css_value_ref (&text_decoration_style_values[style]);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
@@ -585,7 +580,7 @@ _gtk_css_text_decoration_style_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (text_decoration_style_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, text_decoration_style_values[i].name))
|
||||
return _gtk_css_value_ref (&text_decoration_style_values[i]);
|
||||
return gtk_css_value_ref (&text_decoration_style_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -626,7 +621,7 @@ _gtk_css_area_value_new (GtkCssArea area)
|
||||
for (i = 0; i < G_N_ELEMENTS (area_values); i++)
|
||||
{
|
||||
if (area_values[i].value == area)
|
||||
return _gtk_css_value_ref (&area_values[i]);
|
||||
return gtk_css_value_ref (&area_values[i]);
|
||||
}
|
||||
|
||||
g_return_val_if_reached (NULL);
|
||||
@@ -642,7 +637,7 @@ _gtk_css_area_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (area_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, area_values[i].name))
|
||||
return _gtk_css_value_ref (&area_values[i]);
|
||||
return gtk_css_value_ref (&area_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -684,7 +679,7 @@ _gtk_css_direction_value_new (GtkCssDirection direction)
|
||||
for (i = 0; i < G_N_ELEMENTS (direction_values); i++)
|
||||
{
|
||||
if (direction_values[i].value == direction)
|
||||
return _gtk_css_value_ref (&direction_values[i]);
|
||||
return gtk_css_value_ref (&direction_values[i]);
|
||||
}
|
||||
|
||||
g_return_val_if_reached (NULL);
|
||||
@@ -703,7 +698,7 @@ _gtk_css_direction_value_try_parse (GtkCssParser *parser)
|
||||
for (i = G_N_ELEMENTS (direction_values) - 1; i >= 0; i--)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, direction_values[i].name))
|
||||
return _gtk_css_value_ref (&direction_values[i]);
|
||||
return gtk_css_value_ref (&direction_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -743,7 +738,7 @@ _gtk_css_play_state_value_new (GtkCssPlayState play_state)
|
||||
for (i = 0; i < G_N_ELEMENTS (play_state_values); i++)
|
||||
{
|
||||
if (play_state_values[i].value == play_state)
|
||||
return _gtk_css_value_ref (&play_state_values[i]);
|
||||
return gtk_css_value_ref (&play_state_values[i]);
|
||||
}
|
||||
|
||||
g_return_val_if_reached (NULL);
|
||||
@@ -759,7 +754,7 @@ _gtk_css_play_state_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (play_state_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, play_state_values[i].name))
|
||||
return _gtk_css_value_ref (&play_state_values[i]);
|
||||
return gtk_css_value_ref (&play_state_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -801,7 +796,7 @@ _gtk_css_fill_mode_value_new (GtkCssFillMode fill_mode)
|
||||
for (i = 0; i < G_N_ELEMENTS (fill_mode_values); i++)
|
||||
{
|
||||
if (fill_mode_values[i].value == fill_mode)
|
||||
return _gtk_css_value_ref (&fill_mode_values[i]);
|
||||
return gtk_css_value_ref (&fill_mode_values[i]);
|
||||
}
|
||||
|
||||
g_return_val_if_reached (NULL);
|
||||
@@ -817,7 +812,7 @@ _gtk_css_fill_mode_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (fill_mode_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, fill_mode_values[i].name))
|
||||
return _gtk_css_value_ref (&fill_mode_values[i]);
|
||||
return gtk_css_value_ref (&fill_mode_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -858,7 +853,7 @@ _gtk_css_icon_style_value_new (GtkCssIconStyle icon_style)
|
||||
for (i = 0; i < G_N_ELEMENTS (icon_style_values); i++)
|
||||
{
|
||||
if (icon_style_values[i].value == icon_style)
|
||||
return _gtk_css_value_ref (&icon_style_values[i]);
|
||||
return gtk_css_value_ref (&icon_style_values[i]);
|
||||
}
|
||||
|
||||
g_return_val_if_reached (NULL);
|
||||
@@ -874,7 +869,7 @@ _gtk_css_icon_style_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (icon_style_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, icon_style_values[i].name))
|
||||
return _gtk_css_value_ref (&icon_style_values[i]);
|
||||
return gtk_css_value_ref (&icon_style_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -915,7 +910,7 @@ _gtk_css_font_kerning_value_new (GtkCssFontKerning kerning)
|
||||
for (i = 0; i < G_N_ELEMENTS (font_kerning_values); i++)
|
||||
{
|
||||
if (font_kerning_values[i].value == kerning)
|
||||
return _gtk_css_value_ref (&font_kerning_values[i]);
|
||||
return gtk_css_value_ref (&font_kerning_values[i]);
|
||||
}
|
||||
|
||||
g_return_val_if_reached (NULL);
|
||||
@@ -931,7 +926,7 @@ _gtk_css_font_kerning_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (font_kerning_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, font_kerning_values[i].name))
|
||||
return _gtk_css_value_ref (&font_kerning_values[i]);
|
||||
return gtk_css_value_ref (&font_kerning_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -972,7 +967,7 @@ _gtk_css_font_variant_position_value_new (GtkCssFontVariantPosition position)
|
||||
for (i = 0; i < G_N_ELEMENTS (font_variant_position_values); i++)
|
||||
{
|
||||
if (font_variant_position_values[i].value == position)
|
||||
return _gtk_css_value_ref (&font_variant_position_values[i]);
|
||||
return gtk_css_value_ref (&font_variant_position_values[i]);
|
||||
}
|
||||
|
||||
g_return_val_if_reached (NULL);
|
||||
@@ -988,7 +983,7 @@ _gtk_css_font_variant_position_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (font_variant_position_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, font_variant_position_values[i].name))
|
||||
return _gtk_css_value_ref (&font_variant_position_values[i]);
|
||||
return gtk_css_value_ref (&font_variant_position_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1033,7 +1028,7 @@ _gtk_css_font_variant_caps_value_new (GtkCssFontVariantCaps caps)
|
||||
for (i = 0; i < G_N_ELEMENTS (font_variant_caps_values); i++)
|
||||
{
|
||||
if (font_variant_caps_values[i].value == caps)
|
||||
return _gtk_css_value_ref (&font_variant_caps_values[i]);
|
||||
return gtk_css_value_ref (&font_variant_caps_values[i]);
|
||||
}
|
||||
|
||||
g_return_val_if_reached (NULL);
|
||||
@@ -1049,7 +1044,7 @@ _gtk_css_font_variant_caps_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (font_variant_caps_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, font_variant_caps_values[i].name))
|
||||
return _gtk_css_value_ref (&font_variant_caps_values[i]);
|
||||
return gtk_css_value_ref (&font_variant_caps_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1089,7 +1084,7 @@ _gtk_css_font_variant_alternate_value_new (GtkCssFontVariantAlternate alternate)
|
||||
for (i = 0; i < G_N_ELEMENTS (font_variant_alternate_values); i++)
|
||||
{
|
||||
if (font_variant_alternate_values[i].value == alternate)
|
||||
return _gtk_css_value_ref (&font_variant_alternate_values[i]);
|
||||
return gtk_css_value_ref (&font_variant_alternate_values[i]);
|
||||
}
|
||||
|
||||
g_return_val_if_reached (NULL);
|
||||
@@ -1105,7 +1100,7 @@ _gtk_css_font_variant_alternate_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (font_variant_alternate_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, font_variant_alternate_values[i].name))
|
||||
return _gtk_css_value_ref (&font_variant_alternate_values[i]);
|
||||
return gtk_css_value_ref (&font_variant_alternate_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1202,7 +1197,7 @@ _gtk_css_text_decoration_line_value_new (GtkTextDecorationLine line)
|
||||
if (!text_decoration_line_is_valid (line))
|
||||
return NULL;
|
||||
|
||||
value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_TEXT_DECORATION_LINE);
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_TEXT_DECORATION_LINE);
|
||||
value->value = line;
|
||||
value->name = NULL;
|
||||
value->is_computed = TRUE;
|
||||
@@ -1311,7 +1306,7 @@ _gtk_css_font_variant_ligature_value_new (GtkCssFontVariantLigature ligatures)
|
||||
if (!ligature_value_is_valid (ligatures))
|
||||
return NULL;
|
||||
|
||||
value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_FONT_VARIANT_LIGATURE);
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_FONT_VARIANT_LIGATURE);
|
||||
value->value = ligatures;
|
||||
value->name = NULL;
|
||||
value->is_computed = TRUE;
|
||||
@@ -1415,7 +1410,7 @@ _gtk_css_font_variant_numeric_value_new (GtkCssFontVariantNumeric numeric)
|
||||
if (!numeric_value_is_valid (numeric))
|
||||
return NULL;
|
||||
|
||||
value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_FONT_VARIANT_NUMERIC);
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_FONT_VARIANT_NUMERIC);
|
||||
value->value = numeric;
|
||||
value->name = NULL;
|
||||
value->is_computed = TRUE;
|
||||
@@ -1526,7 +1521,7 @@ _gtk_css_font_variant_east_asian_value_new (GtkCssFontVariantEastAsian east_asia
|
||||
if (!east_asian_value_is_valid (east_asian))
|
||||
return NULL;
|
||||
|
||||
value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_FONT_VARIANT_EAST_ASIAN);
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_FONT_VARIANT_EAST_ASIAN);
|
||||
value->value = east_asian;
|
||||
value->name = NULL;
|
||||
value->is_computed = TRUE;
|
||||
@@ -1597,7 +1592,7 @@ _gtk_css_text_transform_value_new (GtkTextTransform transform)
|
||||
{
|
||||
g_return_val_if_fail (transform < G_N_ELEMENTS (text_transform_values), NULL);
|
||||
|
||||
return _gtk_css_value_ref (&text_transform_values[transform]);
|
||||
return gtk_css_value_ref (&text_transform_values[transform]);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
@@ -1610,7 +1605,7 @@ _gtk_css_text_transform_value_try_parse (GtkCssParser *parser)
|
||||
for (i = 0; i < G_N_ELEMENTS (text_transform_values); i++)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, text_transform_values[i].name))
|
||||
return _gtk_css_value_ref (&text_transform_values[i]);
|
||||
return gtk_css_value_ref (&text_transform_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
+85
-94
@@ -65,34 +65,34 @@ gtk_css_filter_clear (GtkCssFilter *filter)
|
||||
switch (filter->type)
|
||||
{
|
||||
case GTK_CSS_FILTER_BRIGHTNESS:
|
||||
_gtk_css_value_unref (filter->brightness.value);
|
||||
gtk_css_value_unref (filter->brightness.value);
|
||||
break;
|
||||
case GTK_CSS_FILTER_CONTRAST:
|
||||
_gtk_css_value_unref (filter->contrast.value);
|
||||
gtk_css_value_unref (filter->contrast.value);
|
||||
break;
|
||||
case GTK_CSS_FILTER_GRAYSCALE:
|
||||
_gtk_css_value_unref (filter->grayscale.value);
|
||||
gtk_css_value_unref (filter->grayscale.value);
|
||||
break;
|
||||
case GTK_CSS_FILTER_HUE_ROTATE:
|
||||
_gtk_css_value_unref (filter->hue_rotate.value);
|
||||
gtk_css_value_unref (filter->hue_rotate.value);
|
||||
break;
|
||||
case GTK_CSS_FILTER_INVERT:
|
||||
_gtk_css_value_unref (filter->invert.value);
|
||||
gtk_css_value_unref (filter->invert.value);
|
||||
break;
|
||||
case GTK_CSS_FILTER_OPACITY:
|
||||
_gtk_css_value_unref (filter->opacity.value);
|
||||
gtk_css_value_unref (filter->opacity.value);
|
||||
break;
|
||||
case GTK_CSS_FILTER_SATURATE:
|
||||
_gtk_css_value_unref (filter->saturate.value);
|
||||
gtk_css_value_unref (filter->saturate.value);
|
||||
break;
|
||||
case GTK_CSS_FILTER_SEPIA:
|
||||
_gtk_css_value_unref (filter->sepia.value);
|
||||
gtk_css_value_unref (filter->sepia.value);
|
||||
break;
|
||||
case GTK_CSS_FILTER_BLUR:
|
||||
_gtk_css_value_unref (filter->blur.value);
|
||||
gtk_css_value_unref (filter->blur.value);
|
||||
break;
|
||||
case GTK_CSS_FILTER_DROP_SHADOW:
|
||||
_gtk_css_value_unref (filter->drop_shadow.value);
|
||||
gtk_css_value_unref (filter->drop_shadow.value);
|
||||
break;
|
||||
case GTK_CSS_FILTER_NONE:
|
||||
default:
|
||||
@@ -108,31 +108,31 @@ gtk_css_filter_init_identity (GtkCssFilter *filter,
|
||||
switch (other->type)
|
||||
{
|
||||
case GTK_CSS_FILTER_BRIGHTNESS:
|
||||
filter->brightness.value = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
filter->brightness.value = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
break;
|
||||
case GTK_CSS_FILTER_CONTRAST:
|
||||
filter->contrast.value = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
filter->contrast.value = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
break;
|
||||
case GTK_CSS_FILTER_GRAYSCALE:
|
||||
filter->grayscale.value = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
filter->grayscale.value = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
break;
|
||||
case GTK_CSS_FILTER_HUE_ROTATE:
|
||||
filter->hue_rotate.value = _gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
filter->hue_rotate.value = gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
break;
|
||||
case GTK_CSS_FILTER_INVERT:
|
||||
filter->invert.value = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
filter->invert.value = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
break;
|
||||
case GTK_CSS_FILTER_OPACITY:
|
||||
filter->opacity.value = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
filter->opacity.value = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
break;
|
||||
case GTK_CSS_FILTER_SATURATE:
|
||||
filter->saturate.value = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
filter->saturate.value = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
break;
|
||||
case GTK_CSS_FILTER_SEPIA:
|
||||
filter->sepia.value = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
filter->sepia.value = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
break;
|
||||
case GTK_CSS_FILTER_BLUR:
|
||||
filter->blur.value = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
filter->blur.value = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
break;
|
||||
case GTK_CSS_FILTER_DROP_SHADOW:
|
||||
filter->drop_shadow.value = gtk_css_shadow_value_new_filter (other->drop_shadow.value);
|
||||
@@ -160,19 +160,19 @@ gtk_css_filter_get_matrix (const GtkCssFilter *filter,
|
||||
switch (filter->type)
|
||||
{
|
||||
case GTK_CSS_FILTER_BRIGHTNESS:
|
||||
value = _gtk_css_number_value_get (filter->brightness.value, 1.0);
|
||||
value = gtk_css_number_value_get (filter->brightness.value, 1.0);
|
||||
graphene_matrix_init_scale (matrix, value, value, value);
|
||||
graphene_vec4_init (offset, 0.0, 0.0, 0.0, 0.0);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_CONTRAST:
|
||||
value = _gtk_css_number_value_get (filter->contrast.value, 1.0);
|
||||
value = gtk_css_number_value_get (filter->contrast.value, 1.0);
|
||||
graphene_matrix_init_scale (matrix, value, value, value);
|
||||
graphene_vec4_init (offset, 0.5 - 0.5 * value, 0.5 - 0.5 * value, 0.5 - 0.5 * value, 0.0);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_GRAYSCALE:
|
||||
value = _gtk_css_number_value_get (filter->grayscale.value, 1.0);
|
||||
value = gtk_css_number_value_get (filter->grayscale.value, 1.0);
|
||||
graphene_matrix_init_from_float (matrix, (float[16]) {
|
||||
1.0 - (1.0 - R) * value, R * value, R * value, 0.0,
|
||||
G * value, 1.0 - (1.0 - G) * value, G * value, 0.0,
|
||||
@@ -185,7 +185,7 @@ gtk_css_filter_get_matrix (const GtkCssFilter *filter,
|
||||
case GTK_CSS_FILTER_HUE_ROTATE:
|
||||
{
|
||||
double c, s;
|
||||
value = _gtk_css_number_value_get (filter->grayscale.value, 1.0) * G_PI / 180.0;
|
||||
value = gtk_css_number_value_get (filter->grayscale.value, 1.0) * G_PI / 180.0;
|
||||
c = cos (value);
|
||||
s = sin (value);
|
||||
graphene_matrix_init_from_float (matrix, (float[16]) {
|
||||
@@ -208,13 +208,13 @@ gtk_css_filter_get_matrix (const GtkCssFilter *filter,
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_INVERT:
|
||||
value = _gtk_css_number_value_get (filter->invert.value, 1.0);
|
||||
value = gtk_css_number_value_get (filter->invert.value, 1.0);
|
||||
graphene_matrix_init_scale (matrix, 1.0 - 2 * value, 1.0 - 2 * value, 1.0 - 2 * value);
|
||||
graphene_vec4_init (offset, value, value, value, 0.0);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_OPACITY:
|
||||
value = _gtk_css_number_value_get (filter->opacity.value, 1.0);
|
||||
value = gtk_css_number_value_get (filter->opacity.value, 1.0);
|
||||
graphene_matrix_init_from_float (matrix, (float[16]) {
|
||||
1.0, 0.0, 0.0, 0.0,
|
||||
0.0, 1.0, 0.0, 0.0,
|
||||
@@ -225,7 +225,7 @@ gtk_css_filter_get_matrix (const GtkCssFilter *filter,
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_SATURATE:
|
||||
value = _gtk_css_number_value_get (filter->saturate.value, 1.0);
|
||||
value = gtk_css_number_value_get (filter->saturate.value, 1.0);
|
||||
graphene_matrix_init_from_float (matrix, (float[16]) {
|
||||
R + (1.0 - R) * value, R - R * value, R - R * value, 0.0,
|
||||
G - G * value, G + (1.0 - G) * value, G - G * value, 0.0,
|
||||
@@ -236,7 +236,7 @@ gtk_css_filter_get_matrix (const GtkCssFilter *filter,
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_SEPIA:
|
||||
value = _gtk_css_number_value_get (filter->sepia.value, 1.0);
|
||||
value = gtk_css_number_value_get (filter->sepia.value, 1.0);
|
||||
graphene_matrix_init_from_float (matrix, (float[16]) {
|
||||
1.0 - 0.607 * value, 0.349 * value, 0.272 * value, 0.0,
|
||||
0.769 * value, 1.0 - 0.314 * value, 0.534 * value, 0.0,
|
||||
@@ -307,56 +307,53 @@ gtk_css_value_filter_free (GtkCssValue *value)
|
||||
|
||||
/* returns TRUE if dest == src */
|
||||
static gboolean
|
||||
gtk_css_filter_compute (GtkCssFilter *dest,
|
||||
GtkCssFilter *src,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_filter_compute (GtkCssFilter *dest,
|
||||
GtkCssFilter *src,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
dest->type = src->type;
|
||||
|
||||
switch (src->type)
|
||||
{
|
||||
case GTK_CSS_FILTER_BRIGHTNESS:
|
||||
dest->brightness.value = _gtk_css_value_compute (src->brightness.value, property_id, provider, style, parent_style, variables);
|
||||
dest->brightness.value = gtk_css_value_compute (src->brightness.value, property_id, context);
|
||||
return dest->brightness.value == src->brightness.value;
|
||||
|
||||
case GTK_CSS_FILTER_CONTRAST:
|
||||
dest->contrast.value = _gtk_css_value_compute (src->contrast.value, property_id, provider, style, parent_style, variables);
|
||||
dest->contrast.value = gtk_css_value_compute (src->contrast.value, property_id, context);
|
||||
return dest->contrast.value == src->contrast.value;
|
||||
|
||||
case GTK_CSS_FILTER_GRAYSCALE:
|
||||
dest->grayscale.value = _gtk_css_value_compute (src->grayscale.value, property_id, provider, style, parent_style, variables);
|
||||
dest->grayscale.value = gtk_css_value_compute (src->grayscale.value, property_id, context);
|
||||
return dest->grayscale.value == src->grayscale.value;
|
||||
|
||||
case GTK_CSS_FILTER_HUE_ROTATE:
|
||||
dest->hue_rotate.value = _gtk_css_value_compute (src->hue_rotate.value, property_id, provider, style, parent_style, variables);
|
||||
dest->hue_rotate.value = gtk_css_value_compute (src->hue_rotate.value, property_id, context);
|
||||
return dest->hue_rotate.value == src->hue_rotate.value;
|
||||
|
||||
case GTK_CSS_FILTER_INVERT:
|
||||
dest->invert.value = _gtk_css_value_compute (src->invert.value, property_id, provider, style, parent_style, variables);
|
||||
dest->invert.value = gtk_css_value_compute (src->invert.value, property_id, context);
|
||||
return dest->invert.value == src->invert.value;
|
||||
|
||||
case GTK_CSS_FILTER_OPACITY:
|
||||
dest->opacity.value = _gtk_css_value_compute (src->opacity.value, property_id, provider, style, parent_style, variables);
|
||||
dest->opacity.value = gtk_css_value_compute (src->opacity.value, property_id, context);
|
||||
return dest->opacity.value == src->opacity.value;
|
||||
|
||||
case GTK_CSS_FILTER_SATURATE:
|
||||
dest->saturate.value = _gtk_css_value_compute (src->saturate.value, property_id, provider, style, parent_style, variables);
|
||||
dest->saturate.value = gtk_css_value_compute (src->saturate.value, property_id, context);
|
||||
return dest->saturate.value == src->saturate.value;
|
||||
|
||||
case GTK_CSS_FILTER_SEPIA:
|
||||
dest->sepia.value = _gtk_css_value_compute (src->sepia.value, property_id, provider, style, parent_style, variables);
|
||||
dest->sepia.value = gtk_css_value_compute (src->sepia.value, property_id, context);
|
||||
return dest->sepia.value == src->sepia.value;
|
||||
|
||||
case GTK_CSS_FILTER_BLUR:
|
||||
dest->blur.value = _gtk_css_value_compute (src->blur.value, property_id, provider, style, parent_style, variables);
|
||||
dest->blur.value = gtk_css_value_compute (src->blur.value, property_id, context);
|
||||
return dest->blur.value == src->blur.value;
|
||||
|
||||
case GTK_CSS_FILTER_DROP_SHADOW:
|
||||
dest->drop_shadow.value = _gtk_css_value_compute (src->drop_shadow.value, property_id, provider, style, parent_style, variables);
|
||||
dest->drop_shadow.value = gtk_css_value_compute (src->drop_shadow.value, property_id, context);
|
||||
return dest->drop_shadow.value == src->drop_shadow.value;
|
||||
|
||||
case GTK_CSS_FILTER_NONE:
|
||||
@@ -367,12 +364,9 @@ gtk_css_filter_compute (GtkCssFilter *dest,
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_filter_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_filter_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
gboolean changes;
|
||||
@@ -380,7 +374,7 @@ gtk_css_value_filter_compute (GtkCssValue *value,
|
||||
|
||||
/* Special case the 99% case of "none" */
|
||||
if (gtk_css_filter_value_is_none (value))
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
|
||||
changes = FALSE;
|
||||
result = gtk_css_filter_value_alloc (value->n_filters);
|
||||
@@ -390,16 +384,13 @@ gtk_css_value_filter_compute (GtkCssValue *value,
|
||||
changes |= !gtk_css_filter_compute (&result->filters[i],
|
||||
&value->filters[i],
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
context);
|
||||
}
|
||||
|
||||
if (!changes)
|
||||
{
|
||||
_gtk_css_value_unref (result);
|
||||
result = _gtk_css_value_ref (value);
|
||||
gtk_css_value_unref (result);
|
||||
result = gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -415,34 +406,34 @@ gtk_css_filter_equal (const GtkCssFilter *filter1,
|
||||
switch (filter1->type)
|
||||
{
|
||||
case GTK_CSS_FILTER_BRIGHTNESS:
|
||||
return _gtk_css_value_equal (filter1->brightness.value, filter2->brightness.value);
|
||||
return gtk_css_value_equal (filter1->brightness.value, filter2->brightness.value);
|
||||
|
||||
case GTK_CSS_FILTER_CONTRAST:
|
||||
return _gtk_css_value_equal (filter1->contrast.value, filter2->contrast.value);
|
||||
return gtk_css_value_equal (filter1->contrast.value, filter2->contrast.value);
|
||||
|
||||
case GTK_CSS_FILTER_GRAYSCALE:
|
||||
return _gtk_css_value_equal (filter1->grayscale.value, filter2->grayscale.value);
|
||||
return gtk_css_value_equal (filter1->grayscale.value, filter2->grayscale.value);
|
||||
|
||||
case GTK_CSS_FILTER_HUE_ROTATE:
|
||||
return _gtk_css_value_equal (filter1->hue_rotate.value, filter2->hue_rotate.value);
|
||||
return gtk_css_value_equal (filter1->hue_rotate.value, filter2->hue_rotate.value);
|
||||
|
||||
case GTK_CSS_FILTER_INVERT:
|
||||
return _gtk_css_value_equal (filter1->invert.value, filter2->invert.value);
|
||||
return gtk_css_value_equal (filter1->invert.value, filter2->invert.value);
|
||||
|
||||
case GTK_CSS_FILTER_OPACITY:
|
||||
return _gtk_css_value_equal (filter1->opacity.value, filter2->opacity.value);
|
||||
return gtk_css_value_equal (filter1->opacity.value, filter2->opacity.value);
|
||||
|
||||
case GTK_CSS_FILTER_SATURATE:
|
||||
return _gtk_css_value_equal (filter1->saturate.value, filter2->saturate.value);
|
||||
return gtk_css_value_equal (filter1->saturate.value, filter2->saturate.value);
|
||||
|
||||
case GTK_CSS_FILTER_SEPIA:
|
||||
return _gtk_css_value_equal (filter1->sepia.value, filter2->sepia.value);
|
||||
return gtk_css_value_equal (filter1->sepia.value, filter2->sepia.value);
|
||||
|
||||
case GTK_CSS_FILTER_BLUR:
|
||||
return _gtk_css_value_equal (filter1->blur.value, filter2->blur.value);
|
||||
return gtk_css_value_equal (filter1->blur.value, filter2->blur.value);
|
||||
|
||||
case GTK_CSS_FILTER_DROP_SHADOW:
|
||||
return _gtk_css_value_equal (filter1->drop_shadow.value, filter2->drop_shadow.value);
|
||||
return gtk_css_value_equal (filter1->drop_shadow.value, filter2->drop_shadow.value);
|
||||
|
||||
case GTK_CSS_FILTER_NONE:
|
||||
default:
|
||||
@@ -497,43 +488,43 @@ gtk_css_filter_transition (GtkCssFilter *result,
|
||||
switch (start->type)
|
||||
{
|
||||
case GTK_CSS_FILTER_BRIGHTNESS:
|
||||
result->brightness.value = _gtk_css_value_transition (start->brightness.value, end->brightness.value, property_id, progress);
|
||||
result->brightness.value = gtk_css_value_transition (start->brightness.value, end->brightness.value, property_id, progress);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_CONTRAST:
|
||||
result->contrast.value = _gtk_css_value_transition (start->contrast.value, end->contrast.value, property_id, progress);
|
||||
result->contrast.value = gtk_css_value_transition (start->contrast.value, end->contrast.value, property_id, progress);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_GRAYSCALE:
|
||||
result->grayscale.value = _gtk_css_value_transition (start->grayscale.value, end->grayscale.value, property_id, progress);
|
||||
result->grayscale.value = gtk_css_value_transition (start->grayscale.value, end->grayscale.value, property_id, progress);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_HUE_ROTATE:
|
||||
result->hue_rotate.value = _gtk_css_value_transition (start->hue_rotate.value, end->hue_rotate.value, property_id, progress);
|
||||
result->hue_rotate.value = gtk_css_value_transition (start->hue_rotate.value, end->hue_rotate.value, property_id, progress);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_INVERT:
|
||||
result->invert.value = _gtk_css_value_transition (start->invert.value, end->invert.value, property_id, progress);
|
||||
result->invert.value = gtk_css_value_transition (start->invert.value, end->invert.value, property_id, progress);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_OPACITY:
|
||||
result->opacity.value = _gtk_css_value_transition (start->opacity.value, end->opacity.value, property_id, progress);
|
||||
result->opacity.value = gtk_css_value_transition (start->opacity.value, end->opacity.value, property_id, progress);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_SATURATE:
|
||||
result->saturate.value = _gtk_css_value_transition (start->saturate.value, end->saturate.value, property_id, progress);
|
||||
result->saturate.value = gtk_css_value_transition (start->saturate.value, end->saturate.value, property_id, progress);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_SEPIA:
|
||||
result->sepia.value = _gtk_css_value_transition (start->sepia.value, end->sepia.value, property_id, progress);
|
||||
result->sepia.value = gtk_css_value_transition (start->sepia.value, end->sepia.value, property_id, progress);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_BLUR:
|
||||
result->blur.value = _gtk_css_value_transition (start->blur.value, end->blur.value, property_id, progress);
|
||||
result->blur.value = gtk_css_value_transition (start->blur.value, end->blur.value, property_id, progress);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_DROP_SHADOW:
|
||||
result->drop_shadow.value = _gtk_css_value_transition (start->drop_shadow.value, end->drop_shadow.value, property_id, progress);
|
||||
result->drop_shadow.value = gtk_css_value_transition (start->drop_shadow.value, end->drop_shadow.value, property_id, progress);
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_NONE:
|
||||
@@ -555,7 +546,7 @@ gtk_css_value_filter_transition (GtkCssValue *start,
|
||||
if (gtk_css_filter_value_is_none (start))
|
||||
{
|
||||
if (gtk_css_filter_value_is_none (end))
|
||||
return _gtk_css_value_ref (start);
|
||||
return gtk_css_value_ref (start);
|
||||
|
||||
n = 0;
|
||||
}
|
||||
@@ -629,61 +620,61 @@ gtk_css_filter_print (const GtkCssFilter *filter,
|
||||
{
|
||||
case GTK_CSS_FILTER_BRIGHTNESS:
|
||||
g_string_append (string, "brightness(");
|
||||
_gtk_css_value_print (filter->brightness.value, string);
|
||||
gtk_css_value_print (filter->brightness.value, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_CONTRAST:
|
||||
g_string_append (string, "contrast(");
|
||||
_gtk_css_value_print (filter->contrast.value, string);
|
||||
gtk_css_value_print (filter->contrast.value, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_GRAYSCALE:
|
||||
g_string_append (string, "grayscale(");
|
||||
_gtk_css_value_print (filter->grayscale.value, string);
|
||||
gtk_css_value_print (filter->grayscale.value, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_HUE_ROTATE:
|
||||
g_string_append (string, "hue-rotate(");
|
||||
_gtk_css_value_print (filter->hue_rotate.value, string);
|
||||
gtk_css_value_print (filter->hue_rotate.value, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_INVERT:
|
||||
g_string_append (string, "invert(");
|
||||
_gtk_css_value_print (filter->invert.value, string);
|
||||
gtk_css_value_print (filter->invert.value, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_OPACITY:
|
||||
g_string_append (string, "opacity(");
|
||||
_gtk_css_value_print (filter->opacity.value, string);
|
||||
gtk_css_value_print (filter->opacity.value, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_SATURATE:
|
||||
g_string_append (string, "saturate(");
|
||||
_gtk_css_value_print (filter->saturate.value, string);
|
||||
gtk_css_value_print (filter->saturate.value, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_SEPIA:
|
||||
g_string_append (string, "sepia(");
|
||||
_gtk_css_value_print (filter->sepia.value, string);
|
||||
gtk_css_value_print (filter->sepia.value, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_BLUR:
|
||||
g_string_append (string, "blur(");
|
||||
_gtk_css_value_print (filter->blur.value, string);
|
||||
gtk_css_value_print (filter->blur.value, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
|
||||
case GTK_CSS_FILTER_DROP_SHADOW:
|
||||
g_string_append (string, "drop-shadow(");
|
||||
_gtk_css_value_print (filter->drop_shadow.value, string);
|
||||
gtk_css_value_print (filter->drop_shadow.value, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
|
||||
@@ -735,7 +726,7 @@ gtk_css_filter_value_alloc (guint n_filters)
|
||||
|
||||
g_return_val_if_fail (n_filters > 0, NULL);
|
||||
|
||||
result = _gtk_css_value_alloc (>K_CSS_VALUE_FILTER, sizeof (GtkCssValue) + sizeof (GtkCssFilter) * (n_filters - 1));
|
||||
result = gtk_css_value_alloc (>K_CSS_VALUE_FILTER, sizeof (GtkCssValue) + sizeof (GtkCssFilter) * (n_filters - 1));
|
||||
result->n_filters = n_filters;
|
||||
|
||||
return result;
|
||||
@@ -744,7 +735,7 @@ gtk_css_filter_value_alloc (guint n_filters)
|
||||
GtkCssValue *
|
||||
gtk_css_filter_value_new_none (void)
|
||||
{
|
||||
return _gtk_css_value_ref (&filter_none_singleton);
|
||||
return gtk_css_value_ref (&filter_none_singleton);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -760,7 +751,7 @@ gtk_css_filter_parse_number (GtkCssParser *parser,
|
||||
{
|
||||
GtkCssValue **values = data;
|
||||
|
||||
values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_PARSE_PERCENT | GTK_CSS_POSITIVE_ONLY);
|
||||
values[n] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_PARSE_PERCENT | GTK_CSS_POSITIVE_ONLY);
|
||||
if (values[n] == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -774,7 +765,7 @@ gtk_css_filter_parse_length (GtkCssParser *parser,
|
||||
{
|
||||
GtkCssValue **values = data;
|
||||
|
||||
values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
|
||||
values[n] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
|
||||
if (values[n] == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -788,7 +779,7 @@ gtk_css_filter_parse_angle (GtkCssParser *parser,
|
||||
{
|
||||
GtkCssValue **values = data;
|
||||
|
||||
values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
values[n] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
if (values[n] == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -966,7 +957,7 @@ gtk_css_filter_value_push_snapshot (const GtkCssValue *filter,
|
||||
{
|
||||
if (filter->filters[j].type == GTK_CSS_FILTER_BLUR)
|
||||
{
|
||||
double std_dev = _gtk_css_number_value_get (filter->filters[j].blur.value, 100.0);
|
||||
double std_dev = gtk_css_number_value_get (filter->filters[j].blur.value, 100.0);
|
||||
gtk_snapshot_push_blur (snapshot, 2 * std_dev);
|
||||
}
|
||||
else if (filter->filters[j].type == GTK_CSS_FILTER_DROP_SHADOW)
|
||||
|
||||
@@ -53,14 +53,11 @@ gtk_css_value_font_features_free (GtkCssValue *value)
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_font_features_compute (GtkCssValue *specified,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_font_features_compute (GtkCssValue *specified,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return _gtk_css_value_ref (specified);
|
||||
return gtk_css_value_ref (specified);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -171,7 +168,7 @@ gtk_css_font_features_value_new_empty (void)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_FONT_FEATURES);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_FONT_FEATURES);
|
||||
result->features = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
result->is_computed = TRUE;
|
||||
|
||||
@@ -184,7 +181,7 @@ gtk_css_font_features_value_new_default (void)
|
||||
if (default_font_features == NULL)
|
||||
default_font_features = gtk_css_font_features_value_new_empty ();
|
||||
|
||||
return _gtk_css_value_ref (default_font_features);
|
||||
return gtk_css_value_ref (default_font_features);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -218,7 +215,7 @@ gtk_css_font_features_value_parse (GtkCssParser *parser)
|
||||
name = gtk_css_parser_consume_string (parser);
|
||||
if (name == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -226,7 +223,7 @@ gtk_css_font_features_value_parse (GtkCssParser *parser)
|
||||
{
|
||||
gtk_css_parser_error_value (parser, "Not a valid OpenType tag.");
|
||||
g_free (name);
|
||||
_gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -239,7 +236,7 @@ gtk_css_font_features_value_parse (GtkCssParser *parser)
|
||||
if (!gtk_css_parser_consume_integer (parser, &num))
|
||||
{
|
||||
g_free (name);
|
||||
_gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (result);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,14 +52,11 @@ gtk_css_value_font_variations_free (GtkCssValue *value)
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_font_variations_compute (GtkCssValue *specified,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_font_variations_compute (GtkCssValue *specified,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return _gtk_css_value_ref (specified);
|
||||
return gtk_css_value_ref (specified);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -79,7 +76,7 @@ gtk_css_value_font_variations_equal (const GtkCssValue *value1,
|
||||
if (coord2 == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!_gtk_css_value_equal (coord1, coord2))
|
||||
if (!gtk_css_value_equal (coord1, coord2))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -109,9 +106,9 @@ gtk_css_value_font_variations_transition (GtkCssValue *start,
|
||||
{
|
||||
end_coord = g_hash_table_lookup (end->axes, name);
|
||||
if (end_coord == NULL)
|
||||
transition = _gtk_css_value_ref (start_coord);
|
||||
transition = gtk_css_value_ref (start_coord);
|
||||
else
|
||||
transition = _gtk_css_value_transition (start_coord, end_coord, property_id, progress);
|
||||
transition = gtk_css_value_transition (start_coord, end_coord, property_id, progress);
|
||||
|
||||
gtk_css_font_variations_value_add_axis (result, name, transition);
|
||||
}
|
||||
@@ -123,7 +120,7 @@ gtk_css_value_font_variations_transition (GtkCssValue *start,
|
||||
if (start_coord != NULL)
|
||||
continue;
|
||||
|
||||
gtk_css_font_variations_value_add_axis (result, name, _gtk_css_value_ref (end_coord));
|
||||
gtk_css_font_variations_value_add_axis (result, name, gtk_css_value_ref (end_coord));
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -152,7 +149,7 @@ gtk_css_value_font_variations_print (const GtkCssValue *value,
|
||||
else
|
||||
g_string_append (string, ", ");
|
||||
g_string_append_printf (string, "\"%s\" ", name);
|
||||
_gtk_css_value_print (coord, string);
|
||||
gtk_css_value_print (coord, string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,10 +169,10 @@ gtk_css_font_variations_value_new_empty (void)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_FONT_VARIATIONS);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_FONT_VARIATIONS);
|
||||
result->axes = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free,
|
||||
(GDestroyNotify) _gtk_css_value_unref);
|
||||
(GDestroyNotify) gtk_css_value_unref);
|
||||
result->is_computed = TRUE;
|
||||
|
||||
return result;
|
||||
@@ -187,7 +184,7 @@ gtk_css_font_variations_value_new_default (void)
|
||||
if (default_font_variations == NULL)
|
||||
default_font_variations = gtk_css_font_variations_value_new_empty ();
|
||||
|
||||
return _gtk_css_value_ref (default_font_variations);
|
||||
return gtk_css_value_ref (default_font_variations);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -220,7 +217,7 @@ gtk_css_font_variations_value_parse (GtkCssParser *parser)
|
||||
name = gtk_css_parser_consume_string (parser);
|
||||
if (name == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -228,15 +225,15 @@ gtk_css_font_variations_value_parse (GtkCssParser *parser)
|
||||
{
|
||||
gtk_css_parser_error_value (parser, "Not a valid OpenType tag.");
|
||||
g_free (name);
|
||||
_gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
coord = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
coord = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
if (coord == NULL)
|
||||
{
|
||||
g_free (name);
|
||||
_gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -271,7 +268,7 @@ gtk_css_font_variations_value_get_variations (GtkCssValue *value)
|
||||
else
|
||||
g_string_append (string, ",");
|
||||
g_string_append_printf (string, "%s=%g", name,
|
||||
_gtk_css_number_value_get (coord, 100));
|
||||
gtk_css_number_value_get (coord, 100));
|
||||
}
|
||||
|
||||
return g_string_free (string, FALSE);
|
||||
|
||||
+9
-15
@@ -65,12 +65,9 @@ gtk_css_image_real_get_aspect_ratio (GtkCssImage *image)
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_real_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_image_real_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return g_object_ref (image);
|
||||
}
|
||||
@@ -174,22 +171,19 @@ _gtk_css_image_get_aspect_ratio (GtkCssImage *image)
|
||||
}
|
||||
|
||||
GtkCssImage *
|
||||
_gtk_css_image_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
_gtk_css_image_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageClass *klass;
|
||||
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_IMAGE (image), NULL);
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), NULL);
|
||||
gtk_internal_return_val_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style), NULL);
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (context->style), NULL);
|
||||
gtk_internal_return_val_if_fail (context->parent_style == NULL || GTK_IS_CSS_STYLE (context->parent_style), NULL);
|
||||
|
||||
klass = GTK_CSS_IMAGE_GET_CLASS (image);
|
||||
|
||||
return klass->compute (image, property_id, provider, style, parent_style, variables);
|
||||
return klass->compute (image, property_id, context);
|
||||
}
|
||||
|
||||
GtkCssImage *
|
||||
|
||||
+41
-44
@@ -61,7 +61,7 @@ gtk_css_image_conic_snapshot (GtkCssImage *image,
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = _gtk_css_number_value_get (stop->offset, 360) / 360;
|
||||
pos = gtk_css_number_value_get (stop->offset, 360) / 360;
|
||||
pos = CLAMP (pos, 0.0, 1.0);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ gtk_css_image_conic_snapshot (GtkCssImage *image,
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height),
|
||||
&GRAPHENE_POINT_INIT (_gtk_css_position_value_get_x (self->center, width),
|
||||
_gtk_css_position_value_get_y (self->center, height)),
|
||||
_gtk_css_number_value_get (self->rotation, 360),
|
||||
gtk_css_number_value_get (self->rotation, 360),
|
||||
stops,
|
||||
self->n_stops);
|
||||
}
|
||||
@@ -98,13 +98,13 @@ parse_angles (GtkCssParser *parser,
|
||||
{
|
||||
GtkCssValue **angles = option_data;
|
||||
|
||||
angles[0] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE | GTK_CSS_PARSE_PERCENT);
|
||||
angles[0] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE | GTK_CSS_PARSE_PERCENT);
|
||||
if (angles[0] == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
angles[1] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE | GTK_CSS_PARSE_PERCENT);
|
||||
angles[1] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE | GTK_CSS_PARSE_PERCENT);
|
||||
if (angles[1] == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ parse_color (GtkCssParser *parser,
|
||||
{
|
||||
GtkCssValue **color = option_data;
|
||||
|
||||
*color = _gtk_css_color_value_parse (parser);
|
||||
*color = gtk_css_color_value_parse (parser);
|
||||
if (*color == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -176,14 +176,14 @@ gtk_css_image_conic_parse_first_arg (GtkCssImageConic *self,
|
||||
|
||||
if (gtk_css_parser_try_ident (parser, "from"))
|
||||
{
|
||||
self->rotation = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
self->rotation = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
if (self->rotation == NULL)
|
||||
return 0;
|
||||
nothing_parsed = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->rotation = _gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
self->rotation = gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
}
|
||||
|
||||
if (gtk_css_parser_try_ident (parser, "at"))
|
||||
@@ -195,8 +195,8 @@ gtk_css_image_conic_parse_first_arg (GtkCssImageConic *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
self->center = _gtk_css_position_value_new (_gtk_css_number_value_new (50, GTK_CSS_PERCENT),
|
||||
_gtk_css_number_value_new (50, GTK_CSS_PERCENT));
|
||||
self->center = _gtk_css_position_value_new (gtk_css_number_value_new (50, GTK_CSS_PERCENT),
|
||||
gtk_css_number_value_new (50, GTK_CSS_PERCENT));
|
||||
}
|
||||
|
||||
if (!nothing_parsed)
|
||||
@@ -269,25 +269,25 @@ gtk_css_image_conic_print (GtkCssImage *image,
|
||||
|
||||
if (self->center)
|
||||
{
|
||||
GtkCssValue *compare = _gtk_css_position_value_new (_gtk_css_number_value_new (50, GTK_CSS_PERCENT),
|
||||
_gtk_css_number_value_new (50, GTK_CSS_PERCENT));
|
||||
GtkCssValue *compare = _gtk_css_position_value_new (gtk_css_number_value_new (50, GTK_CSS_PERCENT),
|
||||
gtk_css_number_value_new (50, GTK_CSS_PERCENT));
|
||||
|
||||
if (!_gtk_css_value_equal (self->center, compare))
|
||||
if (!gtk_css_value_equal (self->center, compare))
|
||||
{
|
||||
g_string_append (string, "from ");
|
||||
_gtk_css_value_print (self->center, string);
|
||||
gtk_css_value_print (self->center, string);
|
||||
written = TRUE;
|
||||
}
|
||||
|
||||
gtk_css_value_unref (compare);
|
||||
}
|
||||
|
||||
if (self->rotation && _gtk_css_number_value_get (self->rotation, 360) != 0)
|
||||
if (self->rotation && gtk_css_number_value_get (self->rotation, 360) != 0)
|
||||
{
|
||||
if (written)
|
||||
g_string_append_c (string, ' ');
|
||||
g_string_append (string, "at ");
|
||||
_gtk_css_value_print (self->rotation, string);
|
||||
gtk_css_value_print (self->rotation, string);
|
||||
}
|
||||
|
||||
if (written)
|
||||
@@ -300,12 +300,12 @@ gtk_css_image_conic_print (GtkCssImage *image,
|
||||
if (i > 0)
|
||||
g_string_append (string, ", ");
|
||||
|
||||
_gtk_css_value_print (stop->color, string);
|
||||
gtk_css_value_print (stop->color, string);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
g_string_append (string, " ");
|
||||
_gtk_css_value_print (stop->offset, string);
|
||||
gtk_css_value_print (stop->offset, string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,12 +313,9 @@ gtk_css_image_conic_print (GtkCssImage *image,
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_conic_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_image_conic_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageConic *self = GTK_CSS_IMAGE_CONIC (image);
|
||||
GtkCssImageConic *copy;
|
||||
@@ -326,8 +323,8 @@ gtk_css_image_conic_compute (GtkCssImage *image,
|
||||
|
||||
copy = g_object_new (GTK_TYPE_CSS_IMAGE_CONIC, NULL);
|
||||
|
||||
copy->center = _gtk_css_value_compute (self->center, property_id, provider, style, parent_style, variables);
|
||||
copy->rotation = _gtk_css_value_compute (self->rotation, property_id, provider, style, parent_style, variables);
|
||||
copy->center = gtk_css_value_compute (self->center, property_id, context);
|
||||
copy->rotation = gtk_css_value_compute (self->rotation, property_id, context);
|
||||
|
||||
copy->n_stops = self->n_stops;
|
||||
copy->color_stops = g_malloc (sizeof (GtkCssImageConicColorStop) * copy->n_stops);
|
||||
@@ -336,11 +333,11 @@ gtk_css_image_conic_compute (GtkCssImage *image,
|
||||
const GtkCssImageConicColorStop *stop = &self->color_stops[i];
|
||||
GtkCssImageConicColorStop *scopy = ©->color_stops[i];
|
||||
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, variables);
|
||||
scopy->color = gtk_css_value_compute (stop->color, property_id, context);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables);
|
||||
scopy->offset = gtk_css_value_compute (stop->offset, property_id, context);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -375,11 +372,11 @@ gtk_css_image_conic_transition (GtkCssImage *start_image,
|
||||
|
||||
result = g_object_new (GTK_TYPE_CSS_IMAGE_CONIC, NULL);
|
||||
|
||||
result->center = _gtk_css_value_transition (start->center, end->center, property_id, progress);
|
||||
result->center = gtk_css_value_transition (start->center, end->center, property_id, progress);
|
||||
if (result->center == NULL)
|
||||
goto fail;
|
||||
|
||||
result->rotation = _gtk_css_value_transition (start->rotation, end->rotation, property_id, progress);
|
||||
result->rotation = gtk_css_value_transition (start->rotation, end->rotation, property_id, progress);
|
||||
if (result->rotation == NULL)
|
||||
goto fail;
|
||||
|
||||
@@ -400,22 +397,22 @@ gtk_css_image_conic_transition (GtkCssImage *start_image,
|
||||
}
|
||||
else
|
||||
{
|
||||
stop->offset = _gtk_css_value_transition (start_stop->offset,
|
||||
end_stop->offset,
|
||||
property_id,
|
||||
progress);
|
||||
stop->offset = gtk_css_value_transition (start_stop->offset,
|
||||
end_stop->offset,
|
||||
property_id,
|
||||
progress);
|
||||
if (stop->offset == NULL)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
stop->color = _gtk_css_value_transition (start_stop->color,
|
||||
end_stop->color,
|
||||
property_id,
|
||||
progress);
|
||||
stop->color = gtk_css_value_transition (start_stop->color,
|
||||
end_stop->color,
|
||||
property_id,
|
||||
progress);
|
||||
if (stop->color == NULL)
|
||||
{
|
||||
if (stop->offset)
|
||||
_gtk_css_value_unref (stop->offset);
|
||||
gtk_css_value_unref (stop->offset);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -437,8 +434,8 @@ gtk_css_image_conic_equal (GtkCssImage *image1,
|
||||
GtkCssImageConic *conic2 = (GtkCssImageConic *) image2;
|
||||
guint i;
|
||||
|
||||
if (!_gtk_css_value_equal (conic1->center, conic2->center) ||
|
||||
!_gtk_css_value_equal (conic1->rotation, conic2->rotation))
|
||||
if (!gtk_css_value_equal (conic1->center, conic2->center) ||
|
||||
!gtk_css_value_equal (conic1->rotation, conic2->rotation))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < conic1->n_stops; i++)
|
||||
@@ -446,8 +443,8 @@ gtk_css_image_conic_equal (GtkCssImage *image1,
|
||||
const GtkCssImageConicColorStop *stop1 = &conic1->color_stops[i];
|
||||
const GtkCssImageConicColorStop *stop2 = &conic2->color_stops[i];
|
||||
|
||||
if (!_gtk_css_value_equal0 (stop1->offset, stop2->offset) ||
|
||||
!_gtk_css_value_equal (stop1->color, stop2->color))
|
||||
if (!gtk_css_value_equal0 (stop1->offset, stop2->offset) ||
|
||||
!gtk_css_value_equal (stop1->color, stop2->color))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -464,9 +461,9 @@ gtk_css_image_conic_dispose (GObject *object)
|
||||
{
|
||||
GtkCssImageConicColorStop *stop = &self->color_stops[i];
|
||||
|
||||
_gtk_css_value_unref (stop->color);
|
||||
gtk_css_value_unref (stop->color);
|
||||
if (stop->offset)
|
||||
_gtk_css_value_unref (stop->offset);
|
||||
gtk_css_value_unref (stop->offset);
|
||||
}
|
||||
g_free (self->color_stops);
|
||||
|
||||
|
||||
@@ -289,11 +289,11 @@ parse_progress (GtkCssParser *parser,
|
||||
double *progress = option_data;
|
||||
GtkCssValue *number;
|
||||
|
||||
number = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_PERCENT | GTK_CSS_POSITIVE_ONLY);
|
||||
number = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_PERCENT | GTK_CSS_POSITIVE_ONLY);
|
||||
if (number == NULL)
|
||||
return FALSE;
|
||||
*progress = _gtk_css_number_value_get (number, 1);
|
||||
_gtk_css_value_unref (number);
|
||||
*progress = gtk_css_number_value_get (number, 1);
|
||||
gtk_css_value_unref (number);
|
||||
|
||||
if (*progress > 1.0)
|
||||
{
|
||||
@@ -323,7 +323,7 @@ parse_image (GtkCssParser *parser,
|
||||
{
|
||||
GtkCssValue *color;
|
||||
|
||||
color = _gtk_css_color_value_parse (parser);
|
||||
color = gtk_css_color_value_parse (parser);
|
||||
if (color == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -399,12 +399,9 @@ gtk_css_image_cross_fade_print (GtkCssImage *image,
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_cross_fade_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_image_cross_fade_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageCrossFade *self = GTK_CSS_IMAGE_CROSS_FADE (image);
|
||||
GtkCssImageCrossFade *result;
|
||||
@@ -419,7 +416,7 @@ gtk_css_image_cross_fade_compute (GtkCssImage *image,
|
||||
gtk_css_image_cross_fade_add (result,
|
||||
entry->has_progress,
|
||||
entry->progress,
|
||||
_gtk_css_image_compute (entry->image, property_id, provider, style, parent_style, variables));
|
||||
_gtk_css_image_compute (entry->image, property_id, context));
|
||||
}
|
||||
|
||||
return GTK_CSS_IMAGE (result);
|
||||
|
||||
+12
-21
@@ -105,7 +105,7 @@ gtk_css_image_fallback_print (GtkCssImage *image,
|
||||
{
|
||||
if (fallback->n_images > 0)
|
||||
g_string_append (string, ",");
|
||||
_gtk_css_value_print (fallback->color, string);
|
||||
gtk_css_value_print (fallback->color, string);
|
||||
}
|
||||
|
||||
g_string_append (string, ")");
|
||||
@@ -124,7 +124,7 @@ gtk_css_image_fallback_dispose (GObject *object)
|
||||
|
||||
if (fallback->color)
|
||||
{
|
||||
_gtk_css_value_unref (fallback->color);
|
||||
gtk_css_value_unref (fallback->color);
|
||||
fallback->color = NULL;
|
||||
}
|
||||
|
||||
@@ -133,12 +133,9 @@ gtk_css_image_fallback_dispose (GObject *object)
|
||||
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_fallback_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_image_fallback_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image);
|
||||
GtkCssImageFallback *copy;
|
||||
@@ -149,12 +146,9 @@ gtk_css_image_fallback_compute (GtkCssImage *image,
|
||||
GtkCssValue *computed_color = NULL;
|
||||
|
||||
if (fallback->color)
|
||||
computed_color = _gtk_css_value_compute (fallback->color,
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
computed_color = gtk_css_value_compute (fallback->color,
|
||||
property_id,
|
||||
context);
|
||||
|
||||
/* image($color) that didn't change */
|
||||
if (computed_color && !fallback->images &&
|
||||
@@ -168,10 +162,7 @@ gtk_css_image_fallback_compute (GtkCssImage *image,
|
||||
{
|
||||
copy->images[i] = _gtk_css_image_compute (fallback->images[i],
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
context);
|
||||
|
||||
if (gtk_css_image_is_invalid (copy->images[i]))
|
||||
continue;
|
||||
@@ -220,7 +211,7 @@ gtk_css_image_fallback_parse_arg (GtkCssParser *parser,
|
||||
}
|
||||
else
|
||||
{
|
||||
data->color = _gtk_css_color_value_parse (parser);
|
||||
data->color = gtk_css_color_value_parse (parser);
|
||||
if (data->color == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -243,7 +234,7 @@ gtk_css_image_fallback_parse (GtkCssImage *image,
|
||||
|
||||
if (!gtk_css_parser_consume_function (parser, 1, G_MAXUINT, gtk_css_image_fallback_parse_arg, &data))
|
||||
{
|
||||
g_clear_pointer (&data.color, _gtk_css_value_unref);
|
||||
g_clear_pointer (&data.color, gtk_css_value_unref);
|
||||
if (data.images)
|
||||
g_ptr_array_free (data.images, TRUE);
|
||||
return FALSE;
|
||||
@@ -276,7 +267,7 @@ gtk_css_image_fallback_equal (GtkCssImage *image1,
|
||||
if (fallback2->used >= 0)
|
||||
return FALSE;
|
||||
|
||||
return _gtk_css_value_equal (fallback1->color, fallback2->color);
|
||||
return gtk_css_value_equal (fallback1->color, fallback2->color);
|
||||
}
|
||||
|
||||
if (fallback2->used < 0)
|
||||
|
||||
@@ -138,12 +138,9 @@ gtk_css_image_icon_theme_print (GtkCssImage *image,
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_icon_theme_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_image_icon_theme_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
|
||||
GtkCssImageIconTheme *copy;
|
||||
@@ -152,12 +149,12 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
|
||||
|
||||
copy = g_object_new (GTK_TYPE_CSS_IMAGE_ICON_THEME, NULL);
|
||||
copy->name = g_strdup (icon_theme->name);
|
||||
settings = gtk_style_provider_get_settings (provider);
|
||||
settings = gtk_style_provider_get_settings (context->provider);
|
||||
display = _gtk_settings_get_display (settings);
|
||||
copy->icon_theme = gtk_icon_theme_get_for_display (display);
|
||||
copy->serial = gtk_icon_theme_get_serial (copy->icon_theme);
|
||||
copy->scale = gtk_style_provider_get_scale (provider);
|
||||
gtk_css_style_lookup_symbolic_colors (style, copy->colors);
|
||||
copy->scale = gtk_style_provider_get_scale (context->provider);
|
||||
gtk_css_style_lookup_symbolic_colors (context->style, copy->colors);
|
||||
|
||||
return GTK_CSS_IMAGE (copy);
|
||||
}
|
||||
|
||||
+35
-38
@@ -46,7 +46,7 @@ gtk_css_image_linear_get_repeating_start_end (GtkCssImageLinear *linear,
|
||||
if (stop->offset == NULL)
|
||||
*start = 0;
|
||||
else
|
||||
*start = _gtk_css_number_value_get (stop->offset, length) / length;
|
||||
*start = gtk_css_number_value_get (stop->offset, length) / length;
|
||||
|
||||
*end = *start;
|
||||
|
||||
@@ -57,7 +57,7 @@ gtk_css_image_linear_get_repeating_start_end (GtkCssImageLinear *linear,
|
||||
if (stop->offset == NULL)
|
||||
continue;
|
||||
|
||||
pos = _gtk_css_number_value_get (stop->offset, length) / length;
|
||||
pos = gtk_css_number_value_get (stop->offset, length) / length;
|
||||
|
||||
*end = MAX (pos, *end);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
|
||||
}
|
||||
else
|
||||
{
|
||||
angle = _gtk_css_number_value_get (linear->angle, 100);
|
||||
angle = gtk_css_number_value_get (linear->angle, 100);
|
||||
}
|
||||
|
||||
gtk_css_image_linear_compute_start_point (angle,
|
||||
@@ -224,7 +224,7 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = _gtk_css_number_value_get (stop->offset, length) / length;
|
||||
pos = gtk_css_number_value_get (stop->offset, length) / length;
|
||||
pos = CLAMP (pos, 0.0, 1.0);
|
||||
}
|
||||
|
||||
@@ -273,18 +273,18 @@ gtk_css_image_linear_parse_color_stop (GtkCssImageLinear *self,
|
||||
{
|
||||
GtkCssImageLinearColorStop stop;
|
||||
|
||||
stop.color = _gtk_css_color_value_parse (parser);
|
||||
stop.color = gtk_css_color_value_parse (parser);
|
||||
if (stop.color == NULL)
|
||||
return 0;
|
||||
|
||||
if (gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
stop.offset = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
stop.offset = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
if (stop.offset == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (stop.color);
|
||||
gtk_css_value_unref (stop.color);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -359,7 +359,7 @@ gtk_css_image_linear_parse_first_arg (GtkCssImageLinear *linear,
|
||||
}
|
||||
else if (gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
linear->angle = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
linear->angle = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
if (linear->angle == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -464,7 +464,7 @@ gtk_css_image_linear_print (GtkCssImage *image,
|
||||
}
|
||||
else
|
||||
{
|
||||
_gtk_css_value_print (linear->angle, string);
|
||||
gtk_css_value_print (linear->angle, string);
|
||||
g_string_append (string, ", ");
|
||||
}
|
||||
|
||||
@@ -475,12 +475,12 @@ gtk_css_image_linear_print (GtkCssImage *image,
|
||||
if (i > 0)
|
||||
g_string_append (string, ", ");
|
||||
|
||||
_gtk_css_value_print (stop->color, string);
|
||||
gtk_css_value_print (stop->color, string);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
g_string_append (string, " ");
|
||||
_gtk_css_value_print (stop->offset, string);
|
||||
gtk_css_value_print (stop->offset, string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,12 +488,9 @@ gtk_css_image_linear_print (GtkCssImage *image,
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_linear_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_image_linear_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageLinear *linear = GTK_CSS_IMAGE_LINEAR (image);
|
||||
GtkCssImageLinear *copy;
|
||||
@@ -504,7 +501,7 @@ gtk_css_image_linear_compute (GtkCssImage *image,
|
||||
copy->side = linear->side;
|
||||
|
||||
if (linear->angle)
|
||||
copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, style, parent_style, variables);
|
||||
copy->angle = gtk_css_value_compute (linear->angle, property_id, context);
|
||||
|
||||
copy->n_stops = linear->n_stops;
|
||||
copy->color_stops = g_malloc (sizeof (GtkCssImageLinearColorStop) * copy->n_stops);
|
||||
@@ -513,11 +510,11 @@ gtk_css_image_linear_compute (GtkCssImage *image,
|
||||
const GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
|
||||
GtkCssImageLinearColorStop *scopy = ©->color_stops[i];
|
||||
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, variables);
|
||||
scopy->color = gtk_css_value_compute (stop->color, property_id, context);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables);
|
||||
scopy->offset = gtk_css_value_compute (stop->offset, property_id, context);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -559,7 +556,7 @@ gtk_css_image_linear_transition (GtkCssImage *start_image,
|
||||
|
||||
result->side = start->side;
|
||||
if (result->side == 0)
|
||||
result->angle = _gtk_css_value_transition (start->angle, end->angle, property_id, progress);
|
||||
result->angle = gtk_css_value_transition (start->angle, end->angle, property_id, progress);
|
||||
if (result->angle == NULL)
|
||||
goto fail;
|
||||
|
||||
@@ -581,22 +578,22 @@ gtk_css_image_linear_transition (GtkCssImage *start_image,
|
||||
}
|
||||
else
|
||||
{
|
||||
stop->offset = _gtk_css_value_transition (start_stop->offset,
|
||||
end_stop->offset,
|
||||
property_id,
|
||||
progress);
|
||||
stop->offset = gtk_css_value_transition (start_stop->offset,
|
||||
end_stop->offset,
|
||||
property_id,
|
||||
progress);
|
||||
if (stop->offset == NULL)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
stop->color = _gtk_css_value_transition (start_stop->color,
|
||||
end_stop->color,
|
||||
property_id,
|
||||
progress);
|
||||
stop->color = gtk_css_value_transition (start_stop->color,
|
||||
end_stop->color,
|
||||
property_id,
|
||||
progress);
|
||||
if (stop->color == NULL)
|
||||
{
|
||||
if (stop->offset)
|
||||
_gtk_css_value_unref (stop->offset);
|
||||
gtk_css_value_unref (stop->offset);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -620,7 +617,7 @@ gtk_css_image_linear_equal (GtkCssImage *image1,
|
||||
|
||||
if (linear1->repeating != linear2->repeating ||
|
||||
linear1->side != linear2->side ||
|
||||
(linear1->side == 0 && !_gtk_css_value_equal (linear1->angle, linear2->angle)) ||
|
||||
(linear1->side == 0 && !gtk_css_value_equal (linear1->angle, linear2->angle)) ||
|
||||
linear1->n_stops != linear2->n_stops)
|
||||
return FALSE;
|
||||
|
||||
@@ -629,8 +626,8 @@ gtk_css_image_linear_equal (GtkCssImage *image1,
|
||||
const GtkCssImageLinearColorStop *stop1 = &linear1->color_stops[i];
|
||||
const GtkCssImageLinearColorStop *stop2 = &linear2->color_stops[i];
|
||||
|
||||
if (!_gtk_css_value_equal0 (stop1->offset, stop2->offset) ||
|
||||
!_gtk_css_value_equal (stop1->color, stop2->color))
|
||||
if (!gtk_css_value_equal0 (stop1->offset, stop2->offset) ||
|
||||
!gtk_css_value_equal (stop1->color, stop2->color))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -647,16 +644,16 @@ gtk_css_image_linear_dispose (GObject *object)
|
||||
{
|
||||
GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
|
||||
|
||||
_gtk_css_value_unref (stop->color);
|
||||
gtk_css_value_unref (stop->color);
|
||||
if (stop->offset)
|
||||
_gtk_css_value_unref (stop->offset);
|
||||
gtk_css_value_unref (stop->offset);
|
||||
}
|
||||
g_free (linear->color_stops);
|
||||
|
||||
linear->side = 0;
|
||||
if (linear->angle)
|
||||
{
|
||||
_gtk_css_value_unref (linear->angle);
|
||||
gtk_css_value_unref (linear->angle);
|
||||
linear->angle = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkcssimagepaintableprivate.h"
|
||||
#include "gtkcssvalueprivate.h"
|
||||
|
||||
#include "gtkprivate.h"
|
||||
|
||||
@@ -96,12 +97,9 @@ gtk_css_image_paintable_get_static_image (GtkCssImage *image)
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_paintable_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_image_paintable_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return gtk_css_image_paintable_get_static_image (image);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "gtk/css/gtkcssparserprivate.h"
|
||||
#include "gtk/gtkcsstypesprivate.h"
|
||||
#include "gtk/gtkcssvariablesetprivate.h"
|
||||
#include "gtk/gtkcssvalueprivate.h"
|
||||
#include "gtk/gtksnapshot.h"
|
||||
#include "gtk/gtkstyleprovider.h"
|
||||
|
||||
@@ -61,10 +62,7 @@ struct _GtkCssImageClass
|
||||
/* create "computed value" in CSS terms, returns a new reference */
|
||||
GtkCssImage *(* compute) (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables);
|
||||
GtkCssComputeContext *context);
|
||||
/* compare two images for equality */
|
||||
gboolean (* equal) (GtkCssImage *image1,
|
||||
GtkCssImage *image2);
|
||||
@@ -106,10 +104,7 @@ double _gtk_css_image_get_aspect_ratio (GtkCssImage *
|
||||
|
||||
GtkCssImage * _gtk_css_image_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables);
|
||||
GtkCssComputeContext *context);
|
||||
gboolean _gtk_css_image_equal (GtkCssImage *image1,
|
||||
GtkCssImage *image2) G_GNUC_PURE;
|
||||
GtkCssImage * _gtk_css_image_transition (GtkCssImage *start,
|
||||
|
||||
+50
-53
@@ -47,7 +47,7 @@ gtk_css_image_radial_get_start_end (GtkCssImageRadial *radial,
|
||||
if (stop->offset == NULL)
|
||||
*start = 0;
|
||||
else
|
||||
*start = _gtk_css_number_value_get (stop->offset, radius) / radius;
|
||||
*start = gtk_css_number_value_get (stop->offset, radius) / radius;
|
||||
|
||||
*end = *start;
|
||||
|
||||
@@ -58,7 +58,7 @@ gtk_css_image_radial_get_start_end (GtkCssImageRadial *radial,
|
||||
if (stop->offset == NULL)
|
||||
continue;
|
||||
|
||||
pos = _gtk_css_number_value_get (stop->offset, radius) / radius;
|
||||
pos = gtk_css_number_value_get (stop->offset, radius) / radius;
|
||||
|
||||
*end = MAX (pos, *end);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
|
||||
switch (radial->size)
|
||||
{
|
||||
case GTK_CSS_EXPLICIT_SIZE:
|
||||
hradius = _gtk_css_number_value_get (radial->sizes[0], width);
|
||||
hradius = gtk_css_number_value_get (radial->sizes[0], width);
|
||||
break;
|
||||
case GTK_CSS_CLOSEST_SIDE:
|
||||
hradius = MIN (MIN (x, width - x), MIN (y, height - y));
|
||||
@@ -128,8 +128,8 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
|
||||
switch (radial->size)
|
||||
{
|
||||
case GTK_CSS_EXPLICIT_SIZE:
|
||||
hradius = _gtk_css_number_value_get (radial->sizes[0], width);
|
||||
vradius = _gtk_css_number_value_get (radial->sizes[1], height);
|
||||
hradius = gtk_css_number_value_get (radial->sizes[0], width);
|
||||
vradius = gtk_css_number_value_get (radial->sizes[1], height);
|
||||
break;
|
||||
case GTK_CSS_CLOSEST_SIDE:
|
||||
hradius = MIN (x, width - x);
|
||||
@@ -176,7 +176,7 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
|
||||
continue;
|
||||
}
|
||||
else
|
||||
pos = MIN (1.0, _gtk_css_number_value_get (stop->offset, hradius) / hradius);
|
||||
pos = MIN (1.0, gtk_css_number_value_get (stop->offset, hradius) / hradius);
|
||||
|
||||
pos = MAX (pos, offset);
|
||||
step = (pos - offset) / (i - last);
|
||||
@@ -223,18 +223,18 @@ gtk_css_image_radial_parse_color_stop (GtkCssImageRadial *radial,
|
||||
{
|
||||
GtkCssImageRadialColorStop stop;
|
||||
|
||||
stop.color = _gtk_css_color_value_parse (parser);
|
||||
stop.color = gtk_css_color_value_parse (parser);
|
||||
if (stop.color == NULL)
|
||||
return 0;
|
||||
|
||||
if (gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
stop.offset = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
stop.offset = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
if (stop.offset == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (stop.color);
|
||||
gtk_css_value_unref (stop.color);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -294,12 +294,12 @@ gtk_css_image_radial_parse_first_arg (GtkCssImageRadial *radial,
|
||||
|
||||
if (!has_size && gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
radial->sizes[0] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_PARSE_PERCENT);
|
||||
radial->sizes[0] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_PARSE_PERCENT);
|
||||
if (radial->sizes[0] == NULL)
|
||||
return 0;
|
||||
if (gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
radial->sizes[1] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_PARSE_PERCENT);
|
||||
radial->sizes[1] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_PARSE_PERCENT);
|
||||
if (radial->sizes[1] == NULL)
|
||||
return 0;
|
||||
}
|
||||
@@ -323,8 +323,8 @@ gtk_css_image_radial_parse_first_arg (GtkCssImageRadial *radial,
|
||||
}
|
||||
else
|
||||
{
|
||||
radial->position = _gtk_css_position_value_new (_gtk_css_number_value_new (50, GTK_CSS_PERCENT),
|
||||
_gtk_css_number_value_new (50, GTK_CSS_PERCENT));
|
||||
radial->position = _gtk_css_position_value_new (gtk_css_number_value_new (50, GTK_CSS_PERCENT),
|
||||
gtk_css_number_value_new (50, GTK_CSS_PERCENT));
|
||||
}
|
||||
|
||||
if (!has_size)
|
||||
@@ -358,7 +358,7 @@ gtk_css_image_radial_parse_first_arg (GtkCssImageRadial *radial,
|
||||
if (has_size && !radial->circle)
|
||||
{
|
||||
if (radial->sizes[0] && !radial->sizes[1])
|
||||
radial->sizes[1] = _gtk_css_value_ref (radial->sizes[0]);
|
||||
radial->sizes[1] = gtk_css_value_ref (radial->sizes[0]);
|
||||
}
|
||||
|
||||
if (found_one)
|
||||
@@ -456,16 +456,16 @@ gtk_css_image_radial_print (GtkCssImage *image,
|
||||
else
|
||||
{
|
||||
if (radial->sizes[0])
|
||||
_gtk_css_value_print (radial->sizes[0], string);
|
||||
gtk_css_value_print (radial->sizes[0], string);
|
||||
if (radial->sizes[1])
|
||||
{
|
||||
g_string_append (string, " ");
|
||||
_gtk_css_value_print (radial->sizes[1], string);
|
||||
gtk_css_value_print (radial->sizes[1], string);
|
||||
}
|
||||
}
|
||||
|
||||
g_string_append (string, " at ");
|
||||
_gtk_css_value_print (radial->position, string);
|
||||
gtk_css_value_print (radial->position, string);
|
||||
|
||||
g_string_append (string, ", ");
|
||||
|
||||
@@ -476,12 +476,12 @@ gtk_css_image_radial_print (GtkCssImage *image,
|
||||
if (i > 0)
|
||||
g_string_append (string, ", ");
|
||||
|
||||
_gtk_css_value_print (stop->color, string);
|
||||
gtk_css_value_print (stop->color, string);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
g_string_append (string, " ");
|
||||
_gtk_css_value_print (stop->offset, string);
|
||||
gtk_css_value_print (stop->offset, string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,12 +489,9 @@ gtk_css_image_radial_print (GtkCssImage *image,
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_radial_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_image_radial_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageRadial *radial = GTK_CSS_IMAGE_RADIAL (image);
|
||||
GtkCssImageRadial *copy;
|
||||
@@ -505,13 +502,13 @@ gtk_css_image_radial_compute (GtkCssImage *image,
|
||||
copy->circle = radial->circle;
|
||||
copy->size = radial->size;
|
||||
|
||||
copy->position = _gtk_css_value_compute (radial->position, property_id, provider, style, parent_style, variables);
|
||||
copy->position = gtk_css_value_compute (radial->position, property_id, context);
|
||||
|
||||
if (radial->sizes[0])
|
||||
copy->sizes[0] = _gtk_css_value_compute (radial->sizes[0], property_id, provider, style, parent_style, variables);
|
||||
copy->sizes[0] = gtk_css_value_compute (radial->sizes[0], property_id, context);
|
||||
|
||||
if (radial->sizes[1])
|
||||
copy->sizes[1] = _gtk_css_value_compute (radial->sizes[1], property_id, provider, style, parent_style, variables);
|
||||
copy->sizes[1] = gtk_css_value_compute (radial->sizes[1], property_id, context);
|
||||
|
||||
copy->n_stops = radial->n_stops;
|
||||
copy->color_stops = g_malloc (sizeof (GtkCssImageRadialColorStop) * copy->n_stops);
|
||||
@@ -520,11 +517,11 @@ gtk_css_image_radial_compute (GtkCssImage *image,
|
||||
const GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
|
||||
GtkCssImageRadialColorStop *scopy = ©->color_stops[i];
|
||||
|
||||
scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style, variables);
|
||||
scopy->color = gtk_css_value_compute (stop->color, property_id, context);
|
||||
|
||||
if (stop->offset)
|
||||
{
|
||||
scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style, variables);
|
||||
scopy->offset = gtk_css_value_compute (stop->offset, property_id, context);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -565,13 +562,13 @@ gtk_css_image_radial_transition (GtkCssImage *start_image,
|
||||
result->circle = start->circle;
|
||||
result->size = start->size;
|
||||
|
||||
result->position = _gtk_css_value_transition (start->position, end->position, property_id, progress);
|
||||
result->position = gtk_css_value_transition (start->position, end->position, property_id, progress);
|
||||
if (result->position == NULL)
|
||||
goto fail;
|
||||
|
||||
if (start->sizes[0] && end->sizes[0])
|
||||
{
|
||||
result->sizes[0] = _gtk_css_value_transition (start->sizes[0], end->sizes[0], property_id, progress);
|
||||
result->sizes[0] = gtk_css_value_transition (start->sizes[0], end->sizes[0], property_id, progress);
|
||||
if (result->sizes[0] == NULL)
|
||||
goto fail;
|
||||
}
|
||||
@@ -580,7 +577,7 @@ gtk_css_image_radial_transition (GtkCssImage *start_image,
|
||||
|
||||
if (start->sizes[1] && end->sizes[1])
|
||||
{
|
||||
result->sizes[1] = _gtk_css_value_transition (start->sizes[1], end->sizes[1], property_id, progress);
|
||||
result->sizes[1] = gtk_css_value_transition (start->sizes[1], end->sizes[1], property_id, progress);
|
||||
if (result->sizes[1] == NULL)
|
||||
goto fail;
|
||||
}
|
||||
@@ -604,22 +601,22 @@ gtk_css_image_radial_transition (GtkCssImage *start_image,
|
||||
}
|
||||
else
|
||||
{
|
||||
stop->offset = _gtk_css_value_transition (start_stop->offset,
|
||||
end_stop->offset,
|
||||
property_id,
|
||||
progress);
|
||||
stop->offset = gtk_css_value_transition (start_stop->offset,
|
||||
end_stop->offset,
|
||||
property_id,
|
||||
progress);
|
||||
if (stop->offset == NULL)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
stop->color = _gtk_css_value_transition (start_stop->color,
|
||||
end_stop->color,
|
||||
property_id,
|
||||
progress);
|
||||
stop->color = gtk_css_value_transition (start_stop->color,
|
||||
end_stop->color,
|
||||
property_id,
|
||||
progress);
|
||||
if (stop->color == NULL)
|
||||
{
|
||||
if (stop->offset)
|
||||
_gtk_css_value_unref (stop->offset);
|
||||
gtk_css_value_unref (stop->offset);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -643,11 +640,11 @@ gtk_css_image_radial_equal (GtkCssImage *image1,
|
||||
|
||||
if (radial1->repeating != radial2->repeating ||
|
||||
radial1->size != radial2->size ||
|
||||
!_gtk_css_value_equal (radial1->position, radial2->position) ||
|
||||
!gtk_css_value_equal (radial1->position, radial2->position) ||
|
||||
((radial1->sizes[0] == NULL) != (radial2->sizes[0] == NULL)) ||
|
||||
(radial1->sizes[0] && radial2->sizes[0] && !_gtk_css_value_equal (radial1->sizes[0], radial2->sizes[0])) ||
|
||||
(radial1->sizes[0] && radial2->sizes[0] && !gtk_css_value_equal (radial1->sizes[0], radial2->sizes[0])) ||
|
||||
((radial1->sizes[1] == NULL) != (radial2->sizes[1] == NULL)) ||
|
||||
(radial1->sizes[1] && radial2->sizes[1] && !_gtk_css_value_equal (radial1->sizes[1], radial2->sizes[1])) ||
|
||||
(radial1->sizes[1] && radial2->sizes[1] && !gtk_css_value_equal (radial1->sizes[1], radial2->sizes[1])) ||
|
||||
radial1->n_stops != radial2->n_stops)
|
||||
return FALSE;
|
||||
|
||||
@@ -656,8 +653,8 @@ gtk_css_image_radial_equal (GtkCssImage *image1,
|
||||
const GtkCssImageRadialColorStop *stop1 = &radial1->color_stops[i];
|
||||
const GtkCssImageRadialColorStop *stop2 = &radial2->color_stops[i];
|
||||
|
||||
if (!_gtk_css_value_equal0 (stop1->offset, stop2->offset) ||
|
||||
!_gtk_css_value_equal (stop1->color, stop2->color))
|
||||
if (!gtk_css_value_equal0 (stop1->offset, stop2->offset) ||
|
||||
!gtk_css_value_equal (stop1->color, stop2->color))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -674,22 +671,22 @@ gtk_css_image_radial_dispose (GObject *object)
|
||||
{
|
||||
GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
|
||||
|
||||
_gtk_css_value_unref (stop->color);
|
||||
gtk_css_value_unref (stop->color);
|
||||
if (stop->offset)
|
||||
_gtk_css_value_unref (stop->offset);
|
||||
gtk_css_value_unref (stop->offset);
|
||||
}
|
||||
g_free (radial->color_stops);
|
||||
|
||||
if (radial->position)
|
||||
{
|
||||
_gtk_css_value_unref (radial->position);
|
||||
gtk_css_value_unref (radial->position);
|
||||
radial->position = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
if (radial->sizes[i])
|
||||
{
|
||||
_gtk_css_value_unref (radial->sizes[i]);
|
||||
gtk_css_value_unref (radial->sizes[i]);
|
||||
radial->sizes[i] = NULL;
|
||||
}
|
||||
|
||||
|
||||
+12
-15
@@ -44,7 +44,7 @@ gtk_css_image_recolor_print (GtkCssImage *image,
|
||||
if (recolor->palette)
|
||||
{
|
||||
g_string_append (string, ",");
|
||||
_gtk_css_value_print (recolor->palette, string);
|
||||
gtk_css_value_print (recolor->palette, string);
|
||||
}
|
||||
g_string_append (string, ")");
|
||||
}
|
||||
@@ -54,7 +54,7 @@ gtk_css_image_recolor_dispose (GObject *object)
|
||||
{
|
||||
GtkCssImageRecolor *recolor = GTK_CSS_IMAGE_RECOLOR (object);
|
||||
|
||||
g_clear_pointer (&recolor->palette, _gtk_css_value_unref);
|
||||
g_clear_pointer (&recolor->palette, gtk_css_value_unref);
|
||||
g_clear_object (&recolor->file);
|
||||
g_clear_object (&recolor->texture);
|
||||
|
||||
@@ -201,12 +201,9 @@ gtk_css_image_recolor_snapshot (GtkCssImage *image,
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_recolor_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_image_recolor_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageRecolor *recolor = GTK_CSS_IMAGE_RECOLOR (image);
|
||||
GtkCssValue *palette;
|
||||
@@ -214,23 +211,23 @@ gtk_css_image_recolor_compute (GtkCssImage *image,
|
||||
int scale;
|
||||
GError *error = NULL;
|
||||
|
||||
scale = gtk_style_provider_get_scale (provider);
|
||||
scale = gtk_style_provider_get_scale (context->provider);
|
||||
|
||||
if (recolor->palette)
|
||||
palette = _gtk_css_value_compute (recolor->palette, property_id, provider, style, parent_style, variables);
|
||||
palette = gtk_css_value_compute (recolor->palette, property_id, context);
|
||||
else
|
||||
palette = _gtk_css_value_ref (style->core->icon_palette);
|
||||
palette = gtk_css_value_ref (context->style->core->icon_palette);
|
||||
|
||||
img = gtk_css_image_recolor_load (recolor, style, palette, scale, &error);
|
||||
img = gtk_css_image_recolor_load (recolor, context->style, palette, scale, &error);
|
||||
|
||||
if (error)
|
||||
{
|
||||
GtkCssSection *section = gtk_css_style_get_section (style, property_id);
|
||||
gtk_style_provider_emit_error (provider, section, error);
|
||||
GtkCssSection *section = gtk_css_style_get_section (context->style, property_id);
|
||||
gtk_style_provider_emit_error (context->provider, section, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
_gtk_css_value_unref (palette);
|
||||
gtk_css_value_unref (palette);
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
+5
-11
@@ -97,12 +97,9 @@ gtk_css_image_scaled_dispose (GObject *object)
|
||||
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_scaled_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_image_scaled_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageScaled *scaled = GTK_CSS_IMAGE_SCALED (image);
|
||||
int scale;
|
||||
@@ -110,7 +107,7 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
|
||||
int i;
|
||||
int best;
|
||||
|
||||
scale = gtk_style_provider_get_scale (provider);
|
||||
scale = gtk_style_provider_get_scale (context->provider);
|
||||
scale = MAX(scale, 1);
|
||||
|
||||
best = 0;
|
||||
@@ -136,10 +133,7 @@ gtk_css_image_scaled_compute (GtkCssImage *image,
|
||||
|
||||
res->images[0] = _gtk_css_image_compute (scaled->images[best],
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
context);
|
||||
res->scales[0] = scaled->scales[best];
|
||||
|
||||
return GTK_CSS_IMAGE (res);
|
||||
|
||||
@@ -112,12 +112,9 @@ gtk_css_image_url_snapshot (GtkCssImage *image,
|
||||
}
|
||||
|
||||
static GtkCssImage *
|
||||
gtk_css_image_url_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_image_url_compute (GtkCssImage *image,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
|
||||
GtkCssImage *copy;
|
||||
@@ -126,8 +123,8 @@ gtk_css_image_url_compute (GtkCssImage *image,
|
||||
copy = gtk_css_image_url_load_image (url, &error);
|
||||
if (error)
|
||||
{
|
||||
GtkCssSection *section = gtk_css_style_get_section (style, property_id);
|
||||
gtk_style_provider_emit_error (provider, section, error);
|
||||
GtkCssSection *section = gtk_css_style_get_section (context->style, property_id);
|
||||
gtk_style_provider_emit_error (context->provider, section, error);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
|
||||
+8
-11
@@ -34,26 +34,23 @@ gtk_css_value_image_free (GtkCssValue *value)
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_image_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_image_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssImage *image, *computed;
|
||||
|
||||
image = _gtk_css_image_value_get_image (value);
|
||||
|
||||
if (image == NULL)
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
|
||||
computed = _gtk_css_image_compute (image, property_id, provider, style, parent_style, variables);
|
||||
computed = _gtk_css_image_compute (image, property_id, context);
|
||||
|
||||
if (computed == image)
|
||||
{
|
||||
g_object_unref (computed);
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
return _gtk_css_image_value_new (computed);
|
||||
@@ -141,9 +138,9 @@ _gtk_css_image_value_new (GtkCssImage *image)
|
||||
GtkCssValue *value;
|
||||
|
||||
if (image == NULL)
|
||||
return _gtk_css_value_ref (&image_none_singleton);
|
||||
return gtk_css_value_ref (&image_none_singleton);
|
||||
|
||||
value = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_IMAGE);
|
||||
value = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_IMAGE);
|
||||
value->image = image;
|
||||
value->is_computed = gtk_css_image_is_computed (image);
|
||||
|
||||
|
||||
@@ -34,25 +34,19 @@ gtk_css_value_inherit_free (GtkCssValue *value)
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_inherit_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_inherit_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
if (parent_style)
|
||||
if (context->parent_style)
|
||||
{
|
||||
return _gtk_css_value_ref (gtk_css_style_get_value (parent_style, property_id));
|
||||
return gtk_css_value_ref (gtk_css_style_get_value (context->parent_style, property_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
return _gtk_css_value_compute (_gtk_css_initial_value_get (),
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
return gtk_css_value_compute (_gtk_css_initial_value_get (),
|
||||
property_id,
|
||||
context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +89,7 @@ static GtkCssValue inherit = { >K_CSS_VALUE_INHERIT, 1 };
|
||||
GtkCssValue *
|
||||
_gtk_css_inherit_value_new (void)
|
||||
{
|
||||
return _gtk_css_value_ref (&inherit);
|
||||
return gtk_css_value_ref (&inherit);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
|
||||
+12
-23
@@ -38,19 +38,16 @@ gtk_css_value_initial_free (GtkCssValue *value)
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case GTK_CSS_PROPERTY_DPI:
|
||||
settings = gtk_style_provider_get_settings (provider);
|
||||
settings = gtk_style_provider_get_settings (context->provider);
|
||||
if (settings)
|
||||
{
|
||||
int dpi_int;
|
||||
@@ -58,12 +55,12 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
g_object_get (settings, "gtk-xft-dpi", &dpi_int, NULL);
|
||||
|
||||
if (dpi_int > 0.0)
|
||||
return _gtk_css_number_value_new (dpi_int / 1024., GTK_CSS_NUMBER);
|
||||
return gtk_css_number_value_new (dpi_int / 1024., GTK_CSS_NUMBER);
|
||||
}
|
||||
break;
|
||||
|
||||
case GTK_CSS_PROPERTY_FONT_FAMILY:
|
||||
settings = gtk_style_provider_get_settings (provider);
|
||||
settings = gtk_style_provider_get_settings (context->provider);
|
||||
if (settings && gtk_settings_get_font_family (settings) != NULL)
|
||||
return _gtk_css_array_value_new (_gtk_css_string_value_new (gtk_settings_get_font_family (settings)));
|
||||
break;
|
||||
@@ -72,12 +69,9 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
break;
|
||||
}
|
||||
|
||||
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
|
||||
return gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -119,7 +113,7 @@ static GtkCssValue initial = { >K_CSS_VALUE_INITIAL, 1 };
|
||||
GtkCssValue *
|
||||
_gtk_css_initial_value_new (void)
|
||||
{
|
||||
return _gtk_css_value_ref (&initial);
|
||||
return gtk_css_value_ref (&initial);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
@@ -128,15 +122,10 @@ _gtk_css_initial_value_get (void)
|
||||
return &initial;
|
||||
}
|
||||
GtkCssValue *
|
||||
_gtk_css_initial_value_new_compute (guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style)
|
||||
_gtk_css_initial_value_new_compute (guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return gtk_css_value_initial_compute (NULL,
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
NULL);
|
||||
context);
|
||||
}
|
||||
|
||||
@@ -25,10 +25,8 @@ G_BEGIN_DECLS
|
||||
|
||||
GtkCssValue * _gtk_css_initial_value_new (void);
|
||||
GtkCssValue * _gtk_css_initial_value_get (void);
|
||||
GtkCssValue * _gtk_css_initial_value_new_compute (guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style);
|
||||
GtkCssValue * _gtk_css_initial_value_new_compute (guint property_id,
|
||||
GtkCssComputeContext *context);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
+23
-19
@@ -74,7 +74,7 @@ _gtk_css_keyframes_unref (GtkCssKeyframes *keyframes)
|
||||
{
|
||||
for (p = 0; p < keyframes->n_properties; p++)
|
||||
{
|
||||
_gtk_css_value_unref (KEYFRAMES_VALUE (keyframes, k, p));
|
||||
gtk_css_value_unref (KEYFRAMES_VALUE (keyframes, k, p));
|
||||
KEYFRAMES_VALUE (keyframes, k, p) = NULL;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ gtk_css_keyframes_add_keyframe (GtkCssKeyframes *keyframes,
|
||||
if (KEYFRAMES_VALUE (keyframes, k, p) == NULL)
|
||||
continue;
|
||||
|
||||
_gtk_css_value_unref (KEYFRAMES_VALUE (keyframes, k, p));
|
||||
gtk_css_value_unref (KEYFRAMES_VALUE (keyframes, k, p));
|
||||
KEYFRAMES_VALUE (keyframes, k, p) = NULL;
|
||||
|
||||
/* XXX: GC properties that are now unset
|
||||
@@ -244,9 +244,9 @@ keyframes_set_value (GtkCssKeyframes *keyframes,
|
||||
p = gtk_css_keyframes_lookup_property (keyframes, _gtk_css_style_property_get_id (property));
|
||||
|
||||
if (KEYFRAMES_VALUE (keyframes, k, p))
|
||||
_gtk_css_value_unref (KEYFRAMES_VALUE (keyframes, k, p));
|
||||
gtk_css_value_unref (KEYFRAMES_VALUE (keyframes, k, p));
|
||||
|
||||
KEYFRAMES_VALUE (keyframes, k, p) = _gtk_css_value_ref (value);
|
||||
KEYFRAMES_VALUE (keyframes, k, p) = gtk_css_value_ref (value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ gtk_css_keyframes_parse_declaration (GtkCssKeyframes *keyframes,
|
||||
if (!gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_EOF))
|
||||
{
|
||||
gtk_css_parser_error_syntax (parser, "Junk at end of value");
|
||||
_gtk_css_value_unref (value);
|
||||
gtk_css_value_unref (value);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ gtk_css_keyframes_parse_declaration (GtkCssKeyframes *keyframes,
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
_gtk_css_value_unref (value);
|
||||
gtk_css_value_unref (value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -566,7 +566,7 @@ _gtk_css_keyframes_print (GtkCssKeyframes *keyframes,
|
||||
GTK_STYLE_PROPERTY (
|
||||
_gtk_css_style_property_lookup_by_id (
|
||||
keyframes->property_ids[sorted[p]]))));
|
||||
_gtk_css_value_print (KEYFRAMES_VALUE (keyframes, k, sorted[p]), string);
|
||||
gtk_css_value_print (KEYFRAMES_VALUE (keyframes, k, sorted[p]), string);
|
||||
g_string_append (string, ";\n");
|
||||
}
|
||||
|
||||
@@ -615,6 +615,7 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
GtkCssKeyframes *resolved;
|
||||
guint k, p;
|
||||
|
||||
@@ -630,6 +631,10 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
|
||||
resolved->property_ids = g_memdup2 (keyframes->property_ids, keyframes->n_properties * sizeof (guint));
|
||||
resolved->values = g_new0 (GtkCssValue *, resolved->n_keyframes * resolved->n_properties);
|
||||
|
||||
context.provider = provider;
|
||||
context.style = style;
|
||||
context.parent_style = parent_style;
|
||||
|
||||
for (p = 0; p < resolved->n_properties; p++)
|
||||
{
|
||||
for (k = 0; k < resolved->n_keyframes; k++)
|
||||
@@ -637,12 +642,11 @@ _gtk_css_keyframes_compute (GtkCssKeyframes *keyframes,
|
||||
if (KEYFRAMES_VALUE (keyframes, k, p) == NULL)
|
||||
continue;
|
||||
|
||||
KEYFRAMES_VALUE (resolved, k, p) = _gtk_css_value_compute (KEYFRAMES_VALUE (keyframes, k, p),
|
||||
resolved->property_ids[p],
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
keyframes->variables ? keyframes->variables[k] : NULL);
|
||||
context.variables = keyframes->variables ? keyframes->variables[k] : NULL;
|
||||
|
||||
KEYFRAMES_VALUE (resolved, k, p) = gtk_css_value_compute (KEYFRAMES_VALUE (keyframes, k, p),
|
||||
resolved->property_ids[p],
|
||||
&context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -708,7 +712,7 @@ _gtk_css_keyframes_get_value (GtkCssKeyframes *keyframes,
|
||||
|
||||
if (keyframes->keyframe_progress[k] == progress)
|
||||
{
|
||||
return _gtk_css_value_ref (KEYFRAMES_VALUE (keyframes, k, id));
|
||||
return gtk_css_value_ref (KEYFRAMES_VALUE (keyframes, k, id));
|
||||
}
|
||||
else if (keyframes->keyframe_progress[k] < progress)
|
||||
{
|
||||
@@ -725,14 +729,14 @@ _gtk_css_keyframes_get_value (GtkCssKeyframes *keyframes,
|
||||
|
||||
progress = (progress - start_progress) / (end_progress - start_progress);
|
||||
|
||||
result = _gtk_css_value_transition (start_value,
|
||||
end_value,
|
||||
keyframes->property_ids[id],
|
||||
progress);
|
||||
result = gtk_css_value_transition (start_value,
|
||||
end_value,
|
||||
keyframes->property_ids[id],
|
||||
progress);
|
||||
|
||||
/* XXX: Dear spec, what's the correct thing to do here? */
|
||||
if (result == NULL)
|
||||
return _gtk_css_value_ref (start_value);
|
||||
return gtk_css_value_ref (start_value);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+19
-22
@@ -34,31 +34,28 @@ static GtkCssValue *gtk_css_value_line_height_new (GtkCssValue *height);
|
||||
static void
|
||||
gtk_css_value_line_height_free (GtkCssValue *value)
|
||||
{
|
||||
_gtk_css_value_unref (value->height);
|
||||
gtk_css_value_unref (value->height);
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_line_height_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_line_height_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *height;
|
||||
|
||||
height = _gtk_css_value_compute (value->height, property_id, provider, style, parent_style, variables);
|
||||
height = gtk_css_value_compute (value->height, property_id, context);
|
||||
|
||||
if (gtk_css_number_value_get_dimension (height) == GTK_CSS_DIMENSION_PERCENTAGE)
|
||||
{
|
||||
double factor;
|
||||
GtkCssValue *computed;
|
||||
|
||||
factor = _gtk_css_number_value_get (height, 1);
|
||||
computed = gtk_css_number_value_multiply (style->core->font_size, factor);
|
||||
factor = gtk_css_number_value_get (height, 1);
|
||||
computed = gtk_css_number_value_multiply (context->style->core->font_size, factor);
|
||||
|
||||
_gtk_css_value_unref (height);
|
||||
gtk_css_value_unref (height);
|
||||
|
||||
return computed;
|
||||
}
|
||||
@@ -75,7 +72,7 @@ gtk_css_value_line_height_equal (const GtkCssValue *value1,
|
||||
if (value1->height == NULL || value2->height == NULL)
|
||||
return FALSE;
|
||||
|
||||
return _gtk_css_value_equal (value1->height, value2->height);
|
||||
return gtk_css_value_equal (value1->height, value2->height);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -89,7 +86,7 @@ gtk_css_value_line_height_transition (GtkCssValue *start,
|
||||
if (start->height == NULL || end->height == NULL)
|
||||
return NULL;
|
||||
|
||||
height = _gtk_css_value_transition (start->height, end->height, property_id, progress);
|
||||
height = gtk_css_value_transition (start->height, end->height, property_id, progress);
|
||||
if (height == NULL)
|
||||
return NULL;
|
||||
|
||||
@@ -103,7 +100,7 @@ gtk_css_value_line_height_print (const GtkCssValue *value,
|
||||
if (value->height == NULL)
|
||||
g_string_append (string, "normal");
|
||||
else
|
||||
_gtk_css_value_print (value->height, string);
|
||||
gtk_css_value_print (value->height, string);
|
||||
}
|
||||
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_LINE_HEIGHT = {
|
||||
@@ -122,7 +119,7 @@ gtk_css_value_line_height_new_empty (void)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_LINE_HEIGHT);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_LINE_HEIGHT);
|
||||
result->height = NULL;
|
||||
result->is_computed = TRUE;
|
||||
|
||||
@@ -134,7 +131,7 @@ gtk_css_value_line_height_new (GtkCssValue *height)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_LINE_HEIGHT);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_LINE_HEIGHT);
|
||||
result->height = height;
|
||||
|
||||
return result;
|
||||
@@ -155,12 +152,12 @@ gtk_css_line_height_value_parse (GtkCssParser *parser)
|
||||
GtkCssValue *height;
|
||||
|
||||
if (gtk_css_parser_try_ident (parser, "normal"))
|
||||
return _gtk_css_value_ref (gtk_css_line_height_value_get_default ());
|
||||
return gtk_css_value_ref (gtk_css_line_height_value_get_default ());
|
||||
|
||||
height = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER |
|
||||
GTK_CSS_PARSE_PERCENT |
|
||||
GTK_CSS_PARSE_LENGTH |
|
||||
GTK_CSS_POSITIVE_ONLY);
|
||||
height = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER |
|
||||
GTK_CSS_PARSE_PERCENT |
|
||||
GTK_CSS_PARSE_LENGTH |
|
||||
GTK_CSS_POSITIVE_ONLY);
|
||||
if (!height)
|
||||
return NULL;
|
||||
|
||||
@@ -173,5 +170,5 @@ gtk_css_line_height_value_get (const GtkCssValue *value)
|
||||
if (value->class == >K_CSS_VALUE_LINE_HEIGHT)
|
||||
return 0.0;
|
||||
|
||||
return _gtk_css_number_value_get (value, 1);
|
||||
return gtk_css_number_value_get (value, 1);
|
||||
}
|
||||
|
||||
+1315
-263
File diff suppressed because it is too large
Load Diff
@@ -36,13 +36,15 @@ typedef enum /*< skip >*/ {
|
||||
GTK_CSS_PARSE_TIME = (1 << 5)
|
||||
} GtkCssNumberParseFlags;
|
||||
|
||||
#define GTK_CSS_PARSE_DIMENSION (GTK_CSS_PARSE_LENGTH|GTK_CSS_PARSE_ANGLE|GTK_CSS_PARSE_TIME)
|
||||
|
||||
GtkCssValue * gtk_css_dimension_value_new (double value,
|
||||
GtkCssUnit unit);
|
||||
|
||||
GtkCssValue * _gtk_css_number_value_new (double value,
|
||||
GtkCssValue * gtk_css_number_value_new (double value,
|
||||
GtkCssUnit unit);
|
||||
gboolean gtk_css_number_value_can_parse (GtkCssParser *parser);
|
||||
GtkCssValue * _gtk_css_number_value_parse (GtkCssParser *parser,
|
||||
GtkCssValue * gtk_css_number_value_parse (GtkCssParser *parser,
|
||||
GtkCssNumberParseFlags flags);
|
||||
|
||||
GtkCssDimension gtk_css_number_value_get_dimension (const GtkCssValue *value) G_GNUC_PURE;
|
||||
@@ -53,10 +55,24 @@ GtkCssValue * gtk_css_number_value_add (GtkCssValue *val
|
||||
GtkCssValue *value2);
|
||||
GtkCssValue * gtk_css_number_value_try_add (GtkCssValue *value1,
|
||||
GtkCssValue *value2);
|
||||
double _gtk_css_number_value_get (const GtkCssValue *number,
|
||||
double gtk_css_number_value_get (const GtkCssValue *number,
|
||||
double one_hundred_percent) G_GNUC_PURE;
|
||||
double gtk_css_number_value_get_canonical (GtkCssValue *number,
|
||||
double one_hundred_percent) G_GNUC_PURE;
|
||||
|
||||
gboolean gtk_css_dimension_value_is_zero (const GtkCssValue *value) G_GNUC_PURE;
|
||||
|
||||
enum {
|
||||
ROUND_NEAREST,
|
||||
ROUND_UP,
|
||||
ROUND_DOWN,
|
||||
ROUND_TO_ZERO,
|
||||
};
|
||||
|
||||
GtkCssValue * gtk_css_math_value_new (guint type,
|
||||
guint mode,
|
||||
GtkCssValue **values,
|
||||
guint n_values);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+21
-24
@@ -94,7 +94,7 @@ gtk_css_value_palette_free (GtkCssValue *value)
|
||||
for (i = 0; i < value->n_colors; i ++)
|
||||
{
|
||||
g_free (value->color_names[i]);
|
||||
_gtk_css_value_unref (value->color_values[i]);
|
||||
gtk_css_value_unref (value->color_values[i]);
|
||||
}
|
||||
|
||||
g_free (value->color_names);
|
||||
@@ -103,12 +103,9 @@ gtk_css_value_palette_free (GtkCssValue *value)
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_palette_compute (GtkCssValue *specified,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_palette_compute (GtkCssValue *specified,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *computed_color;
|
||||
GtkCssValue *result;
|
||||
@@ -121,7 +118,7 @@ gtk_css_value_palette_compute (GtkCssValue *specified,
|
||||
{
|
||||
GtkCssValue *value = specified->color_values[i];
|
||||
|
||||
computed_color = _gtk_css_value_compute (value, property_id, provider, style, parent_style, variables);
|
||||
computed_color = gtk_css_value_compute (value, property_id, context);
|
||||
result->color_names[i] = g_strdup (specified->color_names[i]);
|
||||
result->color_values[i] = computed_color;
|
||||
|
||||
@@ -130,8 +127,8 @@ gtk_css_value_palette_compute (GtkCssValue *specified,
|
||||
|
||||
if (!changes)
|
||||
{
|
||||
_gtk_css_value_unref (result);
|
||||
result = _gtk_css_value_ref (specified);
|
||||
gtk_css_value_unref (result);
|
||||
result = gtk_css_value_ref (specified);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -151,7 +148,7 @@ gtk_css_value_palette_equal (const GtkCssValue *value1,
|
||||
if (strcmp (value1->color_names[i], value2->color_names[i]) != 0)
|
||||
return FALSE;
|
||||
|
||||
if (!_gtk_css_value_equal (value1->color_values[i], value2->color_values[i]))
|
||||
if (!gtk_css_value_equal (value1->color_values[i], value2->color_values[i]))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -187,9 +184,9 @@ gtk_css_value_palette_transition (GtkCssValue *start,
|
||||
end_color = gtk_css_palette_value_find_color (end, name);
|
||||
|
||||
if (end_color == NULL)
|
||||
transition = _gtk_css_value_ref (start_color);
|
||||
transition = gtk_css_value_ref (start_color);
|
||||
else
|
||||
transition = _gtk_css_value_transition (start_color, end_color, property_id, progress);
|
||||
transition = gtk_css_value_transition (start_color, end_color, property_id, progress);
|
||||
|
||||
g_ptr_array_add (new_names, g_strdup (name));
|
||||
g_ptr_array_add (new_values, transition);
|
||||
@@ -205,7 +202,7 @@ gtk_css_value_palette_transition (GtkCssValue *start,
|
||||
continue;
|
||||
|
||||
g_ptr_array_add (new_names, g_strdup (name));
|
||||
g_ptr_array_add (new_values, _gtk_css_value_ref (end_color));
|
||||
g_ptr_array_add (new_values, gtk_css_value_ref (end_color));
|
||||
}
|
||||
|
||||
result->n_colors = new_names->len;
|
||||
@@ -238,7 +235,7 @@ gtk_css_value_palette_print (const GtkCssValue *value,
|
||||
|
||||
g_string_append (string, value->color_names[i]);
|
||||
g_string_append_c (string, ' ');
|
||||
_gtk_css_value_print (value->color_values[i], string);
|
||||
gtk_css_value_print (value->color_values[i], string);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +255,7 @@ gtk_css_palette_value_new_empty (void)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_PALETTE);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_PALETTE);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -268,7 +265,7 @@ gtk_css_palette_value_new_sized (guint size)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_PALETTE);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_PALETTE);
|
||||
result->n_colors = size;
|
||||
result->color_names = g_malloc (sizeof (char *) * size);
|
||||
result->color_values = g_malloc (sizeof (GtkCssValue *) * size);
|
||||
@@ -283,15 +280,15 @@ gtk_css_palette_value_new_default (void)
|
||||
{
|
||||
default_palette = gtk_css_palette_value_new_sized (3);
|
||||
gtk_css_palette_value_set_color (default_palette, 0, g_strdup ("error"),
|
||||
_gtk_css_color_value_new_name ("error_color"));
|
||||
gtk_css_color_value_new_name ("error_color"));
|
||||
gtk_css_palette_value_set_color (default_palette, 1, g_strdup ("success"),
|
||||
_gtk_css_color_value_new_name ("success_color"));
|
||||
gtk_css_color_value_new_name ("success_color"));
|
||||
gtk_css_palette_value_set_color (default_palette, 2, g_strdup ("warning"),
|
||||
_gtk_css_color_value_new_name ("warning_color"));
|
||||
gtk_css_color_value_new_name ("warning_color"));
|
||||
/* Above is already sorted */
|
||||
}
|
||||
|
||||
return _gtk_css_value_ref (default_palette);
|
||||
return gtk_css_value_ref (default_palette);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
@@ -313,15 +310,15 @@ gtk_css_palette_value_parse (GtkCssParser *parser)
|
||||
ident = gtk_css_parser_consume_ident (parser);
|
||||
if (ident == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
color = _gtk_css_color_value_parse (parser);
|
||||
color = gtk_css_color_value_parse (parser);
|
||||
if (color == NULL)
|
||||
{
|
||||
g_free (ident);
|
||||
_gtk_css_value_unref (result);
|
||||
gtk_css_value_unref (result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
+50
-53
@@ -30,28 +30,25 @@ struct _GtkCssValue {
|
||||
static void
|
||||
gtk_css_value_position_free (GtkCssValue *value)
|
||||
{
|
||||
_gtk_css_value_unref (value->x);
|
||||
_gtk_css_value_unref (value->y);
|
||||
gtk_css_value_unref (value->x);
|
||||
gtk_css_value_unref (value->y);
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_position_compute (GtkCssValue *position,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_position_compute (GtkCssValue *position,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
x = _gtk_css_value_compute (position->x, property_id, provider, style, parent_style, variables);
|
||||
y = _gtk_css_value_compute (position->y, property_id, provider, style, parent_style, variables);
|
||||
x = gtk_css_value_compute (position->x, property_id, context);
|
||||
y = gtk_css_value_compute (position->y, property_id, context);
|
||||
if (x == position->x && y == position->y)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
_gtk_css_value_unref (y);
|
||||
return _gtk_css_value_ref (position);
|
||||
gtk_css_value_unref (x);
|
||||
gtk_css_value_unref (y);
|
||||
return gtk_css_value_ref (position);
|
||||
}
|
||||
|
||||
return _gtk_css_position_value_new (x, y);
|
||||
@@ -61,8 +58,8 @@ static gboolean
|
||||
gtk_css_value_position_equal (const GtkCssValue *position1,
|
||||
const GtkCssValue *position2)
|
||||
{
|
||||
return _gtk_css_value_equal (position1->x, position2->x)
|
||||
&& _gtk_css_value_equal (position1->y, position2->y);
|
||||
return gtk_css_value_equal (position1->x, position2->x)
|
||||
&& gtk_css_value_equal (position1->y, position2->y);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -73,13 +70,13 @@ gtk_css_value_position_transition (GtkCssValue *start,
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
x = _gtk_css_value_transition (start->x, end->x, property_id, progress);
|
||||
x = gtk_css_value_transition (start->x, end->x, property_id, progress);
|
||||
if (x == NULL)
|
||||
return NULL;
|
||||
y = _gtk_css_value_transition (start->y, end->y, property_id, progress);
|
||||
y = gtk_css_value_transition (start->y, end->y, property_id, progress);
|
||||
if (y == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
gtk_css_value_unref (x);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -95,15 +92,15 @@ gtk_css_value_position_print (const GtkCssValue *position,
|
||||
const char *y_name;
|
||||
GtkCssValue *number;
|
||||
} values[] = {
|
||||
{ "left", "top", _gtk_css_number_value_new (0, GTK_CSS_PERCENT) },
|
||||
{ "right", "bottom", _gtk_css_number_value_new (100, GTK_CSS_PERCENT) }
|
||||
{ "left", "top", gtk_css_number_value_new (0, GTK_CSS_PERCENT) },
|
||||
{ "right", "bottom", gtk_css_number_value_new (100, GTK_CSS_PERCENT) }
|
||||
};
|
||||
GtkCssValue *center = _gtk_css_number_value_new (50, GTK_CSS_PERCENT);
|
||||
GtkCssValue *center = gtk_css_number_value_new (50, GTK_CSS_PERCENT);
|
||||
guint i;
|
||||
|
||||
if (_gtk_css_value_equal (position->x, center))
|
||||
if (gtk_css_value_equal (position->x, center))
|
||||
{
|
||||
if (_gtk_css_value_equal (position->y, center))
|
||||
if (gtk_css_value_equal (position->y, center))
|
||||
{
|
||||
g_string_append (string, "center");
|
||||
goto done;
|
||||
@@ -113,16 +110,16 @@ gtk_css_value_position_print (const GtkCssValue *position,
|
||||
{
|
||||
for (i = 0; i < G_N_ELEMENTS (values); i++)
|
||||
{
|
||||
if (_gtk_css_value_equal (position->x, values[i].number))
|
||||
if (gtk_css_value_equal (position->x, values[i].number))
|
||||
{
|
||||
g_string_append (string, values[i].x_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == G_N_ELEMENTS (values))
|
||||
_gtk_css_value_print (position->x, string);
|
||||
gtk_css_value_print (position->x, string);
|
||||
|
||||
if (_gtk_css_value_equal (position->y, center))
|
||||
if (gtk_css_value_equal (position->y, center))
|
||||
goto done;
|
||||
|
||||
g_string_append_c (string, ' ');
|
||||
@@ -130,7 +127,7 @@ gtk_css_value_position_print (const GtkCssValue *position,
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (values); i++)
|
||||
{
|
||||
if (_gtk_css_value_equal (position->y, values[i].number))
|
||||
if (gtk_css_value_equal (position->y, values[i].number))
|
||||
{
|
||||
g_string_append (string, values[i].y_name);
|
||||
goto done;
|
||||
@@ -138,15 +135,15 @@ gtk_css_value_position_print (const GtkCssValue *position,
|
||||
}
|
||||
if (i == G_N_ELEMENTS (values))
|
||||
{
|
||||
if (_gtk_css_value_equal (position->x, center))
|
||||
if (gtk_css_value_equal (position->x, center))
|
||||
g_string_append (string, "center ");
|
||||
_gtk_css_value_print (position->y, string);
|
||||
gtk_css_value_print (position->y, string);
|
||||
}
|
||||
|
||||
done:
|
||||
for (i = 0; i < G_N_ELEMENTS (values); i++)
|
||||
_gtk_css_value_unref (values[i].number);
|
||||
_gtk_css_value_unref (center);
|
||||
gtk_css_value_unref (values[i].number);
|
||||
gtk_css_value_unref (center);
|
||||
}
|
||||
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_POSITION = {
|
||||
@@ -166,7 +163,7 @@ _gtk_css_position_value_new (GtkCssValue *x,
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_POSITION);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_POSITION);
|
||||
result->x = x;
|
||||
result->y = y;
|
||||
result->is_computed = gtk_css_value_is_computed (x) &&
|
||||
@@ -199,9 +196,9 @@ position_value_parse (GtkCssParser *parser, gboolean try)
|
||||
if (gtk_css_parser_try_ident (parser, names[i].name))
|
||||
{
|
||||
if (names[i].horizontal)
|
||||
x = _gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
|
||||
x = gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
|
||||
else
|
||||
y = _gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
|
||||
y = gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
|
||||
swap = names[i].swap;
|
||||
break;
|
||||
}
|
||||
@@ -210,9 +207,9 @@ position_value_parse (GtkCssParser *parser, gboolean try)
|
||||
{
|
||||
if (gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
x = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
x = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
|
||||
if (x == NULL)
|
||||
return NULL;
|
||||
@@ -242,17 +239,17 @@ position_value_parse (GtkCssParser *parser, gboolean try)
|
||||
if (names[i].horizontal && !names[i].swap)
|
||||
{
|
||||
y = x;
|
||||
x = _gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
|
||||
x = gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
y = _gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
|
||||
y = gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert (names[i].horizontal || names[i].swap);
|
||||
x = _gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
|
||||
x = gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -266,24 +263,24 @@ position_value_parse (GtkCssParser *parser, gboolean try)
|
||||
{
|
||||
if (!try)
|
||||
gtk_css_parser_error_syntax (parser, "Invalid combination of values");
|
||||
_gtk_css_value_unref (y);
|
||||
gtk_css_value_unref (y);
|
||||
return NULL;
|
||||
}
|
||||
y = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
y = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
if (y == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
gtk_css_value_unref (x);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (y)
|
||||
x = _gtk_css_number_value_new (50, GTK_CSS_PERCENT);
|
||||
x = gtk_css_number_value_new (50, GTK_CSS_PERCENT);
|
||||
else
|
||||
y = _gtk_css_number_value_new (50, GTK_CSS_PERCENT);
|
||||
y = gtk_css_number_value_new (50, GTK_CSS_PERCENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,22 +304,22 @@ gtk_css_position_value_parse_spacing (GtkCssParser *parser)
|
||||
{
|
||||
GtkCssValue *x, *y;
|
||||
|
||||
x = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
|
||||
x = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
|
||||
if (x == NULL)
|
||||
return NULL;
|
||||
|
||||
if (gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
y = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
|
||||
y = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
|
||||
if (y == NULL)
|
||||
{
|
||||
_gtk_css_value_unref (x);
|
||||
gtk_css_value_unref (x);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
y = _gtk_css_value_ref (x);
|
||||
y = gtk_css_value_ref (x);
|
||||
}
|
||||
|
||||
return _gtk_css_position_value_new (x, y);
|
||||
@@ -335,7 +332,7 @@ _gtk_css_position_value_get_x (const GtkCssValue *position,
|
||||
g_return_val_if_fail (position != NULL, 0.0);
|
||||
g_return_val_if_fail (position->class == >K_CSS_VALUE_POSITION, 0.0);
|
||||
|
||||
return _gtk_css_number_value_get (position->x, one_hundred_percent);
|
||||
return gtk_css_number_value_get (position->x, one_hundred_percent);
|
||||
}
|
||||
|
||||
double
|
||||
@@ -345,6 +342,6 @@ _gtk_css_position_value_get_y (const GtkCssValue *position,
|
||||
g_return_val_if_fail (position != NULL, 0.0);
|
||||
g_return_val_if_fail (position->class == >K_CSS_VALUE_POSITION, 0.0);
|
||||
|
||||
return _gtk_css_number_value_get (position->y, one_hundred_percent);
|
||||
return gtk_css_number_value_get (position->y, one_hundred_percent);
|
||||
}
|
||||
|
||||
|
||||
+16
-14
@@ -184,10 +184,12 @@ gtk_css_provider_parsing_error (GtkCssProvider *provider,
|
||||
{
|
||||
char *s = gtk_css_section_to_string (section);
|
||||
|
||||
g_warning ("Theme parser %s: %s: %s",
|
||||
error->domain == GTK_CSS_PARSER_WARNING ? "warning" : "error",
|
||||
s,
|
||||
error->message);
|
||||
if (GTK_DEBUG_CHECK (CSS) ||
|
||||
!g_error_matches (error, GTK_CSS_PARSER_WARNING, GTK_CSS_PARSER_WARNING_DEPRECATED))
|
||||
g_warning ("Theme parser %s: %s: %s",
|
||||
error->domain == GTK_CSS_PARSER_WARNING ? "warning" : "error",
|
||||
s,
|
||||
error->message);
|
||||
|
||||
g_free (s);
|
||||
}
|
||||
@@ -269,7 +271,7 @@ gtk_css_ruleset_clear (GtkCssRuleset *ruleset)
|
||||
|
||||
for (i = 0; i < ruleset->n_styles; i++)
|
||||
{
|
||||
_gtk_css_value_unref (ruleset->styles[i].value);
|
||||
gtk_css_value_unref (ruleset->styles[i].value);
|
||||
ruleset->styles[i].value = NULL;
|
||||
if (ruleset->styles[i].section)
|
||||
gtk_css_section_unref (ruleset->styles[i].section);
|
||||
@@ -300,7 +302,7 @@ gtk_css_ruleset_add (GtkCssRuleset *ruleset,
|
||||
{
|
||||
if (ruleset->styles[i].property == property)
|
||||
{
|
||||
_gtk_css_value_unref (ruleset->styles[i].value);
|
||||
gtk_css_value_unref (ruleset->styles[i].value);
|
||||
ruleset->styles[i].value = NULL;
|
||||
if (ruleset->styles[i].section)
|
||||
gtk_css_section_unref (ruleset->styles[i].section);
|
||||
@@ -440,7 +442,7 @@ gtk_css_provider_init (GtkCssProvider *css_provider)
|
||||
|
||||
priv->symbolic_colors = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify) g_free,
|
||||
(GDestroyNotify) _gtk_css_value_unref);
|
||||
(GDestroyNotify) gtk_css_value_unref);
|
||||
priv->keyframes = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify) g_free,
|
||||
(GDestroyNotify) _gtk_css_keyframes_unref);
|
||||
@@ -768,7 +770,7 @@ parse_color_definition (GtkCssScanner *scanner)
|
||||
if (name == NULL)
|
||||
return TRUE;
|
||||
|
||||
color = _gtk_css_color_value_parse (scanner->parser);
|
||||
color = gtk_css_color_value_parse (scanner->parser);
|
||||
if (color == NULL)
|
||||
{
|
||||
g_free (name);
|
||||
@@ -778,7 +780,7 @@ parse_color_definition (GtkCssScanner *scanner)
|
||||
if (!gtk_css_parser_has_token (scanner->parser, GTK_CSS_TOKEN_EOF))
|
||||
{
|
||||
g_free (name);
|
||||
_gtk_css_value_unref (color);
|
||||
gtk_css_value_unref (color);
|
||||
gtk_css_parser_error_syntax (scanner->parser,
|
||||
"Missing semicolon at end of color definition");
|
||||
return TRUE;
|
||||
@@ -1030,10 +1032,10 @@ parse_declaration (GtkCssScanner *scanner,
|
||||
GtkCssStyleProperty *child = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
|
||||
GtkCssValue *sub = _gtk_css_array_value_get_nth (value, i);
|
||||
|
||||
gtk_css_ruleset_add (ruleset, child, _gtk_css_value_ref (sub), section);
|
||||
gtk_css_ruleset_add (ruleset, child, gtk_css_value_ref (sub), section);
|
||||
}
|
||||
|
||||
_gtk_css_value_unref (value);
|
||||
gtk_css_value_unref (value);
|
||||
}
|
||||
else if (GTK_IS_CSS_STYLE_PROPERTY (property))
|
||||
{
|
||||
@@ -1043,7 +1045,7 @@ parse_declaration (GtkCssScanner *scanner,
|
||||
else
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
_gtk_css_value_unref (value);
|
||||
gtk_css_value_unref (value);
|
||||
}
|
||||
|
||||
g_clear_pointer (§ion, gtk_css_section_unref);
|
||||
@@ -1689,7 +1691,7 @@ gtk_css_ruleset_print (const GtkCssRuleset *ruleset,
|
||||
g_string_append (str, " ");
|
||||
g_string_append (str, _gtk_style_property_get_name (GTK_STYLE_PROPERTY (prop->property)));
|
||||
g_string_append (str, ": ");
|
||||
_gtk_css_value_print (prop->value, str);
|
||||
gtk_css_value_print (prop->value, str);
|
||||
g_string_append (str, ";\n");
|
||||
}
|
||||
|
||||
@@ -1742,7 +1744,7 @@ gtk_css_provider_print_colors (GHashTable *colors,
|
||||
g_string_append (str, "@define-color ");
|
||||
g_string_append (str, name);
|
||||
g_string_append (str, " ");
|
||||
_gtk_css_value_print (color, str);
|
||||
gtk_css_value_print (color, str);
|
||||
g_string_append (str, ";\n");
|
||||
}
|
||||
|
||||
|
||||
+41
-18
@@ -220,6 +220,8 @@ parser_error (GtkCssParser *parser,
|
||||
{
|
||||
for (int i = 0; i < n_vars; i++)
|
||||
{
|
||||
GtkCssSection *section;
|
||||
|
||||
if (names[i + 1])
|
||||
g_set_error (&new_error,
|
||||
GTK_CSS_PARSER_ERROR, GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE,
|
||||
@@ -228,7 +230,15 @@ parser_error (GtkCssParser *parser,
|
||||
g_set_error_literal (&new_error,
|
||||
GTK_CSS_PARSER_ERROR, GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE,
|
||||
error->message);
|
||||
gtk_style_provider_emit_error (provider, vars[i]->section, new_error);
|
||||
|
||||
if (vars[i]->section == NULL)
|
||||
section = gtk_css_section_new (gtk_css_parser_get_file (parser), start, end);
|
||||
else
|
||||
section = gtk_css_section_ref (vars[i]->section);
|
||||
|
||||
gtk_style_provider_emit_error (provider, section, new_error);
|
||||
|
||||
gtk_css_section_unref (section);
|
||||
g_clear_error (&new_error);
|
||||
}
|
||||
|
||||
@@ -245,19 +255,27 @@ parser_error (GtkCssParser *parser,
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_reference_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_reference_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *result = NULL, *computed;
|
||||
GtkCssRefs refs;
|
||||
guint shorthand_id = G_MAXUINT;
|
||||
|
||||
if (GTK_IS_CSS_SHORTHAND_PROPERTY (value->property))
|
||||
{
|
||||
shorthand_id = _gtk_css_shorthand_property_get_id (GTK_CSS_SHORTHAND_PROPERTY (value->property));
|
||||
if (context->shorthands && context->shorthands[shorthand_id])
|
||||
{
|
||||
result = gtk_css_value_ref (context->shorthands[shorthand_id]);
|
||||
goto pick_subproperty;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_css_refs_init (&refs);
|
||||
|
||||
resolve_references (value->value, property_id, style, variables, &refs);
|
||||
resolve_references (value->value, property_id, context->style, context->variables, &refs);
|
||||
|
||||
if (gtk_css_refs_get_size (&refs) > 0)
|
||||
{
|
||||
@@ -268,7 +286,8 @@ gtk_css_value_reference_compute (GtkCssValue *value,
|
||||
value->file,
|
||||
(GtkCssVariableValue **) refs.start,
|
||||
gtk_css_refs_get_size (&refs),
|
||||
parser_error, provider, NULL);
|
||||
parser_error, context->provider,
|
||||
NULL);
|
||||
|
||||
result = _gtk_style_property_parse_value (value->property, value_parser);
|
||||
token = gtk_css_parser_peek_token (value_parser);
|
||||
@@ -292,19 +311,23 @@ gtk_css_value_reference_compute (GtkCssValue *value,
|
||||
if (result == NULL)
|
||||
result = _gtk_css_unset_value_new ();
|
||||
|
||||
if (GTK_IS_CSS_SHORTHAND_PROPERTY (value->property))
|
||||
if (shorthand_id != G_MAXUINT)
|
||||
{
|
||||
GtkCssValue *sub = gtk_css_value_ref (_gtk_css_array_value_get_nth (result, value->subproperty));
|
||||
GtkCssValue *sub;
|
||||
|
||||
if (context->shorthands)
|
||||
{
|
||||
g_assert (context->shorthands[shorthand_id] == NULL);
|
||||
context->shorthands[shorthand_id] = gtk_css_value_ref (result);
|
||||
}
|
||||
|
||||
pick_subproperty:
|
||||
sub = gtk_css_value_ref (_gtk_css_array_value_get_nth (result, value->subproperty));
|
||||
gtk_css_value_unref (result);
|
||||
result = sub;
|
||||
}
|
||||
|
||||
computed = _gtk_css_value_compute (result,
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
computed = gtk_css_value_compute (result, property_id, context);
|
||||
computed->is_computed = TRUE;
|
||||
|
||||
gtk_css_value_unref (result);
|
||||
@@ -353,7 +376,7 @@ _gtk_css_reference_value_new (GtkStyleProperty *property,
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_REFERENCE);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_REFERENCE);
|
||||
result->property = property;
|
||||
result->value = gtk_css_variable_value_ref (value);
|
||||
result->contains_variables = TRUE;
|
||||
|
||||
@@ -34,14 +34,11 @@ gtk_css_value_repeat_free (GtkCssValue *value)
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_repeat_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_repeat_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -170,7 +167,7 @@ GtkCssValue *
|
||||
_gtk_css_background_repeat_value_new (GtkCssRepeatStyle x,
|
||||
GtkCssRepeatStyle y)
|
||||
{
|
||||
return _gtk_css_value_ref (&background_repeat_values[x].values[y]);
|
||||
return gtk_css_value_ref (&background_repeat_values[x].values[y]);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -264,7 +261,7 @@ GtkCssValue *
|
||||
_gtk_css_border_repeat_value_new (GtkCssRepeatStyle x,
|
||||
GtkCssRepeatStyle y)
|
||||
{
|
||||
return _gtk_css_value_ref (&border_repeat_values[x].values[y]);
|
||||
return gtk_css_value_ref (&border_repeat_values[x].values[y]);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
||||
+69
-72
@@ -59,21 +59,21 @@ shadow_value_for_transition (ShadowValue *result,
|
||||
gboolean inset)
|
||||
{
|
||||
result->inset = inset;
|
||||
result->hoffset = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
result->voffset = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
result->radius = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
result->spread = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
result->hoffset = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
result->voffset = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
result->radius = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
result->spread = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
result->color = gtk_css_color_value_new_transparent ();
|
||||
}
|
||||
|
||||
static void
|
||||
shadow_value_unref (const ShadowValue *shadow)
|
||||
{
|
||||
_gtk_css_value_unref (shadow->hoffset);
|
||||
_gtk_css_value_unref (shadow->voffset);
|
||||
_gtk_css_value_unref (shadow->spread);
|
||||
_gtk_css_value_unref (shadow->radius);
|
||||
_gtk_css_value_unref (shadow->color);
|
||||
gtk_css_value_unref (shadow->hoffset);
|
||||
gtk_css_value_unref (shadow->voffset);
|
||||
gtk_css_value_unref (shadow->spread);
|
||||
gtk_css_value_unref (shadow->radius);
|
||||
gtk_css_value_unref (shadow->color);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -88,11 +88,11 @@ shadow_value_transition (const ShadowValue *start,
|
||||
return FALSE;
|
||||
|
||||
result->inset = start->inset;
|
||||
result->hoffset = _gtk_css_value_transition (start->hoffset, end->hoffset, property_id, progress);
|
||||
result->voffset = _gtk_css_value_transition (start->voffset, end->voffset, property_id, progress);
|
||||
result->radius = _gtk_css_value_transition (start->radius, end->radius, property_id, progress);
|
||||
result->spread = _gtk_css_value_transition (start->spread, end->spread, property_id, progress);
|
||||
result->color = _gtk_css_value_transition (start->color, end->color, property_id, progress);
|
||||
result->hoffset = gtk_css_value_transition (start->hoffset, end->hoffset, property_id, progress);
|
||||
result->voffset = gtk_css_value_transition (start->voffset, end->voffset, property_id, progress);
|
||||
result->radius = gtk_css_value_transition (start->radius, end->radius, property_id, progress);
|
||||
result->spread = gtk_css_value_transition (start->spread, end->spread, property_id, progress);
|
||||
result->color = gtk_css_value_transition (start->color, end->color, property_id, progress);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -113,12 +113,9 @@ gtk_css_value_shadow_free (GtkCssValue *value)
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_shadow_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_shadow_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
guint i;
|
||||
ShadowValue *shadows;
|
||||
@@ -129,11 +126,11 @@ gtk_css_value_shadow_compute (GtkCssValue *value,
|
||||
{
|
||||
const ShadowValue *shadow = &value->shadows[i];
|
||||
|
||||
shadows[i].hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, style, parent_style, variables);
|
||||
shadows[i].voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, style, parent_style, variables);
|
||||
shadows[i].radius = _gtk_css_value_compute (shadow->radius, property_id, provider, style, parent_style, variables);
|
||||
shadows[i].spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, parent_style, variables),
|
||||
shadows[i].color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style, variables);
|
||||
shadows[i].hoffset = gtk_css_value_compute (shadow->hoffset, property_id, context);
|
||||
shadows[i].voffset = gtk_css_value_compute (shadow->voffset, property_id, context);
|
||||
shadows[i].radius = gtk_css_value_compute (shadow->radius, property_id, context);
|
||||
shadows[i].spread = gtk_css_value_compute (shadow->spread, property_id, context),
|
||||
shadows[i].color = gtk_css_value_compute (shadow->color, property_id, context);
|
||||
shadows[i].inset = shadow->inset;
|
||||
}
|
||||
|
||||
@@ -155,11 +152,11 @@ gtk_css_value_shadow_equal (const GtkCssValue *value1,
|
||||
const ShadowValue *shadow2 = &value2->shadows[i];
|
||||
|
||||
if (shadow1->inset != shadow2->inset ||
|
||||
!_gtk_css_value_equal (shadow1->hoffset, shadow2->hoffset) ||
|
||||
!_gtk_css_value_equal (shadow1->voffset, shadow2->voffset) ||
|
||||
!_gtk_css_value_equal (shadow1->radius, shadow2->radius) ||
|
||||
!_gtk_css_value_equal (shadow1->spread, shadow2->spread) ||
|
||||
!_gtk_css_value_equal (shadow1->color, shadow2->color))
|
||||
!gtk_css_value_equal (shadow1->hoffset, shadow2->hoffset) ||
|
||||
!gtk_css_value_equal (shadow1->voffset, shadow2->voffset) ||
|
||||
!gtk_css_value_equal (shadow1->radius, shadow2->radius) ||
|
||||
!gtk_css_value_equal (shadow1->spread, shadow2->spread) ||
|
||||
!gtk_css_value_equal (shadow1->color, shadow2->color))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -253,24 +250,24 @@ gtk_css_value_shadow_print (const GtkCssValue *value,
|
||||
if (i > 0)
|
||||
g_string_append (string, ", ");
|
||||
|
||||
_gtk_css_value_print (shadow->hoffset, string);
|
||||
gtk_css_value_print (shadow->hoffset, string);
|
||||
g_string_append_c (string, ' ');
|
||||
_gtk_css_value_print (shadow->voffset, string);
|
||||
gtk_css_value_print (shadow->voffset, string);
|
||||
g_string_append_c (string, ' ');
|
||||
if (_gtk_css_number_value_get (shadow->radius, 100) != 0 ||
|
||||
_gtk_css_number_value_get (shadow->spread, 100) != 0)
|
||||
if (gtk_css_number_value_get (shadow->radius, 100) != 0 ||
|
||||
gtk_css_number_value_get (shadow->spread, 100) != 0)
|
||||
{
|
||||
_gtk_css_value_print (shadow->radius, string);
|
||||
gtk_css_value_print (shadow->radius, string);
|
||||
g_string_append_c (string, ' ');
|
||||
}
|
||||
|
||||
if (_gtk_css_number_value_get (shadow->spread, 100) != 0)
|
||||
if (gtk_css_number_value_get (shadow->spread, 100) != 0)
|
||||
{
|
||||
_gtk_css_value_print (shadow->spread, string);
|
||||
gtk_css_value_print (shadow->spread, string);
|
||||
g_string_append_c (string, ' ');
|
||||
}
|
||||
|
||||
_gtk_css_value_print (shadow->color, string);
|
||||
gtk_css_value_print (shadow->color, string);
|
||||
|
||||
if (shadow->inset)
|
||||
g_string_append (string, " inset");
|
||||
@@ -293,7 +290,7 @@ static GtkCssValue shadow_none_singleton = { >K_CSS_VALUE_SHADOW, 1, TRUE, FAL
|
||||
GtkCssValue *
|
||||
gtk_css_shadow_value_new_none (void)
|
||||
{
|
||||
return _gtk_css_value_ref (&shadow_none_singleton);
|
||||
return gtk_css_value_ref (&shadow_none_singleton);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -307,7 +304,7 @@ gtk_css_shadow_value_new (ShadowValue *shadows,
|
||||
if (n_shadows == 0)
|
||||
return gtk_css_shadow_value_new_none ();
|
||||
|
||||
retval = _gtk_css_value_alloc (>K_CSS_VALUE_SHADOW, sizeof (GtkCssValue) + sizeof (ShadowValue) * (n_shadows - 1));
|
||||
retval = gtk_css_value_alloc (>K_CSS_VALUE_SHADOW, sizeof (GtkCssValue) + sizeof (ShadowValue) * (n_shadows - 1));
|
||||
retval->n_shadows = n_shadows;
|
||||
retval->is_filter = is_filter;
|
||||
|
||||
@@ -338,10 +335,10 @@ gtk_css_shadow_value_new_filter (const GtkCssValue *other)
|
||||
ShadowValue value;
|
||||
|
||||
value.inset = FALSE;
|
||||
value.hoffset = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
value.voffset = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
value.radius = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
value.spread = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
value.hoffset = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
value.voffset = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
value.radius = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
value.spread = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
value.color = gtk_css_value_ref (other->shadows[0].color);
|
||||
|
||||
return gtk_css_shadow_value_new (&value, 1, TRUE);
|
||||
@@ -388,36 +385,36 @@ parse_lengths (GtkCssParser *parser,
|
||||
{
|
||||
GtkCssValue **values = option_data;
|
||||
|
||||
values[HOFFSET] = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH);
|
||||
values[HOFFSET] = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH);
|
||||
if (values[HOFFSET] == NULL)
|
||||
return FALSE;
|
||||
|
||||
values[VOFFSET] = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH);
|
||||
values[VOFFSET] = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH);
|
||||
if (values[VOFFSET] == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
values[RADIUS] = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH
|
||||
| GTK_CSS_POSITIVE_ONLY);
|
||||
values[RADIUS] = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH
|
||||
| GTK_CSS_POSITIVE_ONLY);
|
||||
if (values[RADIUS] == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
values[RADIUS] = _gtk_css_number_value_new (0.0, GTK_CSS_PX);
|
||||
values[RADIUS] = gtk_css_number_value_new (0.0, GTK_CSS_PX);
|
||||
|
||||
if (box_shadow_mode && gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
values[SPREAD] = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH);
|
||||
values[SPREAD] = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH);
|
||||
if (values[SPREAD] == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
values[SPREAD] = _gtk_css_number_value_new (0.0, GTK_CSS_PX);
|
||||
values[SPREAD] = gtk_css_number_value_new (0.0, GTK_CSS_PX);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -429,7 +426,7 @@ parse_color (GtkCssParser *parser,
|
||||
{
|
||||
GtkCssValue **color = option_data;
|
||||
|
||||
*color = _gtk_css_color_value_parse (parser);
|
||||
*color = gtk_css_color_value_parse (parser);
|
||||
if (*color == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -462,7 +459,7 @@ gtk_css_shadow_value_parse_one (GtkCssParser *parser,
|
||||
}
|
||||
|
||||
if (color == NULL)
|
||||
color = _gtk_css_color_value_new_current_color ();
|
||||
color = gtk_css_color_value_new_current_color ();
|
||||
|
||||
result->hoffset = values[HOFFSET];
|
||||
result->voffset = values[VOFFSET];
|
||||
@@ -542,13 +539,13 @@ gtk_css_shadow_value_get_extents (const GtkCssValue *value,
|
||||
const ShadowValue *shadow = &value->shadows[i];
|
||||
double hoffset, voffset, spread, radius, clip_radius;
|
||||
|
||||
spread = _gtk_css_number_value_get (shadow->spread, 0);
|
||||
radius = _gtk_css_number_value_get (shadow->radius, 0);
|
||||
spread = gtk_css_number_value_get (shadow->spread, 0);
|
||||
radius = gtk_css_number_value_get (shadow->radius, 0);
|
||||
if (!value->is_filter)
|
||||
radius = radius / 2.0;
|
||||
clip_radius = gsk_cairo_blur_compute_pixels (radius);
|
||||
hoffset = _gtk_css_number_value_get (shadow->hoffset, 0);
|
||||
voffset = _gtk_css_number_value_get (shadow->voffset, 0);
|
||||
hoffset = gtk_css_number_value_get (shadow->hoffset, 0);
|
||||
voffset = gtk_css_number_value_get (shadow->voffset, 0);
|
||||
|
||||
border->top = MAX (border->top, ceil (clip_radius + spread - voffset));
|
||||
border->right = MAX (border->right, ceil (clip_radius + spread + hoffset));
|
||||
@@ -581,10 +578,10 @@ gtk_css_shadow_value_snapshot_outset (const GtkCssValue *value,
|
||||
if (gdk_rgba_is_clear (color))
|
||||
continue;
|
||||
|
||||
dx = _gtk_css_number_value_get (shadow->hoffset, 0);
|
||||
dy = _gtk_css_number_value_get (shadow->voffset, 0);
|
||||
spread = _gtk_css_number_value_get (shadow->spread, 0);
|
||||
radius = _gtk_css_number_value_get (shadow->radius, 0);
|
||||
dx = gtk_css_number_value_get (shadow->hoffset, 0);
|
||||
dy = gtk_css_number_value_get (shadow->voffset, 0);
|
||||
spread = gtk_css_number_value_get (shadow->spread, 0);
|
||||
radius = gtk_css_number_value_get (shadow->radius, 0);
|
||||
if (value->is_filter)
|
||||
radius = 2 * radius;
|
||||
|
||||
@@ -616,10 +613,10 @@ gtk_css_shadow_value_snapshot_inset (const GtkCssValue *value,
|
||||
if (gdk_rgba_is_clear (color))
|
||||
continue;
|
||||
|
||||
dx = _gtk_css_number_value_get (shadow->hoffset, 0);
|
||||
dy = _gtk_css_number_value_get (shadow->voffset, 0);
|
||||
spread = _gtk_css_number_value_get (shadow->spread, 0);
|
||||
radius = _gtk_css_number_value_get (shadow->radius, 0);
|
||||
dx = gtk_css_number_value_get (shadow->hoffset, 0);
|
||||
dy = gtk_css_number_value_get (shadow->voffset, 0);
|
||||
spread = gtk_css_number_value_get (shadow->spread, 0);
|
||||
radius = gtk_css_number_value_get (shadow->radius, 0);
|
||||
if (value->is_filter)
|
||||
radius = 2 * radius;
|
||||
|
||||
@@ -736,10 +733,10 @@ gtk_css_shadow_value_push_snapshot (const GtkCssValue *value,
|
||||
{
|
||||
const ShadowValue *shadow = &value->shadows[i];
|
||||
|
||||
shadows[i].dx = _gtk_css_number_value_get (shadow->hoffset, 0);
|
||||
shadows[i].dy = _gtk_css_number_value_get (shadow->voffset, 0);
|
||||
shadows[i].dx = gtk_css_number_value_get (shadow->hoffset, 0);
|
||||
shadows[i].dy = gtk_css_number_value_get (shadow->voffset, 0);
|
||||
shadows[i].color = *gtk_css_color_value_get_rgba (shadow->color);
|
||||
shadows[i].radius = _gtk_css_number_value_get (shadow->radius, 0);
|
||||
shadows[i].radius = gtk_css_number_value_get (shadow->radius, 0);
|
||||
if (value->is_filter)
|
||||
shadows[i].radius *= 2;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
|
||||
for (i = 0; i < n_props; i++)
|
||||
{
|
||||
if (data[i] != NULL)
|
||||
_gtk_css_value_unref (data[i]);
|
||||
gtk_css_value_unref (data[i]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -160,7 +160,14 @@ guint
|
||||
_gtk_css_shorthand_property_get_n_subproperties (GtkCssShorthandProperty *shorthand)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CSS_SHORTHAND_PROPERTY (shorthand), 0);
|
||||
|
||||
|
||||
return shorthand->subproperties->len;
|
||||
}
|
||||
|
||||
guint
|
||||
_gtk_css_shorthand_property_get_id (GtkCssShorthandProperty *shorthand)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CSS_SHORTHAND_PROPERTY (shorthand), 0);
|
||||
|
||||
return shorthand->id;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ parse_four_numbers (GtkCssShorthandProperty *shorthand,
|
||||
if (!gtk_css_number_value_can_parse (parser))
|
||||
break;
|
||||
|
||||
values[i] = _gtk_css_number_value_parse (parser, flags);
|
||||
values[i] = gtk_css_number_value_parse (parser, flags);
|
||||
if (values[i] == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ parse_four_numbers (GtkCssShorthandProperty *shorthand,
|
||||
|
||||
for (; i < 4; i++)
|
||||
{
|
||||
values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
|
||||
values[i] = gtk_css_value_ref (values[(i - 1) >> 1]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -130,10 +130,10 @@ parse_border_radius (GtkCssShorthandProperty *shorthand,
|
||||
{
|
||||
if (!gtk_css_number_value_can_parse (parser))
|
||||
break;
|
||||
x[i] = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
x[i] = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
if (x[i] == NULL)
|
||||
goto fail;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ parse_border_radius (GtkCssShorthandProperty *shorthand,
|
||||
* according to spec. Feel free to check the 4 cases
|
||||
*/
|
||||
for (; i < 4; i++)
|
||||
x[i] = _gtk_css_value_ref (x[(i - 1) >> 1]);
|
||||
x[i] = gtk_css_value_ref (x[(i - 1) >> 1]);
|
||||
|
||||
if (gtk_css_parser_try_delim (parser, '/'))
|
||||
{
|
||||
@@ -156,10 +156,10 @@ parse_border_radius (GtkCssShorthandProperty *shorthand,
|
||||
{
|
||||
if (!gtk_css_number_value_can_parse (parser))
|
||||
break;
|
||||
y[i] = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
y[i] = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
if (y[i] == NULL)
|
||||
goto fail;
|
||||
}
|
||||
@@ -171,12 +171,12 @@ parse_border_radius (GtkCssShorthandProperty *shorthand,
|
||||
}
|
||||
|
||||
for (; i < 4; i++)
|
||||
y[i] = _gtk_css_value_ref (y[(i - 1) >> 1]);
|
||||
y[i] = gtk_css_value_ref (y[(i - 1) >> 1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
y[i] = _gtk_css_value_ref (x[i]);
|
||||
y[i] = gtk_css_value_ref (x[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
@@ -190,9 +190,9 @@ fail:
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (x[i])
|
||||
_gtk_css_value_unref (x[i]);
|
||||
gtk_css_value_unref (x[i]);
|
||||
if (y[i])
|
||||
_gtk_css_value_unref (y[i]);
|
||||
gtk_css_value_unref (y[i]);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ parse_border_color (GtkCssShorthandProperty *shorthand,
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
values[i] = _gtk_css_color_value_parse (parser);
|
||||
values[i] = gtk_css_color_value_parse (parser);
|
||||
if (values[i] == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -216,7 +216,7 @@ parse_border_color (GtkCssShorthandProperty *shorthand,
|
||||
|
||||
for (i++; i < 4; i++)
|
||||
{
|
||||
values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
|
||||
values[i] = gtk_css_value_ref (values[(i - 1) >> 1]);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -243,7 +243,7 @@ parse_border_style (GtkCssShorthandProperty *shorthand,
|
||||
}
|
||||
|
||||
for (; i < 4; i++)
|
||||
values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
|
||||
values[i] = gtk_css_value_ref (values[(i - 1) >> 1]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -325,9 +325,9 @@ parse_border_side (GtkCssShorthandProperty *shorthand,
|
||||
if (values[0] == NULL &&
|
||||
gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
values[0] = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
values[0] = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
if (values[0] == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
@@ -338,7 +338,7 @@ parse_border_side (GtkCssShorthandProperty *shorthand,
|
||||
}
|
||||
else if (values[2] == NULL)
|
||||
{
|
||||
values[2] = _gtk_css_color_value_parse (parser);
|
||||
values[2] = gtk_css_color_value_parse (parser);
|
||||
if (values[2] == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
@@ -366,31 +366,31 @@ parse_border (GtkCssShorthandProperty *shorthand,
|
||||
if (values[0] == NULL &&
|
||||
gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
values[0] = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
values[0] = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
if (values[0] == NULL)
|
||||
return FALSE;
|
||||
values[1] = _gtk_css_value_ref (values[0]);
|
||||
values[2] = _gtk_css_value_ref (values[0]);
|
||||
values[3] = _gtk_css_value_ref (values[0]);
|
||||
values[1] = gtk_css_value_ref (values[0]);
|
||||
values[2] = gtk_css_value_ref (values[0]);
|
||||
values[3] = gtk_css_value_ref (values[0]);
|
||||
}
|
||||
else if (values[4] == NULL &&
|
||||
(values[4] = _gtk_css_border_style_value_try_parse (parser)))
|
||||
{
|
||||
values[5] = _gtk_css_value_ref (values[4]);
|
||||
values[6] = _gtk_css_value_ref (values[4]);
|
||||
values[7] = _gtk_css_value_ref (values[4]);
|
||||
values[5] = gtk_css_value_ref (values[4]);
|
||||
values[6] = gtk_css_value_ref (values[4]);
|
||||
values[7] = gtk_css_value_ref (values[4]);
|
||||
}
|
||||
else if (values[8] == NULL)
|
||||
{
|
||||
values[8] = _gtk_css_color_value_parse (parser);
|
||||
values[8] = gtk_css_color_value_parse (parser);
|
||||
if (values[8] == NULL)
|
||||
return FALSE;
|
||||
|
||||
values[9] = _gtk_css_value_ref (values[8]);
|
||||
values[10] = _gtk_css_value_ref (values[8]);
|
||||
values[11] = _gtk_css_value_ref (values[8]);
|
||||
values[9] = gtk_css_value_ref (values[8]);
|
||||
values[10] = gtk_css_value_ref (values[8]);
|
||||
values[11] = gtk_css_value_ref (values[8]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -449,11 +449,11 @@ parse_font (GtkCssShorthandProperty *shorthand,
|
||||
if (values[3] == NULL && gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
/* This needs to check for font-size, too */
|
||||
GtkCssValue *num = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_NUMBER |
|
||||
GTK_CSS_PARSE_LENGTH |
|
||||
GTK_CSS_PARSE_PERCENT |
|
||||
GTK_CSS_POSITIVE_ONLY);
|
||||
GtkCssValue *num = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_NUMBER |
|
||||
GTK_CSS_PARSE_LENGTH |
|
||||
GTK_CSS_PARSE_PERCENT |
|
||||
GTK_CSS_POSITIVE_ONLY);
|
||||
if (num == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -464,8 +464,8 @@ parse_font (GtkCssShorthandProperty *shorthand,
|
||||
}
|
||||
|
||||
values[3] = num;
|
||||
if (_gtk_css_number_value_get (values[3], 100) < 1 ||
|
||||
_gtk_css_number_value_get (values[3], 100) > 1000)
|
||||
if (gtk_css_number_value_get (values[3], 100) < 1 ||
|
||||
gtk_css_number_value_get (values[3], 100) > 1000)
|
||||
{
|
||||
gtk_css_parser_error_value (parser, "Font weight values must be between 1 and 1000");
|
||||
g_clear_pointer (&values[3], gtk_css_value_unref);
|
||||
@@ -555,9 +555,9 @@ parse_one_background (GtkCssShorthandProperty *shorthand,
|
||||
}
|
||||
else if (values[6] == NULL)
|
||||
{
|
||||
value = _gtk_css_color_value_parse (parser);
|
||||
value = gtk_css_color_value_parse (parser);
|
||||
if (value == NULL)
|
||||
values[6] = _gtk_css_value_ref (_gtk_css_style_property_get_initial_value
|
||||
values[6] = gtk_css_value_ref (_gtk_css_style_property_get_initial_value
|
||||
(_gtk_css_shorthand_property_get_subproperty (shorthand, 6)));
|
||||
else
|
||||
values[6] = value;
|
||||
@@ -576,7 +576,7 @@ parse_one_background (GtkCssShorthandProperty *shorthand,
|
||||
while (!value_is_done_parsing (parser));
|
||||
|
||||
if (values[5] != NULL && values[4] == NULL)
|
||||
values[4] = _gtk_css_value_ref (values[5]);
|
||||
values[4] = gtk_css_value_ref (values[5]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -603,7 +603,7 @@ parse_background (GtkCssShorthandProperty *shorthand,
|
||||
{
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
g_ptr_array_set_free_func (arrays[i], (GDestroyNotify) _gtk_css_value_unref);
|
||||
g_ptr_array_set_free_func (arrays[i], (GDestroyNotify) gtk_css_value_unref);
|
||||
g_ptr_array_unref (arrays[i]);
|
||||
}
|
||||
return FALSE;
|
||||
@@ -615,7 +615,7 @@ parse_background (GtkCssShorthandProperty *shorthand,
|
||||
{
|
||||
GtkCssValue *initial = _gtk_css_style_property_get_initial_value (
|
||||
_gtk_css_shorthand_property_get_subproperty (shorthand, i));
|
||||
step_values[i] = _gtk_css_value_ref (_gtk_css_array_value_get_nth (initial, 0));
|
||||
step_values[i] = gtk_css_value_ref (_gtk_css_array_value_get_nth (initial, 0));
|
||||
}
|
||||
|
||||
g_ptr_array_add (arrays[i], step_values[i]);
|
||||
@@ -662,7 +662,7 @@ parse_transition_time (GtkCssParser *parser,
|
||||
{
|
||||
GtkCssValue **value = option_data;
|
||||
|
||||
*value = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_TIME);
|
||||
*value = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_TIME);
|
||||
|
||||
return *value != NULL;
|
||||
}
|
||||
@@ -714,7 +714,7 @@ parse_transition (GtkCssShorthandProperty *shorthand,
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
g_ptr_array_set_free_func (arrays[i], (GDestroyNotify) _gtk_css_value_unref);
|
||||
g_ptr_array_set_free_func (arrays[i], (GDestroyNotify) gtk_css_value_unref);
|
||||
g_ptr_array_unref (arrays[i]);
|
||||
}
|
||||
return FALSE;
|
||||
@@ -726,7 +726,7 @@ parse_transition (GtkCssShorthandProperty *shorthand,
|
||||
{
|
||||
GtkCssValue *initial = _gtk_css_style_property_get_initial_value (
|
||||
_gtk_css_shorthand_property_get_subproperty (shorthand, i));
|
||||
step_values[i] = _gtk_css_value_ref (_gtk_css_array_value_get_nth (initial, 0));
|
||||
step_values[i] = gtk_css_value_ref (_gtk_css_array_value_get_nth (initial, 0));
|
||||
}
|
||||
|
||||
g_ptr_array_add (arrays[i], step_values[i]);
|
||||
@@ -752,17 +752,17 @@ parse_one_animation (GtkCssShorthandProperty *shorthand,
|
||||
{
|
||||
if (values[1] == NULL && gtk_css_parser_try_ident (parser, "infinite"))
|
||||
{
|
||||
values[1] = _gtk_css_number_value_new (HUGE_VAL, GTK_CSS_NUMBER);
|
||||
values[1] = gtk_css_number_value_new (HUGE_VAL, GTK_CSS_NUMBER);
|
||||
}
|
||||
else if ((values[1] == NULL || values[3] == NULL) &&
|
||||
gtk_css_number_value_can_parse (parser))
|
||||
{
|
||||
GtkCssValue *value;
|
||||
|
||||
value = _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| (values[1] == NULL ? GTK_CSS_PARSE_NUMBER : 0)
|
||||
| (values[3] == NULL ? GTK_CSS_PARSE_TIME : 0));
|
||||
value = gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| (values[1] == NULL ? GTK_CSS_PARSE_NUMBER : 0)
|
||||
| (values[3] == NULL ? GTK_CSS_PARSE_TIME : 0));
|
||||
if (value == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -831,7 +831,7 @@ parse_animation (GtkCssShorthandProperty *shorthand,
|
||||
{
|
||||
for (i = 0; i < 7; i++)
|
||||
{
|
||||
g_ptr_array_set_free_func (arrays[i], (GDestroyNotify) _gtk_css_value_unref);
|
||||
g_ptr_array_set_free_func (arrays[i], (GDestroyNotify) gtk_css_value_unref);
|
||||
g_ptr_array_unref (arrays[i]);
|
||||
}
|
||||
return FALSE;
|
||||
@@ -843,7 +843,7 @@ parse_animation (GtkCssShorthandProperty *shorthand,
|
||||
{
|
||||
GtkCssValue *initial = _gtk_css_style_property_get_initial_value (
|
||||
_gtk_css_shorthand_property_get_subproperty (shorthand, i));
|
||||
step_values[i] = _gtk_css_value_ref (_gtk_css_array_value_get_nth (initial, 0));
|
||||
step_values[i] = gtk_css_value_ref (_gtk_css_array_value_get_nth (initial, 0));
|
||||
}
|
||||
|
||||
g_ptr_array_add (arrays[i], step_values[i]);
|
||||
@@ -891,7 +891,7 @@ parse_text_decoration (GtkCssShorthandProperty *shorthand,
|
||||
}
|
||||
else if (values[2] == NULL)
|
||||
{
|
||||
values[2] = _gtk_css_color_value_parse (parser);
|
||||
values[2] = gtk_css_color_value_parse (parser);
|
||||
if (values[2] == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1093,6 +1093,7 @@ parse_all (GtkCssShorthandProperty *shorthand,
|
||||
|
||||
static void
|
||||
gtk_css_shorthand_property_register (const char *name,
|
||||
unsigned int id,
|
||||
const char **subproperties,
|
||||
GtkCssShorthandPropertyParseFunc parse_func)
|
||||
{
|
||||
@@ -1103,6 +1104,8 @@ gtk_css_shorthand_property_register (const char *name,
|
||||
"subproperties", subproperties,
|
||||
NULL);
|
||||
|
||||
node->id = id;
|
||||
|
||||
node->parse = parse_func;
|
||||
}
|
||||
|
||||
@@ -1158,65 +1161,85 @@ _gtk_css_shorthand_property_init_properties (void)
|
||||
const char **all_subproperties;
|
||||
|
||||
gtk_css_shorthand_property_register ("font",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_FONT,
|
||||
font_subproperties,
|
||||
parse_font);
|
||||
gtk_css_shorthand_property_register ("margin",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_MARGIN,
|
||||
margin_subproperties,
|
||||
parse_margin);
|
||||
gtk_css_shorthand_property_register ("padding",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_PADDING,
|
||||
padding_subproperties,
|
||||
parse_padding);
|
||||
gtk_css_shorthand_property_register ("border-width",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_WIDTH,
|
||||
border_width_subproperties,
|
||||
parse_border_width);
|
||||
gtk_css_shorthand_property_register ("border-radius",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_RADIUS,
|
||||
border_radius_subproperties,
|
||||
parse_border_radius);
|
||||
gtk_css_shorthand_property_register ("border-color",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_COLOR,
|
||||
border_color_subproperties,
|
||||
parse_border_color);
|
||||
gtk_css_shorthand_property_register ("border-style",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_STYLE,
|
||||
border_style_subproperties,
|
||||
parse_border_style);
|
||||
gtk_css_shorthand_property_register ("border-image",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_IMAGE,
|
||||
border_image_subproperties,
|
||||
parse_border_image);
|
||||
gtk_css_shorthand_property_register ("border-top",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_TOP,
|
||||
border_top_subproperties,
|
||||
parse_border_side);
|
||||
gtk_css_shorthand_property_register ("border-right",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_RIGHT,
|
||||
border_right_subproperties,
|
||||
parse_border_side);
|
||||
gtk_css_shorthand_property_register ("border-bottom",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_BOTTOM,
|
||||
border_bottom_subproperties,
|
||||
parse_border_side);
|
||||
gtk_css_shorthand_property_register ("border-left",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_LEFT,
|
||||
border_left_subproperties,
|
||||
parse_border_side);
|
||||
gtk_css_shorthand_property_register ("border",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER,
|
||||
border_subproperties,
|
||||
parse_border);
|
||||
gtk_css_shorthand_property_register ("outline",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_OUTLINE,
|
||||
outline_subproperties,
|
||||
parse_border_side);
|
||||
gtk_css_shorthand_property_register ("background",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BACKGROUND,
|
||||
background_subproperties,
|
||||
parse_background);
|
||||
gtk_css_shorthand_property_register ("transition",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_TRANSITION,
|
||||
transition_subproperties,
|
||||
parse_transition);
|
||||
gtk_css_shorthand_property_register ("animation",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_ANIMATION,
|
||||
animation_subproperties,
|
||||
parse_animation);
|
||||
gtk_css_shorthand_property_register ("text-decoration",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_TEXT_DECORATION,
|
||||
text_decoration_subproperties,
|
||||
parse_text_decoration);
|
||||
gtk_css_shorthand_property_register ("font-variant",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_FONT_VARIANT,
|
||||
font_variant_subproperties,
|
||||
parse_font_variant);
|
||||
|
||||
all_subproperties = get_all_subproperties ();
|
||||
gtk_css_shorthand_property_register ("all",
|
||||
GTK_CSS_SHORTHAND_PROPERTY_ALL,
|
||||
all_subproperties,
|
||||
parse_all);
|
||||
g_free (all_subproperties);
|
||||
|
||||
@@ -49,6 +49,8 @@ struct _GtkCssShorthandProperty
|
||||
|
||||
GPtrArray *subproperties;
|
||||
|
||||
guint id;
|
||||
|
||||
GtkCssShorthandPropertyParseFunc parse;
|
||||
};
|
||||
|
||||
@@ -65,6 +67,8 @@ GtkCssStyleProperty * _gtk_css_shorthand_property_get_subproperty (GtkCssS
|
||||
guint property);
|
||||
guint _gtk_css_shorthand_property_get_n_subproperties (GtkCssShorthandProperty *shorthand) G_GNUC_CONST;
|
||||
|
||||
guint _gtk_css_shorthand_property_get_id (GtkCssShorthandProperty *shorthand) G_GNUC_CONST;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+131
-111
@@ -39,12 +39,12 @@
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtkcssdimensionvalueprivate.h"
|
||||
|
||||
static void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *parent_style,
|
||||
guint id,
|
||||
GtkCssValue *specified,
|
||||
GtkCssSection *section);
|
||||
|
||||
static void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
guint id,
|
||||
GtkCssValue *specified,
|
||||
GtkCssSection *section,
|
||||
GtkCssComputeContext *context);
|
||||
|
||||
#define GET_VALUES(v) (GtkCssValue **)((guint8*)(v) + sizeof (GtkCssValues))
|
||||
|
||||
@@ -62,7 +62,7 @@ gtk_css_## NAME ## _values_compute_changes_and_affects (GtkCssStyle *style1, \
|
||||
{ \
|
||||
GtkCssValue *v1 = g1[i] ? g1[i] : style1->core->color; \
|
||||
GtkCssValue *v2 = g2[i] ? g2[i] : style2->core->color; \
|
||||
if (!_gtk_css_value_equal (v1, v2)) \
|
||||
if (!gtk_css_value_equal (v1, v2)) \
|
||||
{ \
|
||||
guint id = NAME ## _props[i]; \
|
||||
*changes = _gtk_bitmask_set (*changes, id, TRUE); \
|
||||
@@ -72,10 +72,9 @@ gtk_css_## NAME ## _values_compute_changes_and_affects (GtkCssStyle *style1, \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
|
||||
GtkStyleProvider *provider, \
|
||||
GtkCssStyle *parent_style, \
|
||||
GtkCssLookup *lookup) \
|
||||
gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
|
||||
GtkCssLookup *lookup, \
|
||||
GtkCssComputeContext *context) \
|
||||
{ \
|
||||
GtkCssStyle *style = (GtkCssStyle *)sstyle; \
|
||||
int i; \
|
||||
@@ -86,11 +85,10 @@ gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
|
||||
{ \
|
||||
guint id = NAME ## _props[i]; \
|
||||
gtk_css_static_style_compute_value (sstyle, \
|
||||
provider, \
|
||||
parent_style, \
|
||||
id, \
|
||||
lookup->values[id].value, \
|
||||
lookup->values[id].section); \
|
||||
lookup->values[id].section, \
|
||||
context); \
|
||||
} \
|
||||
} \
|
||||
static GtkBitmask * gtk_css_ ## NAME ## _values_mask; \
|
||||
@@ -177,7 +175,7 @@ G_DEFINE_TYPE (GtkCssStaticStyle, gtk_css_static_style, GTK_TYPE_CSS_STYLE)
|
||||
|
||||
static GtkCssSection *
|
||||
gtk_css_static_style_get_section (GtkCssStyle *style,
|
||||
guint id)
|
||||
guint id)
|
||||
{
|
||||
GtkCssStaticStyle *sstyle = GTK_CSS_STATIC_STYLE (style);
|
||||
|
||||
@@ -270,7 +268,7 @@ static void
|
||||
maybe_unref_value (gpointer value)
|
||||
{
|
||||
if (value)
|
||||
_gtk_css_value_unref (value);
|
||||
gtk_css_value_unref (value);
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -593,7 +591,7 @@ gtk_css_static_style_set_value (GtkCssStaticStyle *sstyle,
|
||||
if (sstyle->original_values && sstyle->original_values->len > id &&
|
||||
g_ptr_array_index (sstyle->original_values, id))
|
||||
{
|
||||
_gtk_css_value_unref (g_ptr_array_index (sstyle->original_values, id));
|
||||
gtk_css_value_unref (g_ptr_array_index (sstyle->original_values, id));
|
||||
g_ptr_array_index (sstyle->original_values, id) = NULL;
|
||||
}
|
||||
|
||||
@@ -603,7 +601,7 @@ gtk_css_static_style_set_value (GtkCssStaticStyle *sstyle,
|
||||
sstyle->original_values = g_ptr_array_new_with_free_func (maybe_unref_value);
|
||||
if (sstyle->original_values->len <= id)
|
||||
g_ptr_array_set_size (sstyle->original_values, id + 1);
|
||||
g_ptr_array_index (sstyle->original_values, id) = _gtk_css_value_ref (original_value);
|
||||
g_ptr_array_index (sstyle->original_values, id) = gtk_css_value_ref (original_value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,18 +648,19 @@ static GtkCssValues *
|
||||
gtk_css_background_create_initial_values (void)
|
||||
{
|
||||
GtkCssBackgroundValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssBackgroundValues *)gtk_css_values_new (GTK_CSS_BACKGROUND_INITIAL_VALUES);
|
||||
|
||||
values->background_color = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_COLOR, NULL, NULL, NULL);
|
||||
values->box_shadow = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BOX_SHADOW, NULL, NULL, NULL);
|
||||
values->background_clip = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_CLIP, NULL, NULL, NULL);
|
||||
values->background_origin = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_ORIGIN, NULL, NULL, NULL);
|
||||
values->background_size = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_SIZE, NULL, NULL, NULL);
|
||||
values->background_position = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_POSITION, NULL, NULL, NULL);
|
||||
values->background_repeat = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_REPEAT, NULL, NULL, NULL);
|
||||
values->background_image = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_IMAGE, NULL, NULL, NULL);
|
||||
values->background_blend_mode = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE, NULL, NULL, NULL);
|
||||
values->background_color = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_COLOR, &context);
|
||||
values->box_shadow = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BOX_SHADOW, &context);
|
||||
values->background_clip = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_CLIP, &context);
|
||||
values->background_origin = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_ORIGIN, &context);
|
||||
values->background_size = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_SIZE, &context);
|
||||
values->background_position = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_POSITION, &context);
|
||||
values->background_repeat = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_REPEAT, &context);
|
||||
values->background_image = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_IMAGE, &context);
|
||||
values->background_blend_mode = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@@ -670,29 +669,30 @@ static GtkCssValues *
|
||||
gtk_css_border_create_initial_values (void)
|
||||
{
|
||||
GtkCssBorderValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssBorderValues *)gtk_css_values_new (GTK_CSS_BORDER_INITIAL_VALUES);
|
||||
|
||||
values->border_top_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_STYLE, NULL, NULL, NULL);
|
||||
values->border_top_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_WIDTH, NULL, NULL, NULL);
|
||||
values->border_left_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_LEFT_STYLE, NULL, NULL, NULL);
|
||||
values->border_left_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH, NULL, NULL, NULL);
|
||||
values->border_bottom_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE, NULL, NULL, NULL);
|
||||
values->border_bottom_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH, NULL, NULL, NULL);
|
||||
values->border_right_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE, NULL, NULL, NULL);
|
||||
values->border_right_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH, NULL, NULL, NULL);
|
||||
values->border_top_left_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS, NULL, NULL, NULL);
|
||||
values->border_top_right_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS, NULL, NULL, NULL);
|
||||
values->border_bottom_left_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS, NULL, NULL, NULL);
|
||||
values->border_bottom_right_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS, NULL, NULL, NULL);
|
||||
values->border_top_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_STYLE, &context);
|
||||
values->border_top_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_WIDTH, &context);
|
||||
values->border_left_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_LEFT_STYLE, &context);
|
||||
values->border_left_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH, &context);
|
||||
values->border_bottom_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE, &context);
|
||||
values->border_bottom_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH, &context);
|
||||
values->border_right_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE, &context);
|
||||
values->border_right_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH, &context);
|
||||
values->border_top_left_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS, &context);
|
||||
values->border_top_right_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS, &context);
|
||||
values->border_bottom_left_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS, &context);
|
||||
values->border_bottom_right_radius = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS, &context);
|
||||
values->border_top_color = NULL;
|
||||
values->border_right_color = NULL;
|
||||
values->border_bottom_color = NULL;
|
||||
values->border_left_color = NULL;
|
||||
values->border_image_source = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE, NULL, NULL, NULL);
|
||||
values->border_image_repeat = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_REPEAT, NULL, NULL, NULL);
|
||||
values->border_image_slice = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_SLICE, NULL, NULL, NULL);
|
||||
values->border_image_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH, NULL, NULL, NULL);
|
||||
values->border_image_source = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE, &context);
|
||||
values->border_image_repeat = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_REPEAT, &context);
|
||||
values->border_image_slice = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_SLICE, &context);
|
||||
values->border_image_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@@ -701,12 +701,13 @@ static GtkCssValues *
|
||||
gtk_css_outline_create_initial_values (void)
|
||||
{
|
||||
GtkCssOutlineValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssOutlineValues *)gtk_css_values_new (GTK_CSS_OUTLINE_INITIAL_VALUES);
|
||||
|
||||
values->outline_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_STYLE, NULL, NULL, NULL);
|
||||
values->outline_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_WIDTH, NULL, NULL, NULL);
|
||||
values->outline_offset = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_OFFSET, NULL, NULL, NULL);
|
||||
values->outline_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_STYLE, &context);
|
||||
values->outline_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_WIDTH, &context);
|
||||
values->outline_offset = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_OFFSET, &context);
|
||||
values->outline_color = NULL;
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
@@ -728,20 +729,21 @@ static GtkCssValues *
|
||||
gtk_css_font_variant_create_initial_values (void)
|
||||
{
|
||||
GtkCssFontVariantValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssFontVariantValues *)gtk_css_values_new (GTK_CSS_FONT_VARIANT_INITIAL_VALUES);
|
||||
|
||||
values->text_decoration_line = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_DECORATION_LINE, NULL, NULL, NULL);
|
||||
values->text_decoration_line = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_DECORATION_LINE, &context);
|
||||
values->text_decoration_color = NULL;
|
||||
values->text_decoration_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE, NULL, NULL, NULL);
|
||||
values->text_transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_TRANSFORM, NULL, NULL, NULL);
|
||||
values->font_kerning = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_KERNING, NULL, NULL, NULL);
|
||||
values->font_variant_ligatures = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_LIGATURES, NULL, NULL, NULL);
|
||||
values->font_variant_position = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_POSITION, NULL, NULL, NULL);
|
||||
values->font_variant_caps = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_CAPS, NULL, NULL, NULL);
|
||||
values->font_variant_numeric = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_NUMERIC, NULL, NULL, NULL);
|
||||
values->font_variant_alternates = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_ALTERNATES, NULL, NULL, NULL);
|
||||
values->font_variant_east_asian = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_EAST_ASIAN, NULL, NULL, NULL);
|
||||
values->text_decoration_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE, &context);
|
||||
values->text_transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_TRANSFORM, &context);
|
||||
values->font_kerning = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_KERNING, &context);
|
||||
values->font_variant_ligatures = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_LIGATURES, &context);
|
||||
values->font_variant_position = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_POSITION, &context);
|
||||
values->font_variant_caps = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_CAPS, &context);
|
||||
values->font_variant_numeric = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_NUMERIC, &context);
|
||||
values->font_variant_alternates = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_ALTERNATES, &context);
|
||||
values->font_variant_east_asian = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_EAST_ASIAN, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@@ -750,17 +752,18 @@ static GtkCssValues *
|
||||
gtk_css_animation_create_initial_values (void)
|
||||
{
|
||||
GtkCssAnimationValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssAnimationValues *)gtk_css_values_new (GTK_CSS_ANIMATION_INITIAL_VALUES);
|
||||
|
||||
values->animation_name = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_NAME, NULL, NULL, NULL);
|
||||
values->animation_duration = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DURATION, NULL, NULL, NULL);
|
||||
values->animation_timing_function = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION, NULL, NULL, NULL);
|
||||
values->animation_iteration_count = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT, NULL, NULL, NULL);
|
||||
values->animation_direction = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DIRECTION, NULL, NULL, NULL);
|
||||
values->animation_play_state = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE, NULL, NULL, NULL);
|
||||
values->animation_delay = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DELAY, NULL, NULL, NULL);
|
||||
values->animation_fill_mode = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_FILL_MODE, NULL, NULL, NULL);
|
||||
values->animation_name = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_NAME, &context);
|
||||
values->animation_duration = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DURATION, &context);
|
||||
values->animation_timing_function = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION, &context);
|
||||
values->animation_iteration_count = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT, &context);
|
||||
values->animation_direction = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DIRECTION, &context);
|
||||
values->animation_play_state = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE, &context);
|
||||
values->animation_delay = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DELAY, &context);
|
||||
values->animation_fill_mode = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_FILL_MODE, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@@ -769,13 +772,14 @@ static GtkCssValues *
|
||||
gtk_css_transition_create_initial_values (void)
|
||||
{
|
||||
GtkCssTransitionValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssTransitionValues *)gtk_css_values_new (GTK_CSS_TRANSITION_INITIAL_VALUES);
|
||||
|
||||
values->transition_property = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_PROPERTY, NULL, NULL, NULL);
|
||||
values->transition_duration = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_DURATION, NULL, NULL, NULL);
|
||||
values->transition_timing_function = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION, NULL, NULL, NULL);
|
||||
values->transition_delay = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_DELAY, NULL, NULL, NULL);
|
||||
values->transition_property = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_PROPERTY, &context);
|
||||
values->transition_duration = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_DURATION, &context);
|
||||
values->transition_timing_function = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION, &context);
|
||||
values->transition_delay = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_DELAY, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@@ -784,20 +788,21 @@ static GtkCssValues *
|
||||
gtk_css_size_create_initial_values (void)
|
||||
{
|
||||
GtkCssSizeValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssSizeValues *)gtk_css_values_new (GTK_CSS_SIZE_INITIAL_VALUES);
|
||||
|
||||
values->margin_top = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_TOP, NULL, NULL, NULL);
|
||||
values->margin_left = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_LEFT, NULL, NULL, NULL);
|
||||
values->margin_bottom = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_BOTTOM, NULL, NULL, NULL);
|
||||
values->margin_right = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_RIGHT, NULL, NULL, NULL);
|
||||
values->padding_top = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_TOP, NULL, NULL, NULL);
|
||||
values->padding_left = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_LEFT, NULL, NULL, NULL);
|
||||
values->padding_bottom = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_BOTTOM, NULL, NULL, NULL);
|
||||
values->padding_right = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_RIGHT, NULL, NULL, NULL);
|
||||
values->border_spacing = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_SPACING, NULL, NULL, NULL);
|
||||
values->min_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MIN_WIDTH, NULL, NULL, NULL);
|
||||
values->min_height = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MIN_HEIGHT, NULL, NULL, NULL);
|
||||
values->margin_top = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_TOP, &context);
|
||||
values->margin_left = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_LEFT, &context);
|
||||
values->margin_bottom = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_BOTTOM, &context);
|
||||
values->margin_right = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_RIGHT, &context);
|
||||
values->padding_top = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_TOP, &context);
|
||||
values->padding_left = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_LEFT, &context);
|
||||
values->padding_bottom = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_BOTTOM, &context);
|
||||
values->padding_right = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_RIGHT, &context);
|
||||
values->border_spacing = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_SPACING, &context);
|
||||
values->min_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MIN_WIDTH, &context);
|
||||
values->min_height = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MIN_HEIGHT, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@@ -806,16 +811,17 @@ static GtkCssValues *
|
||||
gtk_css_other_create_initial_values (void)
|
||||
{
|
||||
GtkCssOtherValues *values;
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
values = (GtkCssOtherValues *)gtk_css_values_new (GTK_CSS_OTHER_INITIAL_VALUES);
|
||||
|
||||
values->icon_source = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_SOURCE, NULL, NULL, NULL);
|
||||
values->icon_transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_TRANSFORM, NULL, NULL, NULL);
|
||||
values->icon_filter = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_FILTER, NULL, NULL, NULL);
|
||||
values->transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSFORM, NULL, NULL, NULL);
|
||||
values->transform_origin = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSFORM_ORIGIN, NULL, NULL, NULL);
|
||||
values->opacity = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OPACITY, NULL, NULL, NULL);
|
||||
values->filter = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FILTER, NULL, NULL, NULL);
|
||||
values->icon_source = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_SOURCE, &context);
|
||||
values->icon_transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_TRANSFORM, &context);
|
||||
values->icon_filter = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_FILTER, &context);
|
||||
values->transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSFORM, &context);
|
||||
values->transform_origin = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSFORM_ORIGIN, &context);
|
||||
values->opacity = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OPACITY, &context);
|
||||
values->filter = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FILTER, &context);
|
||||
|
||||
return (GtkCssValues *)values;
|
||||
}
|
||||
@@ -827,6 +833,8 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
||||
GtkCssStyle *parent_style)
|
||||
{
|
||||
GtkCssStyle *style = (GtkCssStyle *)sstyle;
|
||||
GtkCssValue *shorthands[GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES] = { NULL, };
|
||||
GtkCssComputeContext context = { NULL, };
|
||||
|
||||
gtk_internal_return_if_fail (lookup != NULL);
|
||||
gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
|
||||
@@ -839,6 +847,7 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
||||
gpointer id;
|
||||
GtkCssVariableValue *value;
|
||||
|
||||
g_clear_pointer (&style->variables, gtk_css_variable_set_unref);
|
||||
style->variables = gtk_css_variable_set_new ();
|
||||
|
||||
g_hash_table_iter_init (&iter, lookup->custom_values);
|
||||
@@ -856,9 +865,15 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
||||
}
|
||||
else if (parent_style && parent_style->variables)
|
||||
{
|
||||
g_clear_pointer (&style->variables, gtk_css_variable_set_unref);
|
||||
style->variables = gtk_css_variable_set_ref (parent_style->variables);
|
||||
}
|
||||
|
||||
context.provider = provider;
|
||||
context.style = (GtkCssStyle *) sstyle;
|
||||
context.parent_style = parent_style;
|
||||
context.shorthands = shorthands;
|
||||
|
||||
if (_gtk_bitmask_is_empty (_gtk_css_lookup_get_set_values (lookup)))
|
||||
{
|
||||
style->background = (GtkCssBackgroundValues *)gtk_css_values_ref (gtk_css_background_initial_values);
|
||||
@@ -878,9 +893,9 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_css_core_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_icon_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_font_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_core_values_new_compute (sstyle, lookup, &context);
|
||||
gtk_css_icon_values_new_compute (sstyle, lookup, &context);
|
||||
gtk_css_font_values_new_compute (sstyle, lookup, &context);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -889,57 +904,63 @@ gtk_css_lookup_resolve (GtkCssLookup *lookup,
|
||||
if (parent_style && gtk_css_core_values_unset (lookup))
|
||||
style->core = (GtkCssCoreValues *)gtk_css_values_ref ((GtkCssValues *)parent_style->core);
|
||||
else
|
||||
gtk_css_core_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_core_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
if (gtk_css_background_values_unset (lookup))
|
||||
style->background = (GtkCssBackgroundValues *)gtk_css_values_ref (gtk_css_background_initial_values);
|
||||
else
|
||||
gtk_css_background_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_background_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
if (gtk_css_border_values_unset (lookup))
|
||||
style->border = (GtkCssBorderValues *)gtk_css_values_ref (gtk_css_border_initial_values);
|
||||
else
|
||||
gtk_css_border_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_border_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
if (parent_style && gtk_css_icon_values_unset (lookup))
|
||||
style->icon = (GtkCssIconValues *)gtk_css_values_ref ((GtkCssValues *)parent_style->icon);
|
||||
else
|
||||
gtk_css_icon_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_icon_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
if (gtk_css_outline_values_unset (lookup))
|
||||
style->outline = (GtkCssOutlineValues *)gtk_css_values_ref (gtk_css_outline_initial_values);
|
||||
else
|
||||
gtk_css_outline_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_outline_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
if (parent_style && gtk_css_font_values_unset (lookup))
|
||||
style->font = (GtkCssFontValues *)gtk_css_values_ref ((GtkCssValues *)parent_style->font);
|
||||
else
|
||||
gtk_css_font_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_font_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
if (gtk_css_font_variant_values_unset (lookup))
|
||||
style->font_variant = (GtkCssFontVariantValues *)gtk_css_values_ref (gtk_css_font_variant_initial_values);
|
||||
else
|
||||
gtk_css_font_variant_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_font_variant_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
if (gtk_css_animation_values_unset (lookup))
|
||||
style->animation = (GtkCssAnimationValues *)gtk_css_values_ref (gtk_css_animation_initial_values);
|
||||
else
|
||||
gtk_css_animation_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_animation_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
if (gtk_css_transition_values_unset (lookup))
|
||||
style->transition = (GtkCssTransitionValues *)gtk_css_values_ref (gtk_css_transition_initial_values);
|
||||
else
|
||||
gtk_css_transition_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_transition_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
if (gtk_css_size_values_unset (lookup))
|
||||
style->size = (GtkCssSizeValues *)gtk_css_values_ref (gtk_css_size_initial_values);
|
||||
else
|
||||
gtk_css_size_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_size_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
if (gtk_css_other_values_unset (lookup))
|
||||
style->other = (GtkCssOtherValues *)gtk_css_values_ref (gtk_css_other_initial_values);
|
||||
else
|
||||
gtk_css_other_values_new_compute (sstyle, provider, parent_style, lookup);
|
||||
gtk_css_other_values_new_compute (sstyle, lookup, &context);
|
||||
|
||||
for (unsigned int i = 0; i < GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES; i++)
|
||||
{
|
||||
if (shorthands[i])
|
||||
gtk_css_value_unref (shorthands[i]);
|
||||
}
|
||||
}
|
||||
|
||||
GtkCssStyle *
|
||||
@@ -987,12 +1008,11 @@ G_STATIC_ASSERT (GTK_CSS_PROPERTY_BORDER_LEFT_STYLE == GTK_CSS_PROPERTY_BORDER_L
|
||||
G_STATIC_ASSERT (GTK_CSS_PROPERTY_OUTLINE_STYLE == GTK_CSS_PROPERTY_OUTLINE_WIDTH - 1);
|
||||
|
||||
static void
|
||||
gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *parent_style,
|
||||
guint id,
|
||||
GtkCssValue *specified,
|
||||
GtkCssSection *section)
|
||||
gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
guint id,
|
||||
GtkCssValue *specified,
|
||||
GtkCssSection *section,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *value, *original_value;
|
||||
GtkBorderStyle border_style;
|
||||
@@ -1032,21 +1052,21 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
*/
|
||||
if (specified)
|
||||
{
|
||||
value = _gtk_css_value_compute (specified, id, provider, (GtkCssStyle *)style, parent_style, NULL);
|
||||
value = gtk_css_value_compute (specified, id, context);
|
||||
|
||||
if (gtk_css_value_contains_variables (specified))
|
||||
original_value = specified;
|
||||
else
|
||||
original_value = NULL;
|
||||
}
|
||||
else if (parent_style && _gtk_css_style_property_is_inherit (_gtk_css_style_property_lookup_by_id (id)))
|
||||
else if (context->parent_style && _gtk_css_style_property_is_inherit (_gtk_css_style_property_lookup_by_id (id)))
|
||||
{
|
||||
GtkCssValue *parent_original_value;
|
||||
|
||||
/* Just take the style from the parent */
|
||||
value = _gtk_css_value_ref (gtk_css_style_get_value (parent_style, id));
|
||||
value = gtk_css_value_ref (gtk_css_style_get_value (context->parent_style, id));
|
||||
|
||||
parent_original_value = gtk_css_style_get_original_value (parent_style, id);
|
||||
parent_original_value = gtk_css_style_get_original_value (context->parent_style, id);
|
||||
|
||||
if (parent_original_value)
|
||||
original_value = parent_original_value;
|
||||
@@ -1055,7 +1075,7 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
|
||||
}
|
||||
else
|
||||
{
|
||||
value = _gtk_css_initial_value_new_compute (id, provider, (GtkCssStyle *)style, parent_style);
|
||||
value = _gtk_css_initial_value_new_compute (id, context);
|
||||
original_value = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,14 +35,11 @@ gtk_css_value_string_free (GtkCssValue *value)
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_string_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_string_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -151,7 +148,7 @@ _gtk_css_string_value_new_take (char *string)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_STRING);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_STRING);
|
||||
result->string = string;
|
||||
result->is_computed = TRUE;
|
||||
|
||||
@@ -192,7 +189,7 @@ _gtk_css_ident_value_new_take (char *ident)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
|
||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_IDENT);
|
||||
result = gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_IDENT);
|
||||
result->string = ident;
|
||||
result->is_computed = TRUE;
|
||||
|
||||
|
||||
+8
-10
@@ -367,7 +367,7 @@ gtk_css_style_print (GtkCssStyle *style,
|
||||
value = gtk_css_style_get_value (style, i);
|
||||
|
||||
g_string_append_printf (string, "%*s%s: ", indent, "", name);
|
||||
_gtk_css_value_print (value, string);
|
||||
gtk_css_value_print (value, string);
|
||||
g_string_append_c (string, ';');
|
||||
|
||||
if (section)
|
||||
@@ -683,7 +683,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
|
||||
}
|
||||
|
||||
/* letter-spacing */
|
||||
letter_spacing = _gtk_css_number_value_get (style->font->letter_spacing, 100);
|
||||
letter_spacing = gtk_css_number_value_get (style->font->letter_spacing, 100);
|
||||
if (letter_spacing != 0)
|
||||
{
|
||||
attrs = add_pango_attr (attrs, pango_attr_letter_spacing_new (letter_spacing * PANGO_SCALE));
|
||||
@@ -781,13 +781,13 @@ gtk_css_style_get_pango_font (GtkCssStyle *style)
|
||||
}
|
||||
|
||||
v = style->core->font_size;
|
||||
pango_font_description_set_absolute_size (description, round (_gtk_css_number_value_get (v, 100) * PANGO_SCALE));
|
||||
pango_font_description_set_absolute_size (description, round (gtk_css_number_value_get (v, 100) * PANGO_SCALE));
|
||||
|
||||
v = style->font->font_style;
|
||||
pango_font_description_set_style (description, _gtk_css_font_style_value_get (v));
|
||||
|
||||
v = style->font->font_weight;
|
||||
pango_font_description_set_weight (description, _gtk_css_number_value_get (v, 100));
|
||||
pango_font_description_set_weight (description, gtk_css_number_value_get (v, 100));
|
||||
|
||||
v = style->font->font_stretch;
|
||||
pango_font_description_set_stretch (description, _gtk_css_font_stretch_value_get (v));
|
||||
@@ -860,10 +860,9 @@ GtkCssValues *gtk_css_values_ref (GtkCssValues *values)
|
||||
static void
|
||||
gtk_css_values_free (GtkCssValues *values)
|
||||
{
|
||||
int i;
|
||||
GtkCssValue **v = GET_VALUES (values);
|
||||
|
||||
for (i = 0; i < N_VALUES (values->type); i++)
|
||||
for (int i = 0; i < N_VALUES (values->type); i++)
|
||||
{
|
||||
if (v[i])
|
||||
gtk_css_value_unref (v[i]);
|
||||
@@ -888,14 +887,13 @@ gtk_css_values_copy (GtkCssValues *values)
|
||||
{
|
||||
GtkCssValues *copy;
|
||||
GtkCssValue **v, **v2;
|
||||
int i;
|
||||
|
||||
copy = gtk_css_values_new (TYPE_INDEX(values->type));
|
||||
copy = gtk_css_values_new (TYPE_INDEX (values->type));
|
||||
|
||||
v = GET_VALUES (values);
|
||||
v2 = GET_VALUES (copy);
|
||||
|
||||
for (i = 0; i < N_VALUES (values->type); i++)
|
||||
for (int i = 0; i < N_VALUES (values->type); i++)
|
||||
{
|
||||
if (v[i])
|
||||
v2[i] = gtk_css_value_ref (v[i]);
|
||||
@@ -909,7 +907,7 @@ gtk_css_values_new (GtkCssValuesType type)
|
||||
{
|
||||
GtkCssValues *values;
|
||||
|
||||
values = (GtkCssValues *)g_malloc0 (VALUES_SIZE(type));
|
||||
values = (GtkCssValues *) g_malloc0 (VALUES_SIZE (type));
|
||||
values->ref_count = 1;
|
||||
values->type = type;
|
||||
|
||||
|
||||
@@ -186,12 +186,12 @@ gtk_css_style_change_print (GtkCssStyleChange *change,
|
||||
|
||||
g_string_append_printf (string, "%s: ", name);
|
||||
value = gtk_css_style_get_value (old, i);
|
||||
_gtk_css_value_print (value, string);
|
||||
gtk_css_value_print (value, string);
|
||||
g_string_append (string, "\n");
|
||||
|
||||
g_string_append_printf (string, "%s: ", name);
|
||||
value = gtk_css_style_get_value (new, i);
|
||||
_gtk_css_value_print (value, string);
|
||||
gtk_css_value_print (value, string);
|
||||
g_string_append (string, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ struct _GtkCssValues {
|
||||
|
||||
struct _GtkCssCoreValues {
|
||||
GtkCssValues base;
|
||||
|
||||
GtkCssValue *color;
|
||||
GtkCssValue *dpi;
|
||||
GtkCssValue *font_size;
|
||||
@@ -89,6 +90,7 @@ struct _GtkCssCoreValues {
|
||||
|
||||
struct _GtkCssBackgroundValues {
|
||||
GtkCssValues base;
|
||||
|
||||
GtkCssValue *background_color;
|
||||
GtkCssValue *box_shadow;
|
||||
GtkCssValue *background_clip;
|
||||
@@ -102,6 +104,7 @@ struct _GtkCssBackgroundValues {
|
||||
|
||||
struct _GtkCssBorderValues {
|
||||
GtkCssValues base;
|
||||
|
||||
GtkCssValue *border_top_style;
|
||||
GtkCssValue *border_top_width;
|
||||
GtkCssValue *border_left_style;
|
||||
@@ -126,6 +129,7 @@ struct _GtkCssBorderValues {
|
||||
|
||||
struct _GtkCssIconValues {
|
||||
GtkCssValues base;
|
||||
|
||||
GtkCssValue *icon_size;
|
||||
GtkCssValue *icon_shadow;
|
||||
GtkCssValue *icon_style;
|
||||
@@ -134,6 +138,7 @@ struct _GtkCssIconValues {
|
||||
|
||||
struct _GtkCssOutlineValues {
|
||||
GtkCssValues base;
|
||||
|
||||
GtkCssValue *outline_style;
|
||||
GtkCssValue *outline_width;
|
||||
GtkCssValue *outline_offset;
|
||||
@@ -142,6 +147,7 @@ struct _GtkCssOutlineValues {
|
||||
|
||||
struct _GtkCssFontValues {
|
||||
GtkCssValues base;
|
||||
|
||||
GtkCssValue *font_family;
|
||||
GtkCssValue *font_style;
|
||||
GtkCssValue *font_weight;
|
||||
@@ -157,6 +163,7 @@ struct _GtkCssFontValues {
|
||||
|
||||
struct _GtkCssFontVariantValues {
|
||||
GtkCssValues base;
|
||||
|
||||
GtkCssValue *text_decoration_line;
|
||||
GtkCssValue *text_decoration_color; // NULL if currentColor
|
||||
GtkCssValue *text_decoration_style;
|
||||
@@ -172,6 +179,7 @@ struct _GtkCssFontVariantValues {
|
||||
|
||||
struct _GtkCssAnimationValues {
|
||||
GtkCssValues base;
|
||||
|
||||
GtkCssValue *animation_name;
|
||||
GtkCssValue *animation_duration;
|
||||
GtkCssValue *animation_timing_function;
|
||||
@@ -184,6 +192,7 @@ struct _GtkCssAnimationValues {
|
||||
|
||||
struct _GtkCssTransitionValues {
|
||||
GtkCssValues base;
|
||||
|
||||
GtkCssValue *transition_property;
|
||||
GtkCssValue *transition_duration;
|
||||
GtkCssValue *transition_timing_function;
|
||||
@@ -192,6 +201,7 @@ struct _GtkCssTransitionValues {
|
||||
|
||||
struct _GtkCssSizeValues {
|
||||
GtkCssValues base;
|
||||
|
||||
GtkCssValue *margin_top;
|
||||
GtkCssValue *margin_left;
|
||||
GtkCssValue *margin_bottom;
|
||||
@@ -207,6 +217,7 @@ struct _GtkCssSizeValues {
|
||||
|
||||
struct _GtkCssOtherValues {
|
||||
GtkCssValues base;
|
||||
|
||||
GtkCssValue *icon_source;
|
||||
GtkCssValue *icon_transform;
|
||||
GtkCssValue *icon_filter;
|
||||
|
||||
@@ -84,7 +84,7 @@ gtk_css_style_property_register (const char * name,
|
||||
|
||||
node->parse_value = parse_value;
|
||||
|
||||
_gtk_css_value_unref (initial_value);
|
||||
gtk_css_value_unref (initial_value);
|
||||
|
||||
g_assert (_gtk_css_style_property_get_id (node) == expected_id);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ static GtkCssValue *
|
||||
color_parse (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
return _gtk_css_color_value_parse (parser);
|
||||
return gtk_css_color_value_parse (parser);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -163,12 +163,12 @@ font_weight_parse (GtkCssStyleProperty *property,
|
||||
value = gtk_css_font_weight_value_try_parse (parser);
|
||||
if (value == NULL)
|
||||
{
|
||||
value = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_POSITIVE_ONLY);
|
||||
value = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_POSITIVE_ONLY);
|
||||
if (value == NULL)
|
||||
return NULL;
|
||||
|
||||
if (_gtk_css_number_value_get (value, 100) < 1 ||
|
||||
_gtk_css_number_value_get (value, 100) > 1000)
|
||||
if (gtk_css_number_value_get (value, 100) < 1 ||
|
||||
gtk_css_number_value_get (value, 100) > 1000)
|
||||
{
|
||||
gtk_css_parser_error_value (parser, "Font weight values must be between 1 and 1000");
|
||||
g_clear_pointer (&value, gtk_css_value_unref);
|
||||
@@ -242,7 +242,7 @@ static GtkCssValue *
|
||||
opacity_parse (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
return _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -285,10 +285,10 @@ static GtkCssValue *
|
||||
icon_size_parse (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
return _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_POSITIVE_ONLY);
|
||||
return gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_POSITIVE_ONLY);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -314,7 +314,7 @@ static GtkCssValue *
|
||||
parse_letter_spacing (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
return _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH);
|
||||
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -597,7 +597,7 @@ static GtkCssValue *
|
||||
dpi_parse (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
return _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
@@ -609,10 +609,10 @@ gtk_css_font_size_value_parse (GtkCssParser *parser)
|
||||
if (value)
|
||||
return value;
|
||||
|
||||
return _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_POSITIVE_ONLY);
|
||||
return gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_POSITIVE_ONLY);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -626,8 +626,8 @@ static GtkCssValue *
|
||||
outline_parse (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
return _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH);
|
||||
return gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -674,9 +674,9 @@ static GtkCssValue *
|
||||
minmax_parse (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
return _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH
|
||||
| GTK_CSS_POSITIVE_ONLY);
|
||||
return gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH
|
||||
| GTK_CSS_POSITIVE_ONLY);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -705,7 +705,7 @@ transition_property_parse (GtkCssStyleProperty *property,
|
||||
static GtkCssValue *
|
||||
transition_time_parse_one (GtkCssParser *parser)
|
||||
{
|
||||
return _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_TIME);
|
||||
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_TIME);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -726,9 +726,9 @@ static GtkCssValue *
|
||||
iteration_count_parse_one (GtkCssParser *parser)
|
||||
{
|
||||
if (gtk_css_parser_try_ident (parser, "infinite"))
|
||||
return _gtk_css_number_value_new (HUGE_VAL, GTK_CSS_NUMBER);
|
||||
return gtk_css_number_value_new (HUGE_VAL, GTK_CSS_NUMBER);
|
||||
|
||||
return _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_POSITIVE_ONLY);
|
||||
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_POSITIVE_ONLY);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -742,26 +742,25 @@ static GtkCssValue *
|
||||
parse_margin (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
return _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH);
|
||||
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
parse_padding (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
return _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
return gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
parse_border_width (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
return _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
return gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_PARSE_LENGTH);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -854,7 +853,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_TEXT_SIZE,
|
||||
dpi_parse,
|
||||
_gtk_css_number_value_new (96.0, GTK_CSS_NUMBER));
|
||||
gtk_css_number_value_new (96.0, GTK_CSS_NUMBER));
|
||||
gtk_css_style_property_register ("font-size",
|
||||
GTK_CSS_PROPERTY_FONT_SIZE,
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
@@ -895,7 +894,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_TEXT_SIZE,
|
||||
font_weight_parse,
|
||||
_gtk_css_number_value_new (PANGO_WEIGHT_NORMAL, GTK_CSS_NUMBER));
|
||||
gtk_css_number_value_new (PANGO_WEIGHT_NORMAL, GTK_CSS_NUMBER));
|
||||
gtk_css_style_property_register ("font-stretch",
|
||||
GTK_CSS_PROPERTY_FONT_STRETCH,
|
||||
GTK_STYLE_PROPERTY_INHERIT,
|
||||
@@ -908,7 +907,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_TEXT_ATTRS | GTK_CSS_AFFECTS_TEXT_SIZE,
|
||||
parse_letter_spacing,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
|
||||
gtk_css_style_property_register ("text-decoration-line",
|
||||
GTK_CSS_PROPERTY_TEXT_DECORATION_LINE,
|
||||
@@ -921,7 +920,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_TEXT_ATTRS,
|
||||
color_parse,
|
||||
_gtk_css_color_value_new_current_color ());
|
||||
gtk_css_color_value_new_current_color ());
|
||||
gtk_css_style_property_register ("text-decoration-style",
|
||||
GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE,
|
||||
0,
|
||||
@@ -995,49 +994,49 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE,
|
||||
parse_margin,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("margin-left",
|
||||
GTK_CSS_PROPERTY_MARGIN_LEFT,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE,
|
||||
parse_margin,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("margin-bottom",
|
||||
GTK_CSS_PROPERTY_MARGIN_BOTTOM,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE,
|
||||
parse_margin,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("margin-right",
|
||||
GTK_CSS_PROPERTY_MARGIN_RIGHT,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE,
|
||||
parse_margin,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("padding-top",
|
||||
GTK_CSS_PROPERTY_PADDING_TOP,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE,
|
||||
parse_padding,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("padding-left",
|
||||
GTK_CSS_PROPERTY_PADDING_LEFT,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE,
|
||||
parse_padding,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("padding-bottom",
|
||||
GTK_CSS_PROPERTY_PADDING_BOTTOM,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE,
|
||||
parse_padding,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("padding-right",
|
||||
GTK_CSS_PROPERTY_PADDING_RIGHT,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE,
|
||||
parse_padding,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
/* IMPORTANT: the border-width properties must come after border-style properties,
|
||||
* they depend on them for their value computation.
|
||||
*/
|
||||
@@ -1052,7 +1051,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BORDER | GTK_CSS_AFFECTS_SIZE,
|
||||
parse_border_width,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("border-left-style",
|
||||
GTK_CSS_PROPERTY_BORDER_LEFT_STYLE,
|
||||
0,
|
||||
@@ -1064,7 +1063,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BORDER | GTK_CSS_AFFECTS_SIZE,
|
||||
parse_border_width,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("border-bottom-style",
|
||||
GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE,
|
||||
0,
|
||||
@@ -1076,7 +1075,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BORDER | GTK_CSS_AFFECTS_SIZE,
|
||||
parse_border_width,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("border-right-style",
|
||||
GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE,
|
||||
0,
|
||||
@@ -1088,36 +1087,36 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BORDER | GTK_CSS_AFFECTS_SIZE,
|
||||
parse_border_width,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
|
||||
gtk_css_style_property_register ("border-top-left-radius",
|
||||
GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
|
||||
border_corner_radius_value_parse,
|
||||
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
_gtk_css_corner_value_new (gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
gtk_css_style_property_register ("border-top-right-radius",
|
||||
GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
|
||||
border_corner_radius_value_parse,
|
||||
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
_gtk_css_corner_value_new (gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
gtk_css_style_property_register ("border-bottom-right-radius",
|
||||
GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
|
||||
border_corner_radius_value_parse,
|
||||
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
_gtk_css_corner_value_new (gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
gtk_css_style_property_register ("border-bottom-left-radius",
|
||||
GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
|
||||
border_corner_radius_value_parse,
|
||||
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
_gtk_css_corner_value_new (gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
|
||||
gtk_css_style_property_register ("outline-style",
|
||||
GTK_CSS_PROPERTY_OUTLINE_STYLE,
|
||||
@@ -1130,13 +1129,13 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_OUTLINE,
|
||||
parse_border_width,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("outline-offset",
|
||||
GTK_CSS_PROPERTY_OUTLINE_OFFSET,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_OUTLINE,
|
||||
outline_parse,
|
||||
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0.0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("background-clip",
|
||||
GTK_CSS_PROPERTY_BACKGROUND_CLIP,
|
||||
0,
|
||||
@@ -1160,39 +1159,39 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BACKGROUND,
|
||||
background_position_parse,
|
||||
_gtk_css_position_value_new (_gtk_css_number_value_new (0, GTK_CSS_PERCENT),
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PERCENT)));
|
||||
_gtk_css_position_value_new (gtk_css_number_value_new (0, GTK_CSS_PERCENT),
|
||||
gtk_css_number_value_new (0, GTK_CSS_PERCENT)));
|
||||
|
||||
gtk_css_style_property_register ("border-top-color",
|
||||
GTK_CSS_PROPERTY_BORDER_TOP_COLOR,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BORDER,
|
||||
color_parse,
|
||||
_gtk_css_color_value_new_current_color ());
|
||||
gtk_css_color_value_new_current_color ());
|
||||
gtk_css_style_property_register ("border-right-color",
|
||||
GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BORDER,
|
||||
color_parse,
|
||||
_gtk_css_color_value_new_current_color ());
|
||||
gtk_css_color_value_new_current_color ());
|
||||
gtk_css_style_property_register ("border-bottom-color",
|
||||
GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BORDER,
|
||||
color_parse,
|
||||
_gtk_css_color_value_new_current_color ());
|
||||
gtk_css_color_value_new_current_color ());
|
||||
gtk_css_style_property_register ("border-left-color",
|
||||
GTK_CSS_PROPERTY_BORDER_LEFT_COLOR,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_BORDER,
|
||||
color_parse,
|
||||
_gtk_css_color_value_new_current_color ());
|
||||
gtk_css_color_value_new_current_color ());
|
||||
gtk_css_style_property_register ("outline-color",
|
||||
GTK_CSS_PROPERTY_OUTLINE_COLOR,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_OUTLINE,
|
||||
color_parse,
|
||||
_gtk_css_color_value_new_current_color ());
|
||||
gtk_css_color_value_new_current_color ());
|
||||
|
||||
gtk_css_style_property_register ("background-repeat",
|
||||
GTK_CSS_PROPERTY_BACKGROUND_REPEAT,
|
||||
@@ -1234,19 +1233,19 @@ _gtk_css_style_property_init_properties (void)
|
||||
0,
|
||||
GTK_CSS_AFFECTS_BORDER,
|
||||
border_image_slice_parse,
|
||||
_gtk_css_border_value_new (_gtk_css_number_value_new (100, GTK_CSS_PERCENT),
|
||||
_gtk_css_number_value_new (100, GTK_CSS_PERCENT),
|
||||
_gtk_css_number_value_new (100, GTK_CSS_PERCENT),
|
||||
_gtk_css_number_value_new (100, GTK_CSS_PERCENT)));
|
||||
_gtk_css_border_value_new (gtk_css_number_value_new (100, GTK_CSS_PERCENT),
|
||||
gtk_css_number_value_new (100, GTK_CSS_PERCENT),
|
||||
gtk_css_number_value_new (100, GTK_CSS_PERCENT),
|
||||
gtk_css_number_value_new (100, GTK_CSS_PERCENT)));
|
||||
gtk_css_style_property_register ("border-image-width",
|
||||
GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH,
|
||||
0,
|
||||
GTK_CSS_AFFECTS_BORDER,
|
||||
border_image_width_parse,
|
||||
_gtk_css_border_value_new (_gtk_css_number_value_new (1, GTK_CSS_NUMBER),
|
||||
_gtk_css_number_value_new (1, GTK_CSS_NUMBER),
|
||||
_gtk_css_number_value_new (1, GTK_CSS_NUMBER),
|
||||
_gtk_css_number_value_new (1, GTK_CSS_NUMBER)));
|
||||
_gtk_css_border_value_new (gtk_css_number_value_new (1, GTK_CSS_NUMBER),
|
||||
gtk_css_number_value_new (1, GTK_CSS_NUMBER),
|
||||
gtk_css_number_value_new (1, GTK_CSS_NUMBER),
|
||||
gtk_css_number_value_new (1, GTK_CSS_NUMBER)));
|
||||
|
||||
gtk_css_style_property_register ("-gtk-icon-source",
|
||||
GTK_CSS_PROPERTY_ICON_SOURCE,
|
||||
@@ -1259,7 +1258,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_ICON_SIZE,
|
||||
icon_size_parse,
|
||||
_gtk_css_number_value_new (16, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (16, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("-gtk-icon-shadow",
|
||||
GTK_CSS_PROPERTY_ICON_SHADOW,
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
@@ -1289,8 +1288,8 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE,
|
||||
border_spacing_value_parse,
|
||||
_gtk_css_position_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
_gtk_css_position_value_new (gtk_css_number_value_new (0, GTK_CSS_PX),
|
||||
gtk_css_number_value_new (0, GTK_CSS_PX)));
|
||||
|
||||
gtk_css_style_property_register ("transform",
|
||||
GTK_CSS_PROPERTY_TRANSFORM,
|
||||
@@ -1303,20 +1302,20 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_TRANSFORM,
|
||||
transform_origin_parse,
|
||||
_gtk_css_position_value_new (_gtk_css_number_value_new (50, GTK_CSS_PERCENT),
|
||||
_gtk_css_number_value_new (50, GTK_CSS_PERCENT)));
|
||||
_gtk_css_position_value_new (gtk_css_number_value_new (50, GTK_CSS_PERCENT),
|
||||
gtk_css_number_value_new (50, GTK_CSS_PERCENT)));
|
||||
gtk_css_style_property_register ("min-width",
|
||||
GTK_CSS_PROPERTY_MIN_WIDTH,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE,
|
||||
minmax_parse,
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0, GTK_CSS_PX));
|
||||
gtk_css_style_property_register ("min-height",
|
||||
GTK_CSS_PROPERTY_MIN_HEIGHT,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_SIZE,
|
||||
minmax_parse,
|
||||
_gtk_css_number_value_new (0, GTK_CSS_PX));
|
||||
gtk_css_number_value_new (0, GTK_CSS_PX));
|
||||
|
||||
gtk_css_style_property_register ("transition-property",
|
||||
GTK_CSS_PROPERTY_TRANSITION_PROPERTY,
|
||||
@@ -1329,7 +1328,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
0,
|
||||
0,
|
||||
transition_time_parse,
|
||||
_gtk_css_number_value_new (0, GTK_CSS_S));
|
||||
gtk_css_number_value_new (0, GTK_CSS_S));
|
||||
gtk_css_style_property_register ("transition-timing-function",
|
||||
GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION,
|
||||
0,
|
||||
@@ -1341,7 +1340,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
0,
|
||||
0,
|
||||
transition_time_parse,
|
||||
_gtk_css_number_value_new (0, GTK_CSS_S));
|
||||
gtk_css_number_value_new (0, GTK_CSS_S));
|
||||
|
||||
gtk_css_style_property_register ("animation-name",
|
||||
GTK_CSS_PROPERTY_ANIMATION_NAME,
|
||||
@@ -1354,7 +1353,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
0,
|
||||
0,
|
||||
transition_time_parse,
|
||||
_gtk_css_number_value_new (0, GTK_CSS_S));
|
||||
gtk_css_number_value_new (0, GTK_CSS_S));
|
||||
gtk_css_style_property_register ("animation-timing-function",
|
||||
GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION,
|
||||
0,
|
||||
@@ -1366,7 +1365,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
0,
|
||||
0,
|
||||
iteration_count_parse,
|
||||
_gtk_css_number_value_new (1, GTK_CSS_NUMBER));
|
||||
gtk_css_number_value_new (1, GTK_CSS_NUMBER));
|
||||
gtk_css_style_property_register ("animation-direction",
|
||||
GTK_CSS_PROPERTY_ANIMATION_DIRECTION,
|
||||
0,
|
||||
@@ -1384,7 +1383,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
0,
|
||||
0,
|
||||
transition_time_parse,
|
||||
_gtk_css_number_value_new (0, GTK_CSS_S));
|
||||
gtk_css_number_value_new (0, GTK_CSS_S));
|
||||
gtk_css_style_property_register ("animation-fill-mode",
|
||||
GTK_CSS_PROPERTY_ANIMATION_FILL_MODE,
|
||||
0,
|
||||
@@ -1397,7 +1396,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_POSTEFFECT,
|
||||
opacity_parse,
|
||||
_gtk_css_number_value_new (1, GTK_CSS_NUMBER));
|
||||
gtk_css_number_value_new (1, GTK_CSS_NUMBER));
|
||||
gtk_css_style_property_register ("filter",
|
||||
GTK_CSS_PROPERTY_FILTER,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
@@ -1410,13 +1409,13 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_CONTENT,
|
||||
color_parse,
|
||||
_gtk_css_color_value_new_current_color ());
|
||||
gtk_css_color_value_new_current_color ());
|
||||
gtk_css_style_property_register ("-gtk-secondary-caret-color",
|
||||
GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR,
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_CONTENT,
|
||||
color_parse,
|
||||
_gtk_css_color_value_new_current_color ());
|
||||
gtk_css_color_value_new_current_color ());
|
||||
gtk_css_style_property_register ("font-feature-settings",
|
||||
GTK_CSS_PROPERTY_FONT_FEATURE_SETTINGS,
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
@@ -1434,5 +1433,5 @@ _gtk_css_style_property_init_properties (void)
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
GTK_CSS_AFFECTS_TEXT_ATTRS | GTK_CSS_AFFECTS_TEXT_SIZE,
|
||||
parse_line_height,
|
||||
_gtk_css_value_ref (gtk_css_line_height_value_get_default ()));
|
||||
gtk_css_value_ref (gtk_css_line_height_value_get_default ()));
|
||||
}
|
||||
|
||||
+152
-161
@@ -90,33 +90,33 @@ gtk_css_transform_clear (GtkCssTransform *transform)
|
||||
case GTK_CSS_TRANSFORM_MATRIX:
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_TRANSLATE:
|
||||
_gtk_css_value_unref (transform->translate.x);
|
||||
_gtk_css_value_unref (transform->translate.y);
|
||||
_gtk_css_value_unref (transform->translate.z);
|
||||
gtk_css_value_unref (transform->translate.x);
|
||||
gtk_css_value_unref (transform->translate.y);
|
||||
gtk_css_value_unref (transform->translate.z);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_ROTATE:
|
||||
_gtk_css_value_unref (transform->rotate.x);
|
||||
_gtk_css_value_unref (transform->rotate.y);
|
||||
_gtk_css_value_unref (transform->rotate.z);
|
||||
_gtk_css_value_unref (transform->rotate.angle);
|
||||
gtk_css_value_unref (transform->rotate.x);
|
||||
gtk_css_value_unref (transform->rotate.y);
|
||||
gtk_css_value_unref (transform->rotate.z);
|
||||
gtk_css_value_unref (transform->rotate.angle);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SCALE:
|
||||
_gtk_css_value_unref (transform->scale.x);
|
||||
_gtk_css_value_unref (transform->scale.y);
|
||||
_gtk_css_value_unref (transform->scale.z);
|
||||
gtk_css_value_unref (transform->scale.x);
|
||||
gtk_css_value_unref (transform->scale.y);
|
||||
gtk_css_value_unref (transform->scale.z);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SKEW:
|
||||
_gtk_css_value_unref (transform->skew.x);
|
||||
_gtk_css_value_unref (transform->skew.y);
|
||||
gtk_css_value_unref (transform->skew.x);
|
||||
gtk_css_value_unref (transform->skew.y);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SKEW_X:
|
||||
_gtk_css_value_unref (transform->skew_x.skew);
|
||||
gtk_css_value_unref (transform->skew_x.skew);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SKEW_Y:
|
||||
_gtk_css_value_unref (transform->skew_y.skew);
|
||||
gtk_css_value_unref (transform->skew_y.skew);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_PERSPECTIVE:
|
||||
_gtk_css_value_unref (transform->perspective.depth);
|
||||
gtk_css_value_unref (transform->perspective.depth);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_NONE:
|
||||
default:
|
||||
@@ -135,30 +135,30 @@ gtk_css_transform_init_identity (GtkCssTransform *transform,
|
||||
graphene_matrix_init_identity (&transform->matrix.matrix);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_TRANSLATE:
|
||||
transform->translate.x = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform->translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform->translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform->translate.x = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform->translate.y = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform->translate.z = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_ROTATE:
|
||||
transform->rotate.x = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform->rotate.y = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform->rotate.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform->rotate.angle = _gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
transform->rotate.x = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform->rotate.y = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform->rotate.z = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform->rotate.angle = gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SCALE:
|
||||
transform->scale.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform->scale.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform->scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform->scale.x = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform->scale.y = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform->scale.z = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SKEW:
|
||||
transform->skew.x = _gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
transform->skew.y = _gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
transform->skew.x = gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
transform->skew.y = gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SKEW_X:
|
||||
transform->skew_x.skew = _gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
transform->skew_x.skew = gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SKEW_Y:
|
||||
transform->skew_y.skew = _gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
transform->skew_y.skew = gtk_css_number_value_new (0, GTK_CSS_DEG);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_PERSPECTIVE:
|
||||
return FALSE;
|
||||
@@ -188,9 +188,9 @@ gtk_css_transform_apply (const GtkCssTransform *transform,
|
||||
case GTK_CSS_TRANSFORM_TRANSLATE:
|
||||
return gsk_transform_translate_3d (next,
|
||||
&GRAPHENE_POINT3D_INIT (
|
||||
_gtk_css_number_value_get (transform->translate.x, 100),
|
||||
_gtk_css_number_value_get (transform->translate.y, 100),
|
||||
_gtk_css_number_value_get (transform->translate.z, 100)
|
||||
gtk_css_number_value_get (transform->translate.x, 100),
|
||||
gtk_css_number_value_get (transform->translate.y, 100),
|
||||
gtk_css_number_value_get (transform->translate.z, 100)
|
||||
));
|
||||
|
||||
case GTK_CSS_TRANSFORM_ROTATE:
|
||||
@@ -198,41 +198,41 @@ gtk_css_transform_apply (const GtkCssTransform *transform,
|
||||
graphene_vec3_t axis;
|
||||
|
||||
graphene_vec3_init (&axis,
|
||||
_gtk_css_number_value_get (transform->rotate.x, 1),
|
||||
_gtk_css_number_value_get (transform->rotate.y, 1),
|
||||
_gtk_css_number_value_get (transform->rotate.z, 1));
|
||||
gtk_css_number_value_get (transform->rotate.x, 1),
|
||||
gtk_css_number_value_get (transform->rotate.y, 1),
|
||||
gtk_css_number_value_get (transform->rotate.z, 1));
|
||||
return gsk_transform_rotate_3d (next,
|
||||
_gtk_css_number_value_get (transform->rotate.angle, 100),
|
||||
gtk_css_number_value_get (transform->rotate.angle, 100),
|
||||
&axis);
|
||||
}
|
||||
|
||||
case GTK_CSS_TRANSFORM_SCALE:
|
||||
return gsk_transform_scale_3d (next,
|
||||
_gtk_css_number_value_get (transform->scale.x, 1),
|
||||
_gtk_css_number_value_get (transform->scale.y, 1),
|
||||
_gtk_css_number_value_get (transform->scale.z, 1));
|
||||
gtk_css_number_value_get (transform->scale.x, 1),
|
||||
gtk_css_number_value_get (transform->scale.y, 1),
|
||||
gtk_css_number_value_get (transform->scale.z, 1));
|
||||
|
||||
case GTK_CSS_TRANSFORM_SKEW:
|
||||
graphene_matrix_init_skew (&skew,
|
||||
_gtk_css_number_value_get (transform->skew.x, 100) / 180.0f * G_PI,
|
||||
_gtk_css_number_value_get (transform->skew.y, 100) / 180.0f * G_PI);
|
||||
gtk_css_number_value_get (transform->skew.x, 100) / 180.0f * G_PI,
|
||||
gtk_css_number_value_get (transform->skew.y, 100) / 180.0f * G_PI);
|
||||
return gsk_transform_matrix (next, &skew);
|
||||
|
||||
case GTK_CSS_TRANSFORM_SKEW_X:
|
||||
graphene_matrix_init_skew (&skew,
|
||||
_gtk_css_number_value_get (transform->skew_x.skew, 100) / 180.0f * G_PI,
|
||||
gtk_css_number_value_get (transform->skew_x.skew, 100) / 180.0f * G_PI,
|
||||
0);
|
||||
return gsk_transform_matrix (next, &skew);
|
||||
|
||||
case GTK_CSS_TRANSFORM_SKEW_Y:
|
||||
graphene_matrix_init_skew (&skew,
|
||||
0,
|
||||
_gtk_css_number_value_get (transform->skew_y.skew, 100) / 180.0f * G_PI);
|
||||
gtk_css_number_value_get (transform->skew_y.skew, 100) / 180.0f * G_PI);
|
||||
return gsk_transform_matrix (next, &skew);
|
||||
|
||||
case GTK_CSS_TRANSFORM_PERSPECTIVE:
|
||||
return gsk_transform_perspective (next,
|
||||
_gtk_css_number_value_get (transform->perspective.depth, 100));
|
||||
gtk_css_number_value_get (transform->perspective.depth, 100));
|
||||
|
||||
case GTK_CSS_TRANSFORM_NONE:
|
||||
default:
|
||||
@@ -273,13 +273,10 @@ gtk_css_value_transform_free (GtkCssValue *value)
|
||||
|
||||
/* returns TRUE if dest == src */
|
||||
static gboolean
|
||||
gtk_css_transform_compute (GtkCssTransform *dest,
|
||||
GtkCssTransform *src,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_transform_compute (GtkCssTransform *dest,
|
||||
GtkCssTransform *src,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
dest->type = src->type;
|
||||
|
||||
@@ -289,41 +286,41 @@ gtk_css_transform_compute (GtkCssTransform *dest,
|
||||
memcpy (dest, src, sizeof (GtkCssTransform));
|
||||
return TRUE;
|
||||
case GTK_CSS_TRANSFORM_TRANSLATE:
|
||||
dest->translate.x = _gtk_css_value_compute (src->translate.x, property_id, provider, style, parent_style, variables);
|
||||
dest->translate.y = _gtk_css_value_compute (src->translate.y, property_id, provider, style, parent_style, variables);
|
||||
dest->translate.z = _gtk_css_value_compute (src->translate.z, property_id, provider, style, parent_style, variables);
|
||||
dest->translate.x = gtk_css_value_compute (src->translate.x, property_id, context);
|
||||
dest->translate.y = gtk_css_value_compute (src->translate.y, property_id, context);
|
||||
dest->translate.z = gtk_css_value_compute (src->translate.z, property_id, context);
|
||||
return dest->translate.x == src->translate.x
|
||||
&& dest->translate.y == src->translate.y
|
||||
&& dest->translate.z == src->translate.z;
|
||||
case GTK_CSS_TRANSFORM_ROTATE:
|
||||
dest->rotate.x = _gtk_css_value_compute (src->rotate.x, property_id, provider, style, parent_style, variables);
|
||||
dest->rotate.y = _gtk_css_value_compute (src->rotate.y, property_id, provider, style, parent_style, variables);
|
||||
dest->rotate.z = _gtk_css_value_compute (src->rotate.z, property_id, provider, style, parent_style, variables);
|
||||
dest->rotate.angle = _gtk_css_value_compute (src->rotate.angle, property_id, provider, style, parent_style, variables);
|
||||
dest->rotate.x = gtk_css_value_compute (src->rotate.x, property_id, context);
|
||||
dest->rotate.y = gtk_css_value_compute (src->rotate.y, property_id, context);
|
||||
dest->rotate.z = gtk_css_value_compute (src->rotate.z, property_id, context);
|
||||
dest->rotate.angle = gtk_css_value_compute (src->rotate.angle, property_id, context);
|
||||
return dest->rotate.x == src->rotate.x
|
||||
&& dest->rotate.y == src->rotate.y
|
||||
&& dest->rotate.z == src->rotate.z
|
||||
&& dest->rotate.angle == src->rotate.angle;
|
||||
case GTK_CSS_TRANSFORM_SCALE:
|
||||
dest->scale.x = _gtk_css_value_compute (src->scale.x, property_id, provider, style, parent_style, variables);
|
||||
dest->scale.y = _gtk_css_value_compute (src->scale.y, property_id, provider, style, parent_style, variables);
|
||||
dest->scale.z = _gtk_css_value_compute (src->scale.z, property_id, provider, style, parent_style, variables);
|
||||
dest->scale.x = gtk_css_value_compute (src->scale.x, property_id, context);
|
||||
dest->scale.y = gtk_css_value_compute (src->scale.y, property_id, context);
|
||||
dest->scale.z = gtk_css_value_compute (src->scale.z, property_id, context);
|
||||
return dest->scale.x == src->scale.x
|
||||
&& dest->scale.y == src->scale.y
|
||||
&& dest->scale.z == src->scale.z;
|
||||
case GTK_CSS_TRANSFORM_SKEW:
|
||||
dest->skew.x = _gtk_css_value_compute (src->skew.x, property_id, provider, style, parent_style, variables);
|
||||
dest->skew.y = _gtk_css_value_compute (src->skew.y, property_id, provider, style, parent_style, variables);
|
||||
dest->skew.x = gtk_css_value_compute (src->skew.x, property_id, context);
|
||||
dest->skew.y = gtk_css_value_compute (src->skew.y, property_id, context);
|
||||
return dest->skew.x == src->skew.x
|
||||
&& dest->skew.y == src->skew.y;
|
||||
case GTK_CSS_TRANSFORM_SKEW_X:
|
||||
dest->skew_x.skew = _gtk_css_value_compute (src->skew_x.skew, property_id, provider, style, parent_style, variables);
|
||||
dest->skew_x.skew = gtk_css_value_compute (src->skew_x.skew, property_id, context);
|
||||
return dest->skew_x.skew == src->skew_x.skew;
|
||||
case GTK_CSS_TRANSFORM_SKEW_Y:
|
||||
dest->skew_y.skew = _gtk_css_value_compute (src->skew_y.skew, property_id, provider, style, parent_style, variables);
|
||||
dest->skew_y.skew = gtk_css_value_compute (src->skew_y.skew, property_id, context);
|
||||
return dest->skew_y.skew == src->skew_y.skew;
|
||||
case GTK_CSS_TRANSFORM_PERSPECTIVE:
|
||||
dest->perspective.depth = _gtk_css_value_compute (src->perspective.depth, property_id, provider, style, parent_style, variables);
|
||||
dest->perspective.depth = gtk_css_value_compute (src->perspective.depth, property_id, context);
|
||||
return dest->perspective.depth == src->perspective.depth;
|
||||
case GTK_CSS_TRANSFORM_NONE:
|
||||
default:
|
||||
@@ -333,12 +330,9 @@ gtk_css_transform_compute (GtkCssTransform *dest,
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_transform_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_transform_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
gboolean changes;
|
||||
@@ -346,7 +340,7 @@ gtk_css_value_transform_compute (GtkCssValue *value,
|
||||
|
||||
/* Special case the 99% case of "none" */
|
||||
if (gtk_css_transform_value_is_none (value))
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
|
||||
changes = FALSE;
|
||||
result = gtk_css_transform_value_alloc (value->n_transforms);
|
||||
@@ -356,16 +350,13 @@ gtk_css_value_transform_compute (GtkCssValue *value,
|
||||
changes |= !gtk_css_transform_compute (&result->transforms[i],
|
||||
&value->transforms[i],
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
context);
|
||||
}
|
||||
|
||||
if (!changes)
|
||||
{
|
||||
_gtk_css_value_unref (result);
|
||||
result = _gtk_css_value_ref (value);
|
||||
gtk_css_value_unref (result);
|
||||
result = gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -394,27 +385,27 @@ gtk_css_transform_equal (const GtkCssTransform *transform1,
|
||||
return TRUE;
|
||||
}
|
||||
case GTK_CSS_TRANSFORM_TRANSLATE:
|
||||
return _gtk_css_value_equal (transform1->translate.x, transform2->translate.x)
|
||||
&& _gtk_css_value_equal (transform1->translate.y, transform2->translate.y)
|
||||
&& _gtk_css_value_equal (transform1->translate.z, transform2->translate.z);
|
||||
return gtk_css_value_equal (transform1->translate.x, transform2->translate.x)
|
||||
&& gtk_css_value_equal (transform1->translate.y, transform2->translate.y)
|
||||
&& gtk_css_value_equal (transform1->translate.z, transform2->translate.z);
|
||||
case GTK_CSS_TRANSFORM_ROTATE:
|
||||
return _gtk_css_value_equal (transform1->rotate.x, transform2->rotate.x)
|
||||
&& _gtk_css_value_equal (transform1->rotate.y, transform2->rotate.y)
|
||||
&& _gtk_css_value_equal (transform1->rotate.z, transform2->rotate.z)
|
||||
&& _gtk_css_value_equal (transform1->rotate.angle, transform2->rotate.angle);
|
||||
return gtk_css_value_equal (transform1->rotate.x, transform2->rotate.x)
|
||||
&& gtk_css_value_equal (transform1->rotate.y, transform2->rotate.y)
|
||||
&& gtk_css_value_equal (transform1->rotate.z, transform2->rotate.z)
|
||||
&& gtk_css_value_equal (transform1->rotate.angle, transform2->rotate.angle);
|
||||
case GTK_CSS_TRANSFORM_SCALE:
|
||||
return _gtk_css_value_equal (transform1->scale.x, transform2->scale.x)
|
||||
&& _gtk_css_value_equal (transform1->scale.y, transform2->scale.y)
|
||||
&& _gtk_css_value_equal (transform1->scale.z, transform2->scale.z);
|
||||
return gtk_css_value_equal (transform1->scale.x, transform2->scale.x)
|
||||
&& gtk_css_value_equal (transform1->scale.y, transform2->scale.y)
|
||||
&& gtk_css_value_equal (transform1->scale.z, transform2->scale.z);
|
||||
case GTK_CSS_TRANSFORM_SKEW:
|
||||
return _gtk_css_value_equal (transform1->skew.x, transform2->skew.x)
|
||||
&& _gtk_css_value_equal (transform1->skew.y, transform2->skew.y);
|
||||
return gtk_css_value_equal (transform1->skew.x, transform2->skew.x)
|
||||
&& gtk_css_value_equal (transform1->skew.y, transform2->skew.y);
|
||||
case GTK_CSS_TRANSFORM_SKEW_X:
|
||||
return _gtk_css_value_equal (transform1->skew_x.skew, transform2->skew_x.skew);
|
||||
return gtk_css_value_equal (transform1->skew_x.skew, transform2->skew_x.skew);
|
||||
case GTK_CSS_TRANSFORM_SKEW_Y:
|
||||
return _gtk_css_value_equal (transform1->skew_y.skew, transform2->skew_y.skew);
|
||||
return gtk_css_value_equal (transform1->skew_y.skew, transform2->skew_y.skew);
|
||||
case GTK_CSS_TRANSFORM_PERSPECTIVE:
|
||||
return _gtk_css_value_equal (transform1->perspective.depth, transform2->perspective.depth);
|
||||
return gtk_css_value_equal (transform1->perspective.depth, transform2->perspective.depth);
|
||||
case GTK_CSS_TRANSFORM_NONE:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
@@ -507,30 +498,30 @@ gtk_css_transform_transition (GtkCssTransform *result,
|
||||
&result->matrix.matrix);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_TRANSLATE:
|
||||
result->translate.x = _gtk_css_value_transition (start->translate.x, end->translate.x, property_id, progress);
|
||||
result->translate.y = _gtk_css_value_transition (start->translate.y, end->translate.y, property_id, progress);
|
||||
result->translate.z = _gtk_css_value_transition (start->translate.z, end->translate.z, property_id, progress);
|
||||
result->translate.x = gtk_css_value_transition (start->translate.x, end->translate.x, property_id, progress);
|
||||
result->translate.y = gtk_css_value_transition (start->translate.y, end->translate.y, property_id, progress);
|
||||
result->translate.z = gtk_css_value_transition (start->translate.z, end->translate.z, property_id, progress);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_ROTATE:
|
||||
result->rotate.x = _gtk_css_value_transition (start->rotate.x, end->rotate.x, property_id, progress);
|
||||
result->rotate.y = _gtk_css_value_transition (start->rotate.y, end->rotate.y, property_id, progress);
|
||||
result->rotate.z = _gtk_css_value_transition (start->rotate.z, end->rotate.z, property_id, progress);
|
||||
result->rotate.angle = _gtk_css_value_transition (start->rotate.angle, end->rotate.angle, property_id, progress);
|
||||
result->rotate.x = gtk_css_value_transition (start->rotate.x, end->rotate.x, property_id, progress);
|
||||
result->rotate.y = gtk_css_value_transition (start->rotate.y, end->rotate.y, property_id, progress);
|
||||
result->rotate.z = gtk_css_value_transition (start->rotate.z, end->rotate.z, property_id, progress);
|
||||
result->rotate.angle = gtk_css_value_transition (start->rotate.angle, end->rotate.angle, property_id, progress);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SCALE:
|
||||
result->scale.x = _gtk_css_value_transition (start->scale.x, end->scale.x, property_id, progress);
|
||||
result->scale.y = _gtk_css_value_transition (start->scale.y, end->scale.y, property_id, progress);
|
||||
result->scale.z = _gtk_css_value_transition (start->scale.z, end->scale.z, property_id, progress);
|
||||
result->scale.x = gtk_css_value_transition (start->scale.x, end->scale.x, property_id, progress);
|
||||
result->scale.y = gtk_css_value_transition (start->scale.y, end->scale.y, property_id, progress);
|
||||
result->scale.z = gtk_css_value_transition (start->scale.z, end->scale.z, property_id, progress);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SKEW:
|
||||
result->skew.x = _gtk_css_value_transition (start->skew.x, end->skew.x, property_id, progress);
|
||||
result->skew.y = _gtk_css_value_transition (start->skew.y, end->skew.y, property_id, progress);
|
||||
result->skew.x = gtk_css_value_transition (start->skew.x, end->skew.x, property_id, progress);
|
||||
result->skew.y = gtk_css_value_transition (start->skew.y, end->skew.y, property_id, progress);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SKEW_X:
|
||||
result->skew_x.skew = _gtk_css_value_transition (start->skew_x.skew, end->skew_x.skew, property_id, progress);
|
||||
result->skew_x.skew = gtk_css_value_transition (start->skew_x.skew, end->skew_x.skew, property_id, progress);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SKEW_Y:
|
||||
result->skew_y.skew = _gtk_css_value_transition (start->skew_y.skew, end->skew_y.skew, property_id, progress);
|
||||
result->skew_y.skew = gtk_css_value_transition (start->skew_y.skew, end->skew_y.skew, property_id, progress);
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_PERSPECTIVE:
|
||||
gtk_css_transform_transition_default (result, start, end, property_id, progress);
|
||||
@@ -554,7 +545,7 @@ gtk_css_value_transform_transition (GtkCssValue *start,
|
||||
if (gtk_css_transform_value_is_none (start))
|
||||
{
|
||||
if (gtk_css_transform_value_is_none (end))
|
||||
return _gtk_css_value_ref (start);
|
||||
return gtk_css_value_ref (start);
|
||||
|
||||
n = 0;
|
||||
}
|
||||
@@ -702,67 +693,67 @@ gtk_css_transform_print (const GtkCssTransform *transform,
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_TRANSLATE:
|
||||
g_string_append (string, "translate3d(");
|
||||
_gtk_css_value_print (transform->translate.x, string);
|
||||
gtk_css_value_print (transform->translate.x, string);
|
||||
g_string_append (string, ", ");
|
||||
_gtk_css_value_print (transform->translate.y, string);
|
||||
gtk_css_value_print (transform->translate.y, string);
|
||||
g_string_append (string, ", ");
|
||||
_gtk_css_value_print (transform->translate.z, string);
|
||||
gtk_css_value_print (transform->translate.z, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_ROTATE:
|
||||
g_string_append (string, "rotate3d(");
|
||||
_gtk_css_value_print (transform->rotate.x, string);
|
||||
gtk_css_value_print (transform->rotate.x, string);
|
||||
g_string_append (string, ", ");
|
||||
_gtk_css_value_print (transform->rotate.y, string);
|
||||
gtk_css_value_print (transform->rotate.y, string);
|
||||
g_string_append (string, ", ");
|
||||
_gtk_css_value_print (transform->rotate.z, string);
|
||||
gtk_css_value_print (transform->rotate.z, string);
|
||||
g_string_append (string, ", ");
|
||||
_gtk_css_value_print (transform->rotate.angle, string);
|
||||
gtk_css_value_print (transform->rotate.angle, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SCALE:
|
||||
if (_gtk_css_number_value_get (transform->scale.z, 100) == 1)
|
||||
if (gtk_css_number_value_get (transform->scale.z, 100) == 1)
|
||||
{
|
||||
g_string_append (string, "scale(");
|
||||
_gtk_css_value_print (transform->scale.x, string);
|
||||
if (!_gtk_css_value_equal (transform->scale.x, transform->scale.y))
|
||||
gtk_css_value_print (transform->scale.x, string);
|
||||
if (!gtk_css_value_equal (transform->scale.x, transform->scale.y))
|
||||
{
|
||||
g_string_append (string, ", ");
|
||||
_gtk_css_value_print (transform->scale.y, string);
|
||||
gtk_css_value_print (transform->scale.y, string);
|
||||
}
|
||||
g_string_append (string, ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_string_append (string, "scale3d(");
|
||||
_gtk_css_value_print (transform->scale.x, string);
|
||||
gtk_css_value_print (transform->scale.x, string);
|
||||
g_string_append (string, ", ");
|
||||
_gtk_css_value_print (transform->scale.y, string);
|
||||
gtk_css_value_print (transform->scale.y, string);
|
||||
g_string_append (string, ", ");
|
||||
_gtk_css_value_print (transform->scale.z, string);
|
||||
gtk_css_value_print (transform->scale.z, string);
|
||||
g_string_append (string, ")");
|
||||
}
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SKEW:
|
||||
g_string_append (string, "skew(");
|
||||
_gtk_css_value_print (transform->skew.x, string);
|
||||
gtk_css_value_print (transform->skew.x, string);
|
||||
g_string_append (string, ", ");
|
||||
_gtk_css_value_print (transform->skew.y, string);
|
||||
gtk_css_value_print (transform->skew.y, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SKEW_X:
|
||||
g_string_append (string, "skewX(");
|
||||
_gtk_css_value_print (transform->skew_x.skew, string);
|
||||
gtk_css_value_print (transform->skew_x.skew, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_SKEW_Y:
|
||||
g_string_append (string, "skewY(");
|
||||
_gtk_css_value_print (transform->skew_y.skew, string);
|
||||
gtk_css_value_print (transform->skew_y.skew, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_PERSPECTIVE:
|
||||
g_string_append (string, "perspective(");
|
||||
_gtk_css_value_print (transform->perspective.depth, string);
|
||||
gtk_css_value_print (transform->perspective.depth, string);
|
||||
g_string_append (string, ")");
|
||||
break;
|
||||
case GTK_CSS_TRANSFORM_NONE:
|
||||
@@ -813,7 +804,7 @@ gtk_css_transform_value_alloc (guint n_transforms)
|
||||
|
||||
g_return_val_if_fail (n_transforms > 0, NULL);
|
||||
|
||||
result = _gtk_css_value_alloc (>K_CSS_VALUE_TRANSFORM, sizeof (GtkCssValue) + sizeof (GtkCssTransform) * (n_transforms - 1));
|
||||
result = gtk_css_value_alloc (>K_CSS_VALUE_TRANSFORM, sizeof (GtkCssValue) + sizeof (GtkCssTransform) * (n_transforms - 1));
|
||||
result->n_transforms = n_transforms;
|
||||
|
||||
return result;
|
||||
@@ -822,7 +813,7 @@ gtk_css_transform_value_alloc (guint n_transforms)
|
||||
GtkCssValue *
|
||||
_gtk_css_transform_value_new_none (void)
|
||||
{
|
||||
return _gtk_css_value_ref (&transform_none_singleton);
|
||||
return gtk_css_value_ref (&transform_none_singleton);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -853,7 +844,7 @@ gtk_css_transform_parse_length (GtkCssParser *parser,
|
||||
{
|
||||
GtkCssValue **values = data;
|
||||
|
||||
values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH);
|
||||
values[n] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH);
|
||||
if (values[n] == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -867,7 +858,7 @@ gtk_css_transform_parse_angle (GtkCssParser *parser,
|
||||
{
|
||||
GtkCssValue **values = data;
|
||||
|
||||
values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
values[n] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
if (values[n] == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -881,7 +872,7 @@ gtk_css_transform_parse_number (GtkCssParser *parser,
|
||||
{
|
||||
GtkCssValue **values = data;
|
||||
|
||||
values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
values[n] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
if (values[n] == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -898,25 +889,25 @@ gtk_css_transform_parse_rotate3d (GtkCssParser *parser,
|
||||
switch (n)
|
||||
{
|
||||
case 0:
|
||||
transform->rotate.x = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
transform->rotate.x = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
if (transform->rotate.x == NULL)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
transform->rotate.y = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
transform->rotate.y = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
if (transform->rotate.y == NULL)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
transform->rotate.z = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
transform->rotate.z = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
|
||||
if (transform->rotate.z == NULL)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
transform->rotate.angle = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
transform->rotate.angle = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
|
||||
if (transform->rotate.angle == NULL)
|
||||
return 0;
|
||||
break;
|
||||
@@ -981,9 +972,9 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
|
||||
goto fail;
|
||||
|
||||
transform.type = GTK_CSS_TRANSFORM_ROTATE;
|
||||
transform.rotate.x = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform.rotate.y = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform.rotate.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.rotate.x = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform.rotate.y = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform.rotate.z = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
computed = computed && gtk_css_value_is_computed (transform.rotate.angle);
|
||||
}
|
||||
else if (gtk_css_parser_has_function (parser, "rotate3d"))
|
||||
@@ -1009,9 +1000,9 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
|
||||
goto fail;
|
||||
|
||||
transform.type = GTK_CSS_TRANSFORM_ROTATE;
|
||||
transform.rotate.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.rotate.y = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform.rotate.z = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform.rotate.x = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.rotate.y = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform.rotate.z = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
computed = computed && gtk_css_value_is_computed (transform.rotate.angle);
|
||||
}
|
||||
else if (gtk_css_parser_has_function (parser, "rotateY"))
|
||||
@@ -1020,9 +1011,9 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
|
||||
goto fail;
|
||||
|
||||
transform.type = GTK_CSS_TRANSFORM_ROTATE;
|
||||
transform.rotate.x = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform.rotate.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.rotate.z = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform.rotate.x = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
transform.rotate.y = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.rotate.z = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
|
||||
computed = computed && gtk_css_value_is_computed (transform.rotate.angle);
|
||||
}
|
||||
else if (gtk_css_parser_has_function (parser, "scale"))
|
||||
@@ -1042,7 +1033,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
|
||||
transform.scale.y = values[1];
|
||||
else
|
||||
transform.scale.y = gtk_css_value_ref (values[0]);
|
||||
transform.scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.scale.z = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
computed = computed && gtk_css_value_is_computed (transform.scale.x) &&
|
||||
gtk_css_value_is_computed (transform.scale.y);
|
||||
}
|
||||
@@ -1072,8 +1063,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
|
||||
goto fail;
|
||||
|
||||
transform.type = GTK_CSS_TRANSFORM_SCALE;
|
||||
transform.scale.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.scale.y = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.scale.z = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
computed = computed && gtk_css_value_is_computed (transform.scale.x);
|
||||
}
|
||||
else if (gtk_css_parser_has_function (parser, "scaleY"))
|
||||
@@ -1082,8 +1073,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
|
||||
goto fail;
|
||||
|
||||
transform.type = GTK_CSS_TRANSFORM_SCALE;
|
||||
transform.scale.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.scale.x = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.scale.z = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
computed = computed && gtk_css_value_is_computed (transform.scale.y);
|
||||
}
|
||||
else if (gtk_css_parser_has_function (parser, "scaleZ"))
|
||||
@@ -1092,8 +1083,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
|
||||
goto fail;
|
||||
|
||||
transform.type = GTK_CSS_TRANSFORM_SCALE;
|
||||
transform.scale.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.scale.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.scale.x = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
transform.scale.y = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
|
||||
computed = computed && gtk_css_value_is_computed (transform.scale.z);
|
||||
}
|
||||
else if (gtk_css_parser_has_function (parser, "skew"))
|
||||
@@ -1145,8 +1136,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
|
||||
if (values[1])
|
||||
transform.translate.y = values[1];
|
||||
else
|
||||
transform.translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform.translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform.translate.y = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform.translate.z = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
computed = computed && gtk_css_value_is_computed (transform.translate.x) &&
|
||||
gtk_css_value_is_computed (transform.translate.y);
|
||||
}
|
||||
@@ -1176,8 +1167,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
|
||||
goto fail;
|
||||
|
||||
transform.type = GTK_CSS_TRANSFORM_TRANSLATE;
|
||||
transform.translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform.translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform.translate.y = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform.translate.z = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
computed = computed && gtk_css_value_is_computed (transform.translate.x);
|
||||
}
|
||||
else if (gtk_css_parser_has_function (parser, "translateY"))
|
||||
@@ -1186,8 +1177,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
|
||||
goto fail;
|
||||
|
||||
transform.type = GTK_CSS_TRANSFORM_TRANSLATE;
|
||||
transform.translate.x = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform.translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform.translate.x = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform.translate.z = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
computed = computed && gtk_css_value_is_computed (transform.translate.y);
|
||||
}
|
||||
else if (gtk_css_parser_has_function (parser, "translateZ"))
|
||||
@@ -1196,8 +1187,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
|
||||
goto fail;
|
||||
|
||||
transform.type = GTK_CSS_TRANSFORM_TRANSLATE;
|
||||
transform.translate.x = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform.translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform.translate.x = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
transform.translate.y = gtk_css_number_value_new (0, GTK_CSS_PX);
|
||||
computed = computed && gtk_css_value_is_computed (transform.translate.z);
|
||||
}
|
||||
else
|
||||
|
||||
+10
-10
@@ -57,22 +57,22 @@ gtk_css_transition_apply_values (GtkStyleAnimation *style_animation,
|
||||
state = gtk_progress_tracker_get_state (&transition->tracker);
|
||||
|
||||
if (state == GTK_PROGRESS_STATE_BEFORE)
|
||||
value = _gtk_css_value_ref (transition->start);
|
||||
value = gtk_css_value_ref (transition->start);
|
||||
else if (state == GTK_PROGRESS_STATE_DURING)
|
||||
{
|
||||
progress = gtk_progress_tracker_get_progress (&transition->tracker, FALSE);
|
||||
progress = _gtk_css_ease_value_transform (transition->ease, progress);
|
||||
|
||||
value = _gtk_css_value_transition (transition->start,
|
||||
end,
|
||||
transition->property,
|
||||
progress);
|
||||
value = gtk_css_value_transition (transition->start,
|
||||
end,
|
||||
transition->property,
|
||||
progress);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if (value == NULL)
|
||||
value = _gtk_css_value_ref (end);
|
||||
value = gtk_css_value_ref (end);
|
||||
|
||||
gtk_css_animated_style_set_animated_value (style, transition->property, value);
|
||||
}
|
||||
@@ -124,8 +124,8 @@ gtk_css_transition_advance (GtkStyleAnimation *style_animation,
|
||||
transition->parent.ref_count = 1;
|
||||
|
||||
transition->property = source->property;
|
||||
transition->start = _gtk_css_value_ref (source->start);
|
||||
transition->ease = _gtk_css_value_ref (source->ease);
|
||||
transition->start = gtk_css_value_ref (source->start);
|
||||
transition->ease = gtk_css_value_ref (source->ease);
|
||||
|
||||
gtk_progress_tracker_init_copy (&source->tracker, &transition->tracker);
|
||||
gtk_progress_tracker_advance_frame (&transition->tracker, timestamp);
|
||||
@@ -151,8 +151,8 @@ _gtk_css_transition_new (guint property,
|
||||
transition->parent.ref_count = 1;
|
||||
|
||||
transition->property = property;
|
||||
transition->start = _gtk_css_value_ref (start);
|
||||
transition->ease = _gtk_css_value_ref (ease);
|
||||
transition->start = gtk_css_value_ref (start);
|
||||
transition->ease = gtk_css_value_ref (ease);
|
||||
gtk_progress_tracker_start (&transition->tracker, duration_us, delay_us, 1.0);
|
||||
gtk_progress_tracker_advance_frame (&transition->tracker, timestamp);
|
||||
transition->finished = gtk_progress_tracker_get_state (&transition->tracker) == GTK_PROGRESS_STATE_AFTER;
|
||||
|
||||
@@ -281,6 +281,31 @@ enum { /*< skip >*/
|
||||
GTK_CSS_PROPERTY_CUSTOM,
|
||||
};
|
||||
|
||||
enum {
|
||||
GTK_CSS_SHORTHAND_PROPERTY_FONT,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_MARGIN,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_PADDING,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_WIDTH,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_RADIUS,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_COLOR,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_STYLE,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_IMAGE,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_TOP,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_RIGHT,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_BOTTOM,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER_LEFT,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BORDER,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_OUTLINE,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_BACKGROUND,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_TRANSITION,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_ANIMATION,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_TEXT_DECORATION,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_FONT_VARIANT,
|
||||
GTK_CSS_SHORTHAND_PROPERTY_ALL,
|
||||
/* add more */
|
||||
GTK_CSS_SHORTHAND_PROPERTY_N_PROPERTIES,
|
||||
};
|
||||
|
||||
typedef enum /*< skip >*/ {
|
||||
GTK_CSS_AREA_BORDER_BOX,
|
||||
GTK_CSS_AREA_PADDING_BOX,
|
||||
|
||||
+5
-13
@@ -35,12 +35,9 @@ gtk_css_value_unset_free (GtkCssValue *value)
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_unset_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_unset_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
GtkCssStyleProperty *property;
|
||||
GtkCssValue *unset_value;
|
||||
@@ -52,12 +49,7 @@ gtk_css_value_unset_compute (GtkCssValue *value,
|
||||
else
|
||||
unset_value = _gtk_css_initial_value_get ();
|
||||
|
||||
return _gtk_css_value_compute (unset_value,
|
||||
property_id,
|
||||
provider,
|
||||
style,
|
||||
parent_style,
|
||||
variables);
|
||||
return gtk_css_value_compute (unset_value, property_id, context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -99,5 +91,5 @@ static GtkCssValue unset = { >K_CSS_VALUE_UNSET, 1 };
|
||||
GtkCssValue *
|
||||
_gtk_css_unset_value_new (void)
|
||||
{
|
||||
return _gtk_css_value_ref (&unset);
|
||||
return gtk_css_value_ref (&unset);
|
||||
}
|
||||
|
||||
+29
-43
@@ -27,7 +27,7 @@ struct _GtkCssValue {
|
||||
GTK_CSS_VALUE_BASE
|
||||
};
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GtkCssValue, _gtk_css_value, _gtk_css_value_ref, _gtk_css_value_unref)
|
||||
G_DEFINE_BOXED_TYPE (GtkCssValue, gtk_css_value, gtk_css_value_ref, gtk_css_value_unref)
|
||||
|
||||
#undef CSS_VALUE_ACCOUNTING
|
||||
|
||||
@@ -137,8 +137,8 @@ get_accounting_data (const char *class)
|
||||
#endif
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_value_alloc (const GtkCssValueClass *klass,
|
||||
gsize size)
|
||||
gtk_css_value_alloc (const GtkCssValueClass *klass,
|
||||
gsize size)
|
||||
{
|
||||
GtkCssValue *value;
|
||||
|
||||
@@ -161,7 +161,7 @@ _gtk_css_value_alloc (const GtkCssValueClass *klass,
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
gtk_css_value_ref (GtkCssValue *value)
|
||||
(gtk_css_value_ref) (GtkCssValue *value)
|
||||
{
|
||||
gtk_internal_return_val_if_fail (value != NULL, NULL);
|
||||
|
||||
@@ -171,7 +171,7 @@ gtk_css_value_ref (GtkCssValue *value)
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_value_unref (GtkCssValue *value)
|
||||
(gtk_css_value_unref) (GtkCssValue *value)
|
||||
{
|
||||
if (value == NULL)
|
||||
return;
|
||||
@@ -193,13 +193,14 @@ gtk_css_value_unref (GtkCssValue *value)
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_css_value_compute:
|
||||
* gtk_css_value_compute:
|
||||
* @value: the value to compute from
|
||||
* @property_id: the ID of the property to compute
|
||||
* @provider: Style provider for looking up extra information
|
||||
* @style: Style to compute for
|
||||
* @parent_style: parent style to use for inherited values
|
||||
* @variables: an additional set of variables to use along with @style
|
||||
* @shorthands: (nullable): Already computed values for shorthands
|
||||
*
|
||||
* Converts the specified @value into the computed value for the CSS
|
||||
* property given by @property_id using the information in @context.
|
||||
@@ -209,26 +210,23 @@ gtk_css_value_unref (GtkCssValue *value)
|
||||
* Returns: the computed value
|
||||
**/
|
||||
GtkCssValue *
|
||||
_gtk_css_value_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables)
|
||||
gtk_css_value_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkCssComputeContext *context)
|
||||
{
|
||||
if (gtk_css_value_is_computed (value))
|
||||
return _gtk_css_value_ref (value);
|
||||
return gtk_css_value_ref (value);
|
||||
|
||||
#ifdef CSS_VALUE_ACCOUNTING
|
||||
get_accounting_data (value->class->type_name)->computed++;
|
||||
#endif
|
||||
|
||||
return value->class->compute (value, property_id, provider, style, parent_style, variables);
|
||||
return value->class->compute (value, property_id, context);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_css_value_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
gtk_css_value_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
{
|
||||
gtk_internal_return_val_if_fail (value1 != NULL, FALSE);
|
||||
gtk_internal_return_val_if_fail (value2 != NULL, FALSE);
|
||||
@@ -243,8 +241,8 @@ _gtk_css_value_equal (const GtkCssValue *value1,
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_css_value_equal0 (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
gtk_css_value_equal0 (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
{
|
||||
/* Includes both values being NULL */
|
||||
if (value1 == value2)
|
||||
@@ -253,14 +251,14 @@ _gtk_css_value_equal0 (const GtkCssValue *value1,
|
||||
if (value1 == NULL || value2 == NULL)
|
||||
return FALSE;
|
||||
|
||||
return _gtk_css_value_equal (value1, value2);
|
||||
return gtk_css_value_equal (value1, value2);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_value_transition (GtkCssValue *start,
|
||||
GtkCssValue *end,
|
||||
guint property_id,
|
||||
double progress)
|
||||
gtk_css_value_transition (GtkCssValue *start,
|
||||
GtkCssValue *end,
|
||||
guint property_id,
|
||||
double progress)
|
||||
{
|
||||
gtk_internal_return_val_if_fail (start != NULL, NULL);
|
||||
gtk_internal_return_val_if_fail (end != NULL, NULL);
|
||||
@@ -269,13 +267,13 @@ _gtk_css_value_transition (GtkCssValue *start,
|
||||
return NULL;
|
||||
|
||||
if (progress == 0)
|
||||
return _gtk_css_value_ref (start);
|
||||
return gtk_css_value_ref (start);
|
||||
|
||||
if (progress == 1)
|
||||
return _gtk_css_value_ref (end);
|
||||
return gtk_css_value_ref (end);
|
||||
|
||||
if (start == end)
|
||||
return _gtk_css_value_ref (start);
|
||||
return gtk_css_value_ref (start);
|
||||
|
||||
#ifdef CSS_VALUE_ACCOUNTING
|
||||
get_accounting_data (start->class->type_name)->transitioned++;
|
||||
@@ -285,19 +283,19 @@ _gtk_css_value_transition (GtkCssValue *start,
|
||||
}
|
||||
|
||||
char *
|
||||
_gtk_css_value_to_string (const GtkCssValue *value)
|
||||
gtk_css_value_to_string (const GtkCssValue *value)
|
||||
{
|
||||
GString *string;
|
||||
|
||||
gtk_internal_return_val_if_fail (value != NULL, NULL);
|
||||
|
||||
string = g_string_new (NULL);
|
||||
_gtk_css_value_print (value, string);
|
||||
gtk_css_value_print (value, string);
|
||||
return g_string_free (string, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_css_value_print:
|
||||
* gtk_css_value_print:
|
||||
* @value: the value to print
|
||||
* @string: the string to print to
|
||||
*
|
||||
@@ -306,8 +304,8 @@ _gtk_css_value_to_string (const GtkCssValue *value)
|
||||
* via _gtk_style_property_assign().
|
||||
**/
|
||||
void
|
||||
_gtk_css_value_print (const GtkCssValue *value,
|
||||
GString *string)
|
||||
gtk_css_value_print (const GtkCssValue *value,
|
||||
GString *string)
|
||||
{
|
||||
gtk_internal_return_if_fail (value != NULL);
|
||||
gtk_internal_return_if_fail (string != NULL);
|
||||
@@ -363,15 +361,3 @@ gtk_css_value_get_dynamic_value (GtkCssValue *value,
|
||||
|
||||
return value->class->get_dynamic_value (value, monotonic_time);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_css_value_is_computed (const GtkCssValue *value)
|
||||
{
|
||||
return value->is_computed;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_css_value_contains_variables (const GtkCssValue *value)
|
||||
{
|
||||
return value->contains_variables;
|
||||
}
|
||||
|
||||
+69
-26
@@ -27,7 +27,7 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_CSS_VALUE (_gtk_css_value_get_type ())
|
||||
#define GTK_TYPE_CSS_VALUE (gtk_css_value_get_type ())
|
||||
|
||||
/* A GtkCssValue is a refcounted immutable value type */
|
||||
|
||||
@@ -41,16 +41,21 @@ typedef struct _GtkCssValueClass GtkCssValueClass;
|
||||
guint is_computed: 1; \
|
||||
guint contains_variables: 1;
|
||||
|
||||
typedef struct {
|
||||
GtkStyleProvider *provider;
|
||||
GtkCssStyle *style;
|
||||
GtkCssStyle *parent_style;
|
||||
GtkCssVariableSet *variables;
|
||||
GtkCssValue **shorthands;
|
||||
} GtkCssComputeContext;
|
||||
|
||||
struct _GtkCssValueClass {
|
||||
const char *type_name;
|
||||
void (* free) (GtkCssValue *value);
|
||||
|
||||
GtkCssValue * (* compute) (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables);
|
||||
GtkCssComputeContext *context);
|
||||
gboolean (* equal) (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2);
|
||||
GtkCssValue * (* transition) (GtkCssValue *start,
|
||||
@@ -64,40 +69,78 @@ struct _GtkCssValueClass {
|
||||
GString *string);
|
||||
};
|
||||
|
||||
GType _gtk_css_value_get_type (void) G_GNUC_CONST;
|
||||
GType gtk_css_value_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkCssValue *_gtk_css_value_alloc (const GtkCssValueClass *klass,
|
||||
GtkCssValue * gtk_css_value_alloc (const GtkCssValueClass *klass,
|
||||
gsize size);
|
||||
#define _gtk_css_value_new(_name, _klass) ((_name *) _gtk_css_value_alloc ((_klass), sizeof (_name)))
|
||||
#define gtk_css_value_new(name, klass) ((name *) gtk_css_value_alloc ((klass), sizeof (name)))
|
||||
|
||||
#define _gtk_css_value_ref gtk_css_value_ref
|
||||
GtkCssValue * gtk_css_value_ref (GtkCssValue *value);
|
||||
#define _gtk_css_value_unref gtk_css_value_unref
|
||||
void gtk_css_value_unref (GtkCssValue *value);
|
||||
GtkCssValue * (gtk_css_value_ref) (GtkCssValue *value);
|
||||
void (gtk_css_value_unref) (GtkCssValue *value);
|
||||
|
||||
GtkCssValue *_gtk_css_value_compute (GtkCssValue *value,
|
||||
GtkCssValue * gtk_css_value_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProvider *provider,
|
||||
GtkCssStyle *style,
|
||||
GtkCssStyle *parent_style,
|
||||
GtkCssVariableSet *variables) G_GNUC_PURE;
|
||||
gboolean _gtk_css_value_equal (const GtkCssValue *value1,
|
||||
GtkCssComputeContext *context) G_GNUC_PURE;
|
||||
gboolean gtk_css_value_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2) G_GNUC_PURE;
|
||||
gboolean _gtk_css_value_equal0 (const GtkCssValue *value1,
|
||||
gboolean gtk_css_value_equal0 (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2) G_GNUC_PURE;
|
||||
GtkCssValue *_gtk_css_value_transition (GtkCssValue *start,
|
||||
GtkCssValue * gtk_css_value_transition (GtkCssValue *start,
|
||||
GtkCssValue *end,
|
||||
guint property_id,
|
||||
double progress);
|
||||
gboolean gtk_css_value_is_dynamic (const GtkCssValue *value) G_GNUC_PURE;
|
||||
GtkCssValue * gtk_css_value_get_dynamic_value (GtkCssValue *value,
|
||||
gboolean gtk_css_value_is_dynamic (const GtkCssValue *value) G_GNUC_PURE;
|
||||
GtkCssValue * gtk_css_value_get_dynamic_value (GtkCssValue *value,
|
||||
gint64 monotonic_time);
|
||||
|
||||
char * _gtk_css_value_to_string (const GtkCssValue *value);
|
||||
void _gtk_css_value_print (const GtkCssValue *value,
|
||||
char * gtk_css_value_to_string (const GtkCssValue *value);
|
||||
void gtk_css_value_print (const GtkCssValue *value,
|
||||
GString *string);
|
||||
gboolean gtk_css_value_is_computed (const GtkCssValue *value) G_GNUC_PURE;
|
||||
gboolean gtk_css_value_contains_variables (const GtkCssValue *value) G_GNUC_PURE;
|
||||
|
||||
typedef struct { GTK_CSS_VALUE_BASE } GtkCssValueBase;
|
||||
|
||||
static inline GtkCssValue *
|
||||
gtk_css_value_ref_inline (GtkCssValue *value)
|
||||
{
|
||||
GtkCssValueBase *value_base = (GtkCssValueBase *) value;
|
||||
|
||||
value_base->ref_count += 1;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gtk_css_value_unref_inline (GtkCssValue *value)
|
||||
{
|
||||
GtkCssValueBase *value_base = (GtkCssValueBase *) value;
|
||||
|
||||
if (value_base && value_base->ref_count > 1)
|
||||
{
|
||||
value_base->ref_count -= 1;
|
||||
return;
|
||||
}
|
||||
|
||||
(gtk_css_value_unref) (value);
|
||||
}
|
||||
|
||||
#define gtk_css_value_ref(value) gtk_css_value_ref_inline (value)
|
||||
#define gtk_css_value_unref(value) gtk_css_value_unref_inline (value)
|
||||
|
||||
static inline gboolean
|
||||
gtk_css_value_is_computed (const GtkCssValue *value)
|
||||
{
|
||||
GtkCssValueBase *value_base = (GtkCssValueBase *) value;
|
||||
|
||||
return value_base->is_computed;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
gtk_css_value_contains_variables (const GtkCssValue *value)
|
||||
{
|
||||
GtkCssValueBase *value_base = (GtkCssValueBase *) value;
|
||||
|
||||
return value_base->contains_variables;
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ typedef enum {
|
||||
GTK_DEBUG_A11Y = 1 << 17,
|
||||
GTK_DEBUG_ICONFALLBACK = 1 << 18,
|
||||
GTK_DEBUG_INVERT_TEXT_DIR = 1 << 19,
|
||||
GTK_DEBUG_CSS = 1 << 20,
|
||||
} GtkDebugFlags;
|
||||
|
||||
#define GTK_DEBUG_CHECK(type) G_UNLIKELY (gtk_get_debug_flags () & GTK_DEBUG_##type)
|
||||
|
||||
@@ -1033,6 +1033,8 @@ selection_check (GtkFileChooserWidget *impl,
|
||||
g_clear_object (&info);
|
||||
}
|
||||
|
||||
g_clear_pointer (&bitset, gtk_bitset_unref);
|
||||
|
||||
g_assert (n_selected == 0 || !(all_files && all_folders));
|
||||
|
||||
if (out_num_selected)
|
||||
@@ -1137,6 +1139,8 @@ add_to_shortcuts_cb (GSimpleAction *action,
|
||||
|
||||
g_clear_object (&info);
|
||||
}
|
||||
|
||||
g_clear_pointer (&bitset, gtk_bitset_unref);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@@ -1217,6 +1221,8 @@ delete_file_cb (GSimpleAction *action,
|
||||
|
||||
g_clear_object (&info);
|
||||
}
|
||||
|
||||
g_clear_pointer (&bitset, gtk_bitset_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1247,6 +1253,8 @@ trash_file_cb (GSimpleAction *action,
|
||||
|
||||
g_clear_object (&info);
|
||||
}
|
||||
|
||||
g_clear_pointer (&bitset, gtk_bitset_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2589,6 +2597,8 @@ location_bar_update (GtkFileChooserWidget *impl)
|
||||
|
||||
if (gtk_bitset_iter_init_first (&iter, bitset, &position))
|
||||
put_recent_folder_in_pathbar (impl, position);
|
||||
|
||||
g_clear_pointer (&bitset, gtk_bitset_unref);
|
||||
}
|
||||
visible = FALSE;
|
||||
break;
|
||||
@@ -3983,6 +3993,8 @@ update_chooser_entry (GtkFileChooserWidget *impl)
|
||||
n_selected++;
|
||||
}
|
||||
|
||||
g_clear_pointer (&bitset, gtk_bitset_unref);
|
||||
|
||||
if (n_selected == 0)
|
||||
{
|
||||
if (impl->operation_mode == OPERATION_MODE_RECENT)
|
||||
@@ -4469,6 +4481,8 @@ gtk_file_chooser_widget_unselect_file (GtkFileChooser *chooser,
|
||||
|
||||
if (gtk_bitset_iter_is_valid (&iter))
|
||||
gtk_selection_model_unselect_item (impl->selection_model, i);
|
||||
|
||||
g_clear_pointer (&bitset, gtk_bitset_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4685,6 +4699,8 @@ gtk_file_chooser_widget_get_files (GtkFileChooser *chooser)
|
||||
g_list_store_append (result, file);
|
||||
}
|
||||
|
||||
g_clear_pointer (&bitset, gtk_bitset_unref);
|
||||
|
||||
/* If there is no selection in the file list, we probably have this situation:
|
||||
*
|
||||
* 1. The user typed a filename in the SAVE filename entry ("foo.txt").
|
||||
@@ -4895,12 +4911,15 @@ switch_to_selected_folder (GtkFileChooserWidget *impl)
|
||||
|
||||
file = _gtk_file_info_get_file (info);
|
||||
change_folder_and_display_error (impl, file, FALSE);
|
||||
g_clear_pointer (&bitset, gtk_bitset_unref);
|
||||
g_object_unref (info);
|
||||
return;
|
||||
}
|
||||
|
||||
g_clear_object (&info);
|
||||
}
|
||||
|
||||
g_clear_pointer (&bitset, gtk_bitset_unref);
|
||||
}
|
||||
|
||||
/* Gets the display name of the selected file in the file list; assumes single
|
||||
@@ -5630,6 +5649,8 @@ gtk_file_chooser_widget_get_selected_files (GtkFileChooserWidget *impl)
|
||||
g_clear_object (&info);
|
||||
}
|
||||
|
||||
g_clear_pointer (&bitset, gtk_bitset_unref);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+2
-15
@@ -37,10 +37,7 @@
|
||||
* should be modal.
|
||||
*
|
||||
* The dialog is shown with [method@Gtk.FileDialog.open],
|
||||
* [method@Gtk.FileDialog.save], etc. These APIs follow the
|
||||
* GIO async pattern, and the result can be obtained by calling
|
||||
* the corresponding finish function, for example
|
||||
* [method@Gtk.FileDialog.open_finish].
|
||||
* [method@Gtk.FileDialog.save], etc.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
@@ -693,7 +690,7 @@ gtk_file_dialog_set_initial_file (GtkFileDialog *self,
|
||||
{
|
||||
GFile *folder;
|
||||
GFileInfo *info;
|
||||
|
||||
|
||||
if (self->initial_file && g_file_equal (self->initial_file, file))
|
||||
return;
|
||||
|
||||
@@ -927,8 +924,6 @@ finish_multiple_files_op (GtkFileDialog *self,
|
||||
* presenting a file chooser dialog to the user.
|
||||
*
|
||||
* The @callback will be called when the dialog is dismissed.
|
||||
* It should call [method@Gtk.FileDialog.open_finish]
|
||||
* to obtain the result.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
@@ -1001,8 +996,6 @@ gtk_file_dialog_open_finish (GtkFileDialog *self,
|
||||
* will be in the directory [property@Gtk.FileDialog:initial-folder].
|
||||
*
|
||||
* The @callback will be called when the dialog is dismissed.
|
||||
* It should call [method@Gtk.FileDialog.select_folder_finish]
|
||||
* to obtain the result.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
@@ -1071,8 +1064,6 @@ gtk_file_dialog_select_folder_finish (GtkFileDialog *self,
|
||||
* presenting a file chooser dialog to the user.
|
||||
*
|
||||
* The @callback will be called when the dialog is dismissed.
|
||||
* It should call [method@Gtk.FileDialog.save_finish]
|
||||
* to obtain the result.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
@@ -1144,8 +1135,6 @@ gtk_file_dialog_save_finish (GtkFileDialog *self,
|
||||
* [property@Gtk.FileDialog:initial-folder].
|
||||
*
|
||||
* The @callback will be called when the dialog is dismissed.
|
||||
* It should call [method@Gtk.FileDialog.open_multiple_finish]
|
||||
* to obtain the result.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
@@ -1218,8 +1207,6 @@ gtk_file_dialog_open_multiple_finish (GtkFileDialog *self,
|
||||
* [property@Gtk.FileDialog:initial-folder].
|
||||
*
|
||||
* The @callback will be called when the dialog is dismissed.
|
||||
* It should call [method@Gtk.FileDialog.select_multiple_folders_finish]
|
||||
* to obtain the result.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
* right away.
|
||||
*
|
||||
* The operation is started with the [method@Gtk.FileLauncher.launch] function.
|
||||
* This API follows the GIO async pattern, and the result can be obtained by
|
||||
* calling [method@Gtk.FileLauncher.launch_finish].
|
||||
*
|
||||
* To launch uris that don't represent files, use [class@Gtk.UriLauncher].
|
||||
*
|
||||
@@ -464,10 +462,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
*
|
||||
* This may present an app chooser dialog to the user.
|
||||
*
|
||||
* The @callback will be called when the operation is completed.
|
||||
* It should call [method@Gtk.FileLauncher.launch_finish] to obtain
|
||||
* the result.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
void
|
||||
@@ -558,10 +552,6 @@ gtk_file_launcher_launch_finish (GtkFileLauncher *self,
|
||||
* This is only supported native files. It will fail if @file
|
||||
* is e.g. a http:// uri.
|
||||
*
|
||||
* The @callback will be called when the operation is completed.
|
||||
* It should call [method@Gtk.FileLauncher.open_containing_folder_finish]
|
||||
* to obtain the result.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
void
|
||||
|
||||
+1
-1
@@ -2610,7 +2610,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
cairo_path_destroy (path);
|
||||
|
||||
border_color = gtk_css_color_value_get_rgba (style->border->border_top_color ? style->border->border_top_color : style->core->color);
|
||||
border_width = round (_gtk_css_number_value_get (style->border->border_left_width, 100));
|
||||
border_width = round (gtk_css_number_value_get (style->border->border_left_width, 100));
|
||||
|
||||
cairo_set_line_width (cr, border_width);
|
||||
gdk_cairo_set_source_rgba (cr, border_color);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user