gtk: Update all users to use used values

Update all widgets and rendering code to use the used values of
relevant css properties.
This commit is contained in:
Matthias Clasen 2024-05-19 18:38:36 -04:00
parent 1af746e136
commit 5807b68d5b
16 changed files with 133 additions and 124 deletions

View File

@ -939,10 +939,10 @@ _gtk_style_context_get_cursor_color (GtkStyleContext *context,
style = gtk_style_context_lookup_style (context);
if (primary_color)
*primary_color = *gtk_css_color_value_get_rgba (style->font->caret_color ? style->font->caret_color : style->core->color);
*primary_color = *gtk_css_color_value_get_rgba (style->used->caret_color);
if (secondary_color)
*secondary_color = *gtk_css_color_value_get_rgba (style->font->secondary_caret_color ? style->font->secondary_caret_color : style->core->color);
*secondary_color = *gtk_css_color_value_get_rgba (style->used->secondary_caret_color);
}
/**

View File

@ -356,7 +356,7 @@ gsk_pango_renderer_prepare_run (PangoRenderer *renderer,
node = gtk_text_view_get_selection_node ((GtkTextView *)crenderer->widget);
style = gtk_css_node_get_style (node);
fg_rgba = gtk_css_color_value_get_rgba (style->core->color);
fg_rgba = gtk_css_color_value_get_rgba (style->used->color);
}
else if (crenderer->state == GSK_PANGO_RENDERER_CURSOR && gtk_widget_has_focus (crenderer->widget))
{
@ -365,7 +365,7 @@ gsk_pango_renderer_prepare_run (PangoRenderer *renderer,
node = gtk_widget_get_css_node (crenderer->widget);
style = gtk_css_node_get_style (node);
fg_rgba = gtk_css_color_value_get_rgba (style->background->background_color);
fg_rgba = gtk_css_color_value_get_rgba (style->used->background_color);
}
else
fg_rgba = appearance->fg_rgba;

View File

@ -1754,12 +1754,12 @@ follow_if_link (GtkAboutDialog *about,
if (uri && !g_ptr_array_find_with_equal_func (about->visited_links, uri, (GCompareFunc)strcmp, NULL))
{
GdkRGBA visited_link_color;
const GdkRGBA *visited_link_color;
GtkCssStyle *style;
style = gtk_css_node_get_style (about->visited_link_node);
visited_link_color = *gtk_css_color_value_get_rgba (style->core->color);
g_object_set (G_OBJECT (tag), "foreground-rgba", &visited_link_color, NULL);
visited_link_color = gtk_css_color_value_get_rgba (style->used->color);
g_object_set (G_OBJECT (tag), "foreground-rgba", visited_link_color, NULL);
g_ptr_array_add (about->visited_links, g_strdup (uri));
}
@ -1894,17 +1894,18 @@ text_buffer_new (GtkAboutDialog *about,
char **p;
char *q0, *q1, *q2, *r1, *r2;
GtkTextBuffer *buffer;
GdkRGBA color;
GdkRGBA link_color;
GdkRGBA visited_link_color;
const GdkRGBA *color;
const GdkRGBA *link_color;
const GdkRGBA *visited_link_color;
GtkTextIter start_iter, end_iter;
GtkTextTag *tag;
GtkCssStyle *style;
style = gtk_css_node_get_style (about->link_node);
link_color = *gtk_css_color_value_get_rgba (style->core->color);
link_color = gtk_css_color_value_get_rgba (style->used->color);
style = gtk_css_node_get_style (about->visited_link_node);
visited_link_color = *gtk_css_color_value_get_rgba (style->core->color);
visited_link_color = gtk_css_color_value_get_rgba (style->used->color);
buffer = gtk_text_buffer_new (NULL);
@ -1965,7 +1966,7 @@ text_buffer_new (GtkAboutDialog *about,
color = link_color;
tag = gtk_text_buffer_create_tag (buffer, NULL,
"foreground-rgba", &color,
"foreground-rgba", color,
"underline", PANGO_UNDERLINE_SINGLE,
NULL);

View File

@ -2609,7 +2609,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
cairo_append_path (cr, path);
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_color = gtk_css_color_value_get_rgba (style->used->border_top_color);
border_width = round (gtk_css_number_value_get (style->border->border_left_width, 100));
cairo_set_line_width (cr, border_width);

View File

@ -341,13 +341,9 @@ subtract_decoration_corners_from_region (cairo_region_t *region,
}
static int
get_translucent_border_edge (const GtkCssValue *color,
const GtkCssValue *border_color,
const GtkCssValue *border_width)
get_translucent_border_edge (GtkCssValue *border_color,
GtkCssValue *border_width)
{
if (border_color == NULL)
border_color = color;
if (!gdk_rgba_is_opaque (gtk_css_color_value_get_rgba (border_color)))
return round (gtk_css_number_value_get (border_width, 100));
@ -361,29 +357,36 @@ get_translucent_border_width (GtkWidget *widget,
GtkCssNode *css_node = gtk_widget_get_css_node (widget);
GtkCssStyle *style = gtk_css_node_get_style (css_node);
border->top = get_translucent_border_edge (style->core->color,
style->border->border_top_color,
border->top = get_translucent_border_edge (style->used->border_top_color,
style->border->border_top_width);
border->bottom = get_translucent_border_edge (style->core->color,
style->border->border_bottom_color,
border->bottom = get_translucent_border_edge (style->used->border_bottom_color,
style->border->border_bottom_width);
border->left = get_translucent_border_edge (style->core->color,
style->border->border_left_color,
border->left = get_translucent_border_edge (style->used->border_left_color,
style->border->border_left_width);
border->right = get_translucent_border_edge (style->core->color,
style->border->border_right_color,
border->right = get_translucent_border_edge (style->used->border_right_color,
style->border->border_right_width);
}
static gboolean
get_opaque_rect (GtkWidget *widget,
const GtkCssStyle *style,
cairo_rectangle_int_t *rect)
{
gboolean is_opaque = gdk_rgba_is_opaque (gtk_css_color_value_get_rgba (style->background->background_color));
gboolean is_opaque;
if (is_opaque && gtk_widget_get_opacity (widget) < 1.0)
if (gtk_widget_get_opacity (widget) < 1)
is_opaque = FALSE;
else
{
GtkCssNode *node;
GtkCssStyle *style;
const GdkRGBA *color;
node = gtk_widget_get_css_node (widget);
style = gtk_css_node_get_style (node);
color = gtk_css_color_value_get_rgba (style->used->background_color);
is_opaque = gdk_rgba_is_opaque (color);
}
if (is_opaque)
{
@ -429,8 +432,6 @@ gtk_native_update_opaque_region (GtkNative *native,
{
cairo_rectangle_int_t rect;
cairo_region_t *opaque_region = NULL;
const GtkCssStyle *style;
GtkCssNode *css_node;
GdkSurface *surface;
GtkBorder shadow;
@ -444,17 +445,14 @@ gtk_native_update_opaque_region (GtkNative *native,
!_gtk_widget_get_realized (contents))
return;
css_node = gtk_widget_get_css_node (contents);
if (subtract_shadow)
get_shadow_width (contents, &shadow, resize_handle_size);
else
shadow = (GtkBorder) {0, 0, 0, 0};
surface = gtk_native_get_surface (native);
style = gtk_css_node_get_style (css_node);
if (get_opaque_rect (contents, style, &rect))
if (get_opaque_rect (contents, &rect))
{
double native_x, native_y;
@ -476,7 +474,12 @@ gtk_native_update_opaque_region (GtkNative *native,
opaque_region = cairo_region_create_rectangle (&rect);
if (subtract_decoration_corners)
subtract_decoration_corners_from_region (opaque_region, &rect, style);
{
GtkCssStyle *style;
style = gtk_css_node_get_style (gtk_widget_get_css_node (contents));
subtract_decoration_corners_from_region (opaque_region, &rect, style);
}
}
gdk_surface_set_opaque_region (surface, opaque_region);

View File

@ -1640,7 +1640,7 @@ create_arrow_render_node (GtkPopover *popover)
{
const GdkRGBA *border_color;
border_color = gtk_css_color_value_get_rgba (style->border->border_left_color ? style->border->border_left_color : style->core->color);
border_color = gtk_css_color_value_get_rgba (style->used->border_left_color);
gtk_popover_apply_tail_path (popover, cr);
gdk_cairo_set_source_rgba (cr, border_color);

View File

@ -49,10 +49,11 @@ gtk_theming_background_snapshot_color (GtkCssBoxes *boxes,
const GdkRGBA *bg_color,
guint n_bg_values)
{
GtkCssStyle *style = boxes->style;
const GskRoundedRect *box;
GtkCssArea clip;
clip = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (boxes->style->background->background_clip, n_bg_values - 1));
clip = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (style->background->background_clip, n_bg_values - 1));
box = gtk_css_boxes_get_box (boxes, clip);
if (gsk_rounded_rect_is_rectilinear (box))
@ -76,7 +77,7 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
guint idx,
GtkSnapshot *snapshot)
{
GtkCssBackgroundValues *background = bg->style->background;
GtkCssStyle *style = bg->style;
GtkCssRepeatStyle hrepeat, vrepeat;
const GtkCssValue *pos, *repeat;
GtkCssImage *image;
@ -85,17 +86,17 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
double width, height;
double x, y;
image = _gtk_css_image_value_get_image (_gtk_css_array_value_get_nth (background->background_image, idx));
image = _gtk_css_image_value_get_image (_gtk_css_array_value_get_nth (style->used->background_image, idx));
if (image == NULL)
return;
pos = _gtk_css_array_value_get_nth (background->background_position, idx);
repeat = _gtk_css_array_value_get_nth (background->background_repeat, idx);
pos = _gtk_css_array_value_get_nth (style->background->background_position, idx);
repeat = _gtk_css_array_value_get_nth (style->background->background_repeat, idx);
origin = gtk_css_boxes_get_box (bg,
_gtk_css_area_value_get (
_gtk_css_array_value_get_nth (background->background_origin, idx)));
_gtk_css_array_value_get_nth (style->background->background_origin, idx)));
width = origin->bounds.size.width;
height = origin->bounds.size.height;
@ -105,9 +106,9 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
clip = gtk_css_boxes_get_box (bg,
_gtk_css_area_value_get (
_gtk_css_array_value_get_nth (background->background_clip, idx)));
_gtk_css_array_value_get_nth (style->background->background_clip, idx)));
_gtk_css_bg_size_value_compute_size (_gtk_css_array_value_get_nth (background->background_size, idx),
_gtk_css_bg_size_value_compute_size (_gtk_css_array_value_get_nth (style->background->background_size, idx),
image,
width,
height,
@ -245,7 +246,7 @@ void
gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
GtkSnapshot *snapshot)
{
const GtkCssBackgroundValues *background = boxes->style->background;
GtkCssStyle *style = boxes->style;
GtkCssValue *background_image;
const GdkRGBA *bg_color;
const GtkCssValue *box_shadow;
@ -255,12 +256,12 @@ gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
int idx;
guint number_of_layers;
if (background->base.type == GTK_CSS_BACKGROUND_INITIAL_VALUES)
if (style->background->base.type == GTK_CSS_BACKGROUND_INITIAL_VALUES)
return;
background_image = background->background_image;
bg_color = gtk_css_color_value_get_rgba (background->background_color);
box_shadow = background->box_shadow;
background_image = style->used->background_image;
bg_color = gtk_css_color_value_get_rgba (style->used->background_color);
box_shadow = style->used->box_shadow;
has_bg_color = !gdk_rgba_is_clear (bg_color);
has_bg_image = _gtk_css_image_value_get_image (_gtk_css_array_value_get_nth (background_image, 0)) != NULL;
@ -281,7 +282,7 @@ gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
if (has_bg_image)
{
GtkCssValue *blend_modes = background->background_blend_mode;
GtkCssValue *blend_modes = style->background->background_blend_mode;
GskBlendMode *blend_mode_values = g_alloca (sizeof (GskBlendMode) * number_of_layers);
for (idx = number_of_layers - 1; idx >= 0; idx--)

View File

@ -569,7 +569,7 @@ snapshot_border (GtkSnapshot *snapshot,
else
dont_draw |= (1 << j);
}
snapshot_frame_stroke (snapshot, border_box, border_width, colors, dont_draw, border_style[i]);
}
break;
@ -647,22 +647,22 @@ void
gtk_css_style_snapshot_border (GtkCssBoxes *boxes,
GtkSnapshot *snapshot)
{
const GtkCssBorderValues *border = boxes->style->border;
GtkCssStyle *style = boxes->style;
GtkBorderImage border_image;
float border_width[4];
if (border->base.type == GTK_CSS_BORDER_INITIAL_VALUES)
if (style->border->base.type == GTK_CSS_BORDER_INITIAL_VALUES)
return;
if (gtk_border_image_init (&border_image, boxes->style))
if (gtk_border_image_init (&border_image, style))
{
cairo_t *cr;
const graphene_rect_t *bounds;
border_width[0] = gtk_css_number_value_get (border->border_top_width, 100);
border_width[1] = gtk_css_number_value_get (border->border_right_width, 100);
border_width[2] = gtk_css_number_value_get (border->border_bottom_width, 100);
border_width[3] = gtk_css_number_value_get (border->border_left_width, 100);
border_width[0] = gtk_css_number_value_get (style->border->border_top_width, 100);
border_width[1] = gtk_css_number_value_get (style->border->border_right_width, 100);
border_width[2] = gtk_css_number_value_get (style->border->border_bottom_width, 100);
border_width[3] = gtk_css_number_value_get (style->border->border_left_width, 100);
bounds = gtk_css_boxes_get_border_rect (boxes);
@ -683,24 +683,24 @@ gtk_css_style_snapshot_border (GtkCssBoxes *boxes,
gtk_css_boxes_get_padding_rect (boxes)))
return;
colors[0] = *gtk_css_color_value_get_rgba (border->border_top_color ? border->border_top_color : boxes->style->core->color);
colors[1] = *gtk_css_color_value_get_rgba (border->border_right_color ? border->border_right_color : boxes->style->core->color);
colors[2] = *gtk_css_color_value_get_rgba (border->border_bottom_color ? border->border_bottom_color : boxes->style->core->color);
colors[3] = *gtk_css_color_value_get_rgba (border->border_left_color ? border->border_left_color : boxes->style->core->color);
colors[0] = *gtk_css_color_value_get_rgba (style->used->border_top_color);
colors[1] = *gtk_css_color_value_get_rgba (style->used->border_right_color);
colors[2] = *gtk_css_color_value_get_rgba (style->used->border_bottom_color);
colors[3] = *gtk_css_color_value_get_rgba (style->used->border_left_color);
alpha_test_vector = graphene_simd4f_init (colors[0].alpha, colors[1].alpha, colors[2].alpha, colors[3].alpha);
if (graphene_simd4f_is_zero4 (alpha_test_vector))
return;
border_style[0] = _gtk_css_border_style_value_get (border->border_top_style);
border_style[1] = _gtk_css_border_style_value_get (border->border_right_style);
border_style[2] = _gtk_css_border_style_value_get (border->border_bottom_style);
border_style[3] = _gtk_css_border_style_value_get (border->border_left_style);
border_style[0] = _gtk_css_border_style_value_get (style->border->border_top_style);
border_style[1] = _gtk_css_border_style_value_get (style->border->border_right_style);
border_style[2] = _gtk_css_border_style_value_get (style->border->border_bottom_style);
border_style[3] = _gtk_css_border_style_value_get (style->border->border_left_style);
border_width[0] = gtk_css_number_value_get (border->border_top_width, 100);
border_width[1] = gtk_css_number_value_get (border->border_right_width, 100);
border_width[2] = gtk_css_number_value_get (border->border_bottom_width, 100);
border_width[3] = gtk_css_number_value_get (border->border_left_width, 100);
border_width[0] = gtk_css_number_value_get (style->border->border_top_width, 100);
border_width[1] = gtk_css_number_value_get (style->border->border_right_width, 100);
border_width[2] = gtk_css_number_value_get (style->border->border_bottom_width, 100);
border_width[3] = gtk_css_number_value_get (style->border->border_left_width, 100);
gtk_snapshot_push_debug (snapshot, "CSS border");
if (border_style[0] <= GTK_BORDER_STYLE_SOLID &&
@ -730,21 +730,22 @@ void
gtk_css_style_snapshot_outline (GtkCssBoxes *boxes,
GtkSnapshot *snapshot)
{
GtkCssOutlineValues *outline = boxes->style->outline;
GtkCssStyle *style = boxes->style;
GtkBorderStyle border_style[4];
float border_width[4];
GdkRGBA colors[4];
border_style[0] = _gtk_css_border_style_value_get (outline->outline_style);
border_style[0] = _gtk_css_border_style_value_get (style->outline->outline_style);
if (border_style[0] != GTK_BORDER_STYLE_NONE)
{
const GdkRGBA *color = gtk_css_color_value_get_rgba (outline->outline_color ?
outline->outline_color :
boxes->style->core->color);
const GdkRGBA *color;
color = gtk_css_color_value_get_rgba (style->used->outline_color);
if (gdk_rgba_is_clear (color))
return;
border_width[0] = gtk_css_number_value_get (outline->outline_width, 100);
border_width[0] = gtk_css_number_value_get (style->outline->outline_width, 100);
if (G_APPROX_VALUE (border_width[0], 0, FLT_EPSILON))
return;

View File

@ -35,22 +35,22 @@
#include <math.h>
void
gtk_css_style_snapshot_icon (GtkCssStyle *style,
GtkSnapshot *snapshot,
double width,
double height)
gtk_css_style_snapshot_icon (GtkCssStyle *style,
GtkSnapshot *snapshot,
double width,
double height)
{
GskTransform *transform;
GtkCssImage *image;
gboolean has_shadow;
g_return_if_fail (GTK_IS_CSS_STYLE (style));
g_return_if_fail (style != NULL);
g_return_if_fail (snapshot != NULL);
if (width == 0.0 || height == 0.0)
return;
image = _gtk_css_image_value_get_image (style->other->icon_source);
image = _gtk_css_image_value_get_image (style->used->icon_source);
if (image == NULL)
return;
@ -60,7 +60,7 @@ gtk_css_style_snapshot_icon (GtkCssStyle *style,
gtk_css_filter_value_push_snapshot (style->other->icon_filter, snapshot);
has_shadow = gtk_css_shadow_value_push_snapshot (style->icon->icon_shadow, snapshot);
has_shadow = gtk_css_shadow_value_push_snapshot (style->used->icon_shadow, snapshot);
if (transform == NULL)
{
@ -102,7 +102,7 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style,
gboolean is_symbolic_paintable;
GdkRGBA colors[4];
g_return_if_fail (GTK_IS_CSS_STYLE (style));
g_return_if_fail (style != NULL);
g_return_if_fail (snapshot != NULL);
g_return_if_fail (GDK_IS_PAINTABLE (paintable));
g_return_if_fail (width > 0);
@ -112,7 +112,7 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle *style,
gtk_css_filter_value_push_snapshot (style->other->icon_filter, snapshot);
has_shadow = gtk_css_shadow_value_push_snapshot (style->icon->icon_shadow, snapshot);
has_shadow = gtk_css_shadow_value_push_snapshot (style->used->icon_shadow, snapshot);
is_symbolic_paintable = GTK_IS_SYMBOLIC_PAINTABLE (paintable);
if (is_symbolic_paintable)

View File

@ -47,8 +47,9 @@ gtk_css_style_snapshot_layout (GtkCssBoxes *boxes,
}
style = boxes->style;
color = gtk_css_color_value_get_rgba (style->core->color);
has_shadow = gtk_css_shadow_value_push_snapshot (style->font->text_shadow, snapshot);
color = gtk_css_color_value_get_rgba (style->used->color);
has_shadow = gtk_css_shadow_value_push_snapshot (style->used->text_shadow, snapshot);
gtk_snapshot_append_layout (snapshot, layout, color);
@ -187,12 +188,12 @@ snapshot_insertion_cursor (GtkSnapshot *snapshot,
PangoDirection direction,
gboolean draw_arrow)
{
GdkRGBA color;
const GdkRGBA *color;
if (is_primary)
color = *gtk_css_color_value_get_rgba (style->font->caret_color ? style->font->caret_color : style->core->color);
color = gtk_css_color_value_get_rgba (style->used->caret_color);
else
color = *gtk_css_color_value_get_rgba (style->font->secondary_caret_color ? style->font->secondary_caret_color : style->core->color);
color = gtk_css_color_value_get_rgba (style->used->secondary_caret_color);
if (width != 0 || draw_arrow)
{
@ -202,7 +203,7 @@ snapshot_insertion_cursor (GtkSnapshot *snapshot,
get_insertion_cursor_bounds (width, height, aspect_ratio, direction, draw_arrow, &bounds);
cr = gtk_snapshot_append_cairo (snapshot, &bounds);
draw_insertion_cursor (cr, 0, 0, width, height, aspect_ratio, &color, direction, draw_arrow);
draw_insertion_cursor (cr, 0, 0, width, height, aspect_ratio, color, direction, draw_arrow);
cairo_destroy (cr);
}
@ -220,7 +221,7 @@ snapshot_insertion_cursor (GtkSnapshot *snapshot,
offset = stem_width - stem_width / 2;
gtk_snapshot_append_color (snapshot,
&color,
color,
&GRAPHENE_RECT_INIT (- offset, 0, stem_width, height));
}
}

View File

@ -4845,7 +4845,7 @@ gtk_text_draw_cursor (GtkText *self,
gtk_css_boxes_init_border_box (&boxes, style, 0, 0, width, height);
gtk_snapshot_push_clip (snapshot, &bounds);
gtk_css_style_snapshot_background (&boxes, snapshot);
gtk_css_style_snapshot_layout (&boxes,snapshot, x, y, layout);
gtk_css_style_snapshot_layout (&boxes, snapshot, x, y, layout);
gtk_snapshot_pop (snapshot);
}

View File

@ -4040,8 +4040,9 @@ render_para (GskPangoRenderer *crenderer,
(line_display->insert_index < byte_offset + pango_layout_line_get_length (line) ||
(at_last_line && line_display->insert_index == byte_offset + pango_layout_line_get_length (line))))
{
GtkCssNode *node;
GtkCssStyle *style;
GdkRGBA cursor_color;
const GdkRGBA *cursor_color;
graphene_rect_t bounds = {
.origin.x = line_display->x_offset + line_display->block_cursor.x,
.origin.y = line_display->block_cursor.y + line_display->top_margin,
@ -4052,11 +4053,13 @@ render_para (GskPangoRenderer *crenderer,
/* we draw text using base color on filled cursor rectangle
* of cursor color (normally white on black)
*/
style = gtk_css_node_get_style (gtk_widget_get_css_node (crenderer->widget));
cursor_color = *gtk_css_color_value_get_rgba (style->font->caret_color ? style->font->caret_color : style->core->color);
node = gtk_widget_get_css_node (crenderer->widget);
style = gtk_css_node_get_style (node);
cursor_color = gtk_css_color_value_get_rgba (style->used->caret_color);
gtk_snapshot_push_opacity (crenderer->snapshot, cursor_alpha);
gtk_snapshot_append_color (crenderer->snapshot, &cursor_color, &bounds);
gtk_snapshot_append_color (crenderer->snapshot, cursor_color, &bounds);
/* draw text under the cursor if any */
if (!line_display->cursor_at_line_end)
@ -4112,11 +4115,12 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
gboolean have_selection;
gboolean draw_selection_text;
const GdkRGBA *selection;
GdkRGBA color;
const GdkRGBA *color;
GtkSnapshot *cursor_snapshot;
GtkTextBTree *btree;
GtkTextLine *first_line;
GtkTextLine *last_line;
GtkCssNode *node;
GtkCssStyle *style;
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
@ -4139,8 +4143,10 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
if (last_line == NULL)
last_line = _gtk_text_btree_get_end_iter_line (btree);
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
color = *gtk_css_color_value_get_rgba (style->core->color);
node = gtk_widget_get_css_node (widget);
style = gtk_css_node_get_style (node);
color = gtk_css_color_value_get_rgba (style->used->color);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (0, offset_y));
offset_y = 0;
@ -4153,7 +4159,7 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
crenderer->widget = widget;
crenderer->snapshot = snapshot;
crenderer->fg_color = &color;
crenderer->fg_color = color;
have_selection = gtk_text_buffer_get_selection_bounds (layout->buffer,
&selection_start,
@ -4161,7 +4167,7 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
if (have_selection)
{
GtkCssNode *selection_node;
GdkRGBA text_color;
const GdkRGBA *text_color;
selection_start_line = gtk_text_iter_get_line (&selection_start);
selection_end_line = gtk_text_iter_get_line (&selection_end);
@ -4169,10 +4175,10 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
selection_node = gtk_text_view_get_selection_node ((GtkTextView*)widget);
style = gtk_css_node_get_style (selection_node);
selection = gtk_css_color_value_get_rgba (style->background->background_color);
text_color = *gtk_css_color_value_get_rgba (style->core->color);
selection = gtk_css_color_value_get_rgba (style->used->background_color);
text_color = gtk_css_color_value_get_rgba (style->used->color);
draw_selection_text = text_color.alpha > 0;
draw_selection_text = text_color->alpha > 0;
}
else
{

View File

@ -132,7 +132,7 @@ gtk_text_util_create_drag_icon (GtkWidget *widget,
snapshot = gtk_snapshot_new ();
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
color = gtk_css_color_value_get_rgba (style->core->color);
color = gtk_css_color_value_get_rgba (style->used->color);
display = gtk_widget_get_display (widget);
@ -179,8 +179,8 @@ set_attributes_from_style (GtkWidget *widget,
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
*values->appearance.bg_rgba = *gtk_css_color_value_get_rgba (style->background->background_color);
*values->appearance.fg_rgba = *gtk_css_color_value_get_rgba (style->core->color);
*values->appearance.bg_rgba = *gtk_css_color_value_get_rgba (style->used->background_color);
*values->appearance.fg_rgba = *gtk_css_color_value_get_rgba (style->used->color);
if (values->font)
pango_font_description_free (values->font);

View File

@ -7856,7 +7856,6 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
{
GtkCssStyle *style;
const GdkRGBA black = { 0, };
const GdkRGBA *color;
const GdkRGBA *decoration_color;
GtkTextDecorationLine decoration_line;
GtkTextDecorationStyle decoration_style;
@ -7866,12 +7865,10 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
if (!values->appearance.fg_rgba)
values->appearance.fg_rgba = gdk_rgba_copy (&black);
style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (text_view)));
style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (text_view)));;
color = gtk_css_color_value_get_rgba (style->background->background_color);
*values->appearance.bg_rgba = *color;
color = gtk_css_color_value_get_rgba (style->core->color);
*values->appearance.fg_rgba = *color;
*values->appearance.bg_rgba = *gtk_css_color_value_get_rgba (style->used->background_color);
*values->appearance.fg_rgba = *gtk_css_color_value_get_rgba (style->used->color);
if (values->font)
pango_font_description_free (values->font);
@ -7882,9 +7879,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
decoration_line = _gtk_css_text_decoration_line_value_get (style->font_variant->text_decoration_line);
decoration_style = _gtk_css_text_decoration_style_value_get (style->font_variant->text_decoration_style);
decoration_color = gtk_css_color_value_get_rgba (style->font_variant->text_decoration_color
? style->font_variant->text_decoration_color
: style->core->color);
decoration_color = gtk_css_color_value_get_rgba (style->used->text_decoration_color);
if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE)
{
@ -7945,7 +7940,6 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
values->letter_spacing = gtk_css_number_value_get (style->font->letter_spacing, 100) * PANGO_SCALE;
/* line-height */
values->line_height = gtk_css_line_height_value_get (style->font->line_height);
values->line_height_is_absolute = FALSE;
if (values->line_height != 0.0)

View File

@ -13172,7 +13172,7 @@ gtk_widget_get_color (GtkWidget *widget,
g_return_if_fail (GTK_IS_WIDGET (widget));
style = gtk_css_node_get_style (priv->cssnode);
*color = *gtk_css_color_value_get_rgba (style->core->color);
*color = *gtk_css_color_value_get_rgba (style->used->color);
}
/*< private >

View File

@ -2425,14 +2425,16 @@ draw_page (GtkDrawingArea *da,
}
style = gtk_css_node_get_style (dialog->page_layout_paper_node);
color = *gtk_css_color_value_get_rgba (style->core->color);
color = *gtk_css_color_value_get_rgba (style->used->color);
pos_x = (width - w) / 2;
pos_y = (height - h) / 2 - 10;
cairo_translate (cr, pos_x, pos_y);
snapshot = gtk_snapshot_new ();
gtk_css_boxes_init_border_box (&boxes, style, 1, 1, w, h);
gtk_css_boxes_init_border_box (&boxes,
gtk_css_node_get_style (dialog->page_layout_paper_node),
1, 1, w, h);
gtk_css_style_snapshot_background (&boxes, snapshot);
gtk_css_style_snapshot_border (&boxes, snapshot);