Commit 10e4c04e authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Use style values directly

Replace uses of gtk_css_style_get_value with direct access,
throughout the tree. We don't replace all uses, just those
where we are dealing with a fixed property. Be careful to
handle the currentColor special case for color properties.
parent b378f566
Pipeline #147308 passed with stages
in 17 minutes and 23 seconds
......@@ -335,7 +335,7 @@ gsk_pango_renderer_prepare_run (PangoRenderer *renderer,
GtkCssValue *value;
node = gtk_text_view_get_selection_node ((GtkTextView *)crenderer->widget);
value = gtk_css_style_get_value (gtk_css_node_get_style (node), GTK_CSS_PROPERTY_COLOR);
value = gtk_css_node_get_style (node)->core->color;
fg_rgba = gtk_css_color_value_get_rgba (value);
}
else if (crenderer->state == GSK_PANGO_RENDERER_CURSOR && gtk_widget_has_focus (crenderer->widget))
......@@ -344,7 +344,7 @@ gsk_pango_renderer_prepare_run (PangoRenderer *renderer,
GtkCssValue *value;
node = gtk_widget_get_css_node (crenderer->widget);
value = gtk_css_style_get_value (gtk_css_node_get_style (node), GTK_CSS_PROPERTY_BACKGROUND_COLOR);
value = gtk_css_node_get_style (node)->background->background_color;
fg_rgba = gtk_css_color_value_get_rgba (value);
}
else
......
......@@ -210,7 +210,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 (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SIZE), 100);
priv->size = _gtk_css_number_value_get (style->icon->icon_size, 100);
gtk_style_context_restore (context);
}
......
......@@ -319,7 +319,7 @@ static int
calc_indicator_size (GtkStyleContext *context)
{
GtkCssStyle *style = gtk_style_context_lookup_style (context);
return _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SIZE), 100);
return _gtk_css_number_value_get (style->icon->icon_size, 100);
}
static void
......
......@@ -687,9 +687,9 @@ gtk_css_animated_style_create_css_transitions (GPtrArray *animations,
gboolean source_is_animated;
guint i;
durations = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_TRANSITION_DURATION);
delays = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_TRANSITION_DELAY);
timing_functions = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION);
durations = base_style->transition->transition_duration;
delays = base_style->transition->transition_delay;
timing_functions = base_style->transition->transition_timing_function;
if (_gtk_css_array_value_get_n_values (durations) == 1 &&
_gtk_css_array_value_get_n_values (delays) == 1 &&
......@@ -697,7 +697,7 @@ gtk_css_animated_style_create_css_transitions (GPtrArray *animations,
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, 0), 100) == 0)
return animations;
transition_infos_set (transitions, gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_TRANSITION_PROPERTY));
transition_infos_set (transitions, base_style->transition->transition_property);
source_is_animated = GTK_IS_CSS_ANIMATED_STYLE (source);
for (i = 0; i < GTK_CSS_PROPERTY_N_PROPERTIES; i++)
......@@ -787,14 +787,14 @@ gtk_css_animated_style_create_css_animations (GPtrArray *animations,
GtkCssValue *iteration_counts, *directions, *play_states, *fill_modes;
guint i;
animation_names = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_ANIMATION_NAME);
durations = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_ANIMATION_DURATION);
delays = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_ANIMATION_DELAY);
timing_functions = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION);
iteration_counts = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT);
directions = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_ANIMATION_DIRECTION);
play_states = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE);
fill_modes = gtk_css_style_get_value (base_style, GTK_CSS_PROPERTY_ANIMATION_FILL_MODE);
animation_names = base_style->animation->animation_name;
durations = base_style->animation->animation_duration;
delays = base_style->animation->animation_delay;
timing_functions = base_style->animation->animation_timing_function;
iteration_counts = base_style->animation->animation_iteration_count;
directions = base_style->animation->animation_direction;
play_states = base_style->animation->animation_play_state;
fill_modes = base_style->animation->animation_fill_mode;
for (i = 0; i < _gtk_css_array_value_get_n_values (animation_names); i++)
{
......
......@@ -74,17 +74,11 @@ gtk_css_boxes_init_border_box (GtkCssBoxes *boxes,
static inline void
gtk_css_boxes_rect_grow (GskRoundedRect *dest,
GskRoundedRect *src,
GtkCssStyle *style,
int top_property,
int right_property,
int bottom_property,
int left_property)
GtkCssValue *top,
GtkCssValue *right,
GtkCssValue *bottom,
GtkCssValue *left)
{
GtkCssValue *top = gtk_css_style_get_value (style, top_property);
GtkCssValue *right = gtk_css_style_get_value (style, right_property);
GtkCssValue *bottom = gtk_css_style_get_value (style, bottom_property);
GtkCssValue *left = gtk_css_style_get_value (style, left_property);
if (gtk_css_dimension_value_is_zero (left))
{
dest->bounds.origin.x = src->bounds.origin.x;
......@@ -129,16 +123,15 @@ gtk_css_boxes_rect_grow (GskRoundedRect *dest,
static inline void
gtk_css_boxes_rect_shrink (GskRoundedRect *dest,
GskRoundedRect *src,
GtkCssStyle *style,
int top_property,
int right_property,
int bottom_property,
int left_property)
GtkCssValue *top_value,
GtkCssValue *right_value,
GtkCssValue *bottom_value,
GtkCssValue *left_value)
{
double top = _gtk_css_number_value_get (gtk_css_style_get_value (style, top_property), 100);
double right = _gtk_css_number_value_get (gtk_css_style_get_value (style, right_property), 100);
double bottom = _gtk_css_number_value_get (gtk_css_style_get_value (style, bottom_property), 100);
double left = _gtk_css_number_value_get (gtk_css_style_get_value (style, left_property), 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;
......@@ -177,11 +170,10 @@ gtk_css_boxes_compute_border_rect (GtkCssBoxes *boxes)
gtk_css_boxes_rect_grow (&boxes->box[GTK_CSS_AREA_BORDER_BOX],
&boxes->box[GTK_CSS_AREA_PADDING_BOX],
boxes->style,
GTK_CSS_PROPERTY_BORDER_TOP_WIDTH,
GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH,
GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH,
GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH);
boxes->style->border->border_top_width,
boxes->style->border->border_right_width,
boxes->style->border->border_bottom_width,
boxes->style->border->border_left_width);
boxes->has_rect[GTK_CSS_AREA_BORDER_BOX] = TRUE;
}
......@@ -196,21 +188,19 @@ gtk_css_boxes_compute_padding_rect (GtkCssBoxes *boxes)
{
gtk_css_boxes_rect_shrink (&boxes->box[GTK_CSS_AREA_PADDING_BOX],
&boxes->box[GTK_CSS_AREA_BORDER_BOX],
boxes->style,
GTK_CSS_PROPERTY_BORDER_TOP_WIDTH,
GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH,
GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH,
GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH);
boxes->style->border->border_top_width,
boxes->style->border->border_right_width,
boxes->style->border->border_bottom_width,
boxes->style->border->border_left_width);
}
else
{
gtk_css_boxes_rect_grow (&boxes->box[GTK_CSS_AREA_PADDING_BOX],
&boxes->box[GTK_CSS_AREA_CONTENT_BOX],
boxes->style,
GTK_CSS_PROPERTY_PADDING_TOP,
GTK_CSS_PROPERTY_PADDING_RIGHT,
GTK_CSS_PROPERTY_PADDING_BOTTOM,
GTK_CSS_PROPERTY_PADDING_LEFT);
boxes->style->size->padding_top,
boxes->style->size->padding_right,
boxes->style->size->padding_bottom,
boxes->style->size->padding_left);
}
boxes->has_rect[GTK_CSS_AREA_PADDING_BOX] = TRUE;
......@@ -226,11 +216,10 @@ gtk_css_boxes_compute_content_rect (GtkCssBoxes *boxes)
gtk_css_boxes_rect_shrink (&boxes->box[GTK_CSS_AREA_CONTENT_BOX],
&boxes->box[GTK_CSS_AREA_PADDING_BOX],
boxes->style,
GTK_CSS_PROPERTY_PADDING_TOP,
GTK_CSS_PROPERTY_PADDING_RIGHT,
GTK_CSS_PROPERTY_PADDING_BOTTOM,
GTK_CSS_PROPERTY_PADDING_LEFT);
boxes->style->size->padding_top,
boxes->style->size->padding_right,
boxes->style->size->padding_bottom,
boxes->style->size->padding_left);
boxes->has_rect[GTK_CSS_AREA_CONTENT_BOX] = TRUE;
}
......@@ -245,11 +234,10 @@ gtk_css_boxes_compute_margin_rect (GtkCssBoxes *boxes)
gtk_css_boxes_rect_grow (&boxes->box[GTK_CSS_AREA_MARGIN_BOX],
&boxes->box[GTK_CSS_AREA_BORDER_BOX],
boxes->style,
GTK_CSS_PROPERTY_MARGIN_TOP,
GTK_CSS_PROPERTY_MARGIN_RIGHT,
GTK_CSS_PROPERTY_MARGIN_BOTTOM,
GTK_CSS_PROPERTY_MARGIN_LEFT);
boxes->style->size->margin_top,
boxes->style->size->margin_right,
boxes->style->size->margin_bottom,
boxes->style->size->margin_left);
boxes->has_rect[GTK_CSS_AREA_MARGIN_BOX] = TRUE;
}
......@@ -268,8 +256,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 (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_OUTLINE_OFFSET), 100) +
_gtk_css_number_value_get (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_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;
......@@ -442,10 +430,10 @@ gtk_css_boxes_compute_border_box (GtkCssBoxes *boxes)
gtk_css_boxes_compute_border_rect (boxes);
gtk_css_boxes_apply_border_radius (&boxes->box[GTK_CSS_AREA_BORDER_BOX],
gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS),
gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS),
gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS),
gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS));
boxes->style->border->border_top_left_radius,
boxes->style->border->border_top_right_radius,
boxes->style->border->border_bottom_right_radius,
boxes->style->border->border_bottom_left_radius);
boxes->has_box[GTK_CSS_AREA_BORDER_BOX] = TRUE;
}
......@@ -489,10 +477,10 @@ gtk_css_boxes_compute_outline_box (GtkCssBoxes *boxes)
gtk_css_boxes_compute_outline_rect (boxes);
gtk_css_boxes_apply_border_radius (&boxes->box[GTK_CSS_AREA_OUTLINE_BOX],
gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_OUTLINE_TOP_LEFT_RADIUS),
gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_OUTLINE_TOP_RIGHT_RADIUS),
gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_OUTLINE_BOTTOM_RIGHT_RADIUS),
gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_OUTLINE_BOTTOM_LEFT_RADIUS));
boxes->style->outline->outline_top_left_radius,
boxes->style->outline->outline_top_right_radius,
boxes->style->outline->outline_bottom_right_radius,
boxes->style->outline->outline_bottom_left_radius);
boxes->has_box[GTK_CSS_AREA_OUTLINE_BOX] = TRUE;
}
......
......@@ -120,7 +120,7 @@ gtk_css_value_color_get_fallback (guint property_id,
style,
parent_style);
case GTK_CSS_PROPERTY_ICON_PALETTE:
return _gtk_css_value_ref (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
return _gtk_css_value_ref (style->core->color);
default:
if (property_id < GTK_CSS_PROPERTY_N_PROPERTIES)
g_warning ("No fallback color defined for property '%s'",
......@@ -147,7 +147,7 @@ gtk_css_value_color_compute (GtkCssValue *value,
GtkCssValue *current;
if (parent_style)
current = gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_COLOR);
current = parent_style->core->color;
else
current = NULL;
......@@ -162,7 +162,7 @@ gtk_css_value_color_compute (GtkCssValue *value,
}
else
{
GtkCssValue *current = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
GtkCssValue *current = style->core->color;
resolved = _gtk_css_color_value_resolve (value,
provider,
......
......@@ -45,18 +45,18 @@ get_base_font_size_px (guint property_id,
if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
{
if (parent_style)
return _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
return _gtk_css_number_value_get (parent_style->core->font_size, 100);
else
return gtk_css_font_size_get_default_px (provider, style);
}
return _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_SIZE), 100);
return _gtk_css_number_value_get (style->core->font_size, 100);
}
static double
get_dpi (GtkCssStyle *style)
{
return _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_DPI), 96);
return _gtk_css_number_value_get (style->core->dpi, 96);
}
static GtkCssValue *
......
......@@ -202,7 +202,7 @@ _gtk_css_blend_mode_value_get (const GtkCssValue *value)
static double
get_dpi (GtkCssStyle *style)
{
return _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_DPI), 96);
return _gtk_css_number_value_get (style->core->dpi, 96);
}
/* XXX: Kinda bad to have that machinery here, nobody expects vital font
......@@ -267,7 +267,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 (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_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);
/* XXX: This is what WebKit does... */
......@@ -275,7 +275,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 (gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_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);
/* XXX: This is what WebKit does... */
......@@ -411,7 +411,7 @@ gtk_css_value_font_weight_compute (GtkCssValue *value,
return _gtk_css_value_ref (value);
if (parent_style)
parent_value = _gtk_css_number_value_get (gtk_css_style_get_value (parent_style, property_id), 100);
parent_value = _gtk_css_number_value_get (parent_style->font->font_weight, 100);
else
parent_value = 400;
......
......@@ -176,7 +176,7 @@ 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);
copy->icon_theme = gtk_css_icon_theme_value_get_icon_theme (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_THEME));
copy->icon_theme = gtk_css_icon_theme_value_get_icon_theme (style->core->icon_theme);
copy->scale = gtk_style_provider_get_scale (provider);
gtk_icon_theme_lookup_symbolic_colors (style, &copy->color, &copy->success, &copy->warning, &copy->error);
......
......@@ -70,11 +70,9 @@ lookup_symbolic_colors (GtkCssStyle *style,
GdkRGBA *warning_out,
GdkRGBA *error_out)
{
GtkCssValue *color;
const GdkRGBA *lookup;
color = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
*color_out = *gtk_css_color_value_get_rgba (color);
*color_out = *gtk_css_color_value_get_rgba (style->core->color);
lookup = gtk_css_palette_value_get_color (palette, "success");
if (lookup)
......@@ -220,7 +218,7 @@ gtk_css_image_recolor_compute (GtkCssImage *image,
if (recolor->palette)
palette = _gtk_css_value_compute (recolor->palette, property_id, provider, style, parent_style);
else
palette = _gtk_css_value_ref (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_PALETTE));
palette = _gtk_css_value_ref (style->core->icon_palette);
img = gtk_css_image_recolor_load (recolor, style, palette, scale, &error);
......
......@@ -436,7 +436,6 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
const GdkRGBA *color;
const GdkRGBA *decoration_color;
gint letter_spacing;
GtkCssValue *value;
GtkCssFontVariantLigature ligatures;
GtkCssFontVariantNumeric numeric;
GtkCssFontVariantEastAsian east_asian;
......@@ -444,10 +443,12 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
char *settings;
/* text-decoration */
decoration_line = _gtk_css_text_decoration_line_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_TEXT_DECORATION_LINE));
decoration_style = _gtk_css_text_decoration_style_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE));
color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
decoration_color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR));
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);
color = gtk_css_color_value_get_rgba (style->core->color);
decoration_color = gtk_css_color_value_get_rgba (style->font_variant->text_decoration_color
? style->font_variant->text_decoration_color
: style->core->color);
switch (decoration_line)
{
......@@ -471,7 +472,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
}
/* letter-spacing */
letter_spacing = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_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));
......@@ -481,8 +482,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
s = g_string_new ("");
value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_KERNING);
switch (_gtk_css_font_kerning_value_get (value))
switch (_gtk_css_font_kerning_value_get (style->font_variant->font_kerning))
{
case GTK_CSS_FONT_KERNING_NORMAL:
append_separated (s, "kern 1");
......@@ -495,8 +495,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
break;
}
value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIANT_LIGATURES);
ligatures = _gtk_css_font_variant_ligature_value_get (value);
ligatures = _gtk_css_font_variant_ligature_value_get (style->font_variant->font_variant_ligatures);
if (ligatures == GTK_CSS_FONT_VARIANT_LIGATURE_NORMAL)
{
/* all defaults */
......@@ -523,8 +522,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
append_separated (s, "calt 0");
}
value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIANT_POSITION);
switch (_gtk_css_font_variant_position_value_get (value))
switch (_gtk_css_font_variant_position_value_get (style->font_variant->font_variant_position))
{
case GTK_CSS_FONT_VARIANT_POSITION_SUB:
append_separated (s, "subs 1");
......@@ -537,8 +535,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
break;
}
value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIANT_CAPS);
switch (_gtk_css_font_variant_caps_value_get (value))
switch (_gtk_css_font_variant_caps_value_get (style->font_variant->font_variant_caps))
{
case GTK_CSS_FONT_VARIANT_CAPS_SMALL_CAPS:
append_separated (s, "smcp 1");
......@@ -563,8 +560,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
break;
}
value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIANT_NUMERIC);
numeric = _gtk_css_font_variant_numeric_value_get (value);
numeric = _gtk_css_font_variant_numeric_value_get (style->font_variant->font_variant_numeric);
if (numeric == GTK_CSS_FONT_VARIANT_NUMERIC_NORMAL)
{
/* all defaults */
......@@ -589,8 +585,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
append_separated (s, "zero 1");
}
value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIANT_ALTERNATES);
switch (_gtk_css_font_variant_alternate_value_get (value))
switch (_gtk_css_font_variant_alternate_value_get (style->font_variant->font_variant_alternates))
{
case GTK_CSS_FONT_VARIANT_ALTERNATE_HISTORICAL_FORMS:
append_separated (s, "hist 1");
......@@ -600,8 +595,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
break;
}
value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIANT_EAST_ASIAN);
east_asian = _gtk_css_font_variant_east_asian_value_get (value);
east_asian = _gtk_css_font_variant_east_asian_value_get (style->font_variant->font_variant_east_asian);
if (east_asian == GTK_CSS_FONT_VARIANT_EAST_ASIAN_NORMAL)
{
/* all defaults */
......@@ -628,8 +622,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
append_separated (s, "ruby 1");
}
value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_FEATURE_SETTINGS);
settings = gtk_css_font_features_value_get_features (value);
settings = gtk_css_font_features_value_get_features (style->font->font_feature_settings);
if (settings)
{
append_separated (s, settings);
......@@ -651,7 +644,7 @@ gtk_css_style_get_pango_font (GtkCssStyle *style)
description = pango_font_description_new ();
v = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_FAMILY);
v = style->font->font_family;
if (_gtk_css_array_value_get_n_values (v) > 1)
{
int i;
......@@ -673,19 +666,19 @@ gtk_css_style_get_pango_font (GtkCssStyle *style)
_gtk_css_string_value_get (_gtk_css_array_value_get_nth (v, 0)));
}
v = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_SIZE);
v = style->core->font_size;
pango_font_description_set_absolute_size (description, round (_gtk_css_number_value_get (v, 100) * PANGO_SCALE));
v = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_STYLE);
v = style->font->font_style;
pango_font_description_set_style (description, _gtk_css_font_style_value_get (v));
v = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_WEIGHT);
v = style->font->font_weight;
pango_font_description_set_weight (description, _gtk_css_number_value_get (v, 100));
v = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_STRETCH);
v = style->font->font_stretch;
pango_font_description_set_stretch (description, _gtk_css_font_stretch_value_get (v));
v = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIATION_SETTINGS);
v = style->font->font_variation_settings;
str = gtk_css_font_variations_value_get_variations (v);
pango_font_description_set_variations (description, str);
g_free (str);
......
......@@ -113,12 +113,12 @@ gtk_drag_icon_native_get_surface_transform (GtkNative *native,
GtkCssStyle *style;
style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (native)));
*x = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MARGIN_LEFT), 100) +
_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100) +
_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_PADDING_LEFT), 100);
*y = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MARGIN_TOP), 100) +
_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100) +
_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_PADDING_TOP), 100);
*x = _gtk_css_number_value_get (style->size->margin_left, 100) +
_gtk_css_number_value_get (style->border->border_left_width, 100) +
_gtk_css_number_value_get (style->size->padding_left, 100);
*y = _gtk_css_number_value_get (style->size->margin_top, 100) +
_gtk_css_number_value_get (style->border->border_top_width, 100) +
_gtk_css_number_value_get (style->size->padding_top, 100);
}
static void
......
......@@ -67,7 +67,7 @@ get_icon_lookup_flags (GtkIconHelper *self,
if (self->pixel_size != -1 || self->force_scale_pixbuf)
flags |= GTK_ICON_LOOKUP_FORCE_SIZE;
icon_style = _gtk_css_icon_style_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_STYLE));
icon_style = _gtk_css_icon_style_value_get (style->icon->icon_style);
switch (icon_style)
{
......@@ -106,8 +106,7 @@ ensure_paintable_for_gicon (GtkIconHelper *self,
GtkIconLookupFlags flags;
GdkPaintable *paintable;
icon_theme = gtk_css_icon_theme_value_get_icon_theme
(gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_THEME));
icon_theme = gtk_css_icon_theme_value_get_icon_theme (style->core->icon_theme);
flags = get_icon_lookup_flags (self, style, dir);
width = height = gtk_icon_helper_get_size (self);
......@@ -489,7 +488,7 @@ gtk_icon_helper_get_size (GtkIconHelper *self)
return self->pixel_size;
style = gtk_css_node_get_style (self->node);
return _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SIZE), 100);
return _gtk_css_number_value_get (style->icon->icon_size, 100);
}
void
......
......@@ -3872,9 +3872,9 @@ gtk_icon_theme_lookup_symbolic_colors (GtkCssStyle *style,
{
GtkCssValue *palette, *color;
const GdkRGBA *lookup;
color = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
palette = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_PALETTE);
color = style->core->color;
palette = style->core->icon_palette;
*color_out = *gtk_css_color_value_get_rgba (color);
lookup = gtk_css_palette_value_get_color (palette, "success");
......
......@@ -156,6 +156,7 @@ gtk_picture_measure (GtkWidget *widget,
int *natural_baseline)
{
GtkPicture *self = GTK_PICTURE (widget);
GtkCssStyle *style;
double min_width, min_height, nat_width, nat_height;
double default_size;
......@@ -166,7 +167,8 @@ gtk_picture_measure (GtkWidget *widget,
return;
}
default_size = _gtk_css_number_value_get (gtk_css_style_get_value (gtk_css_node_get_style (gtk_widget_get_css_node (widget)), GTK_CSS_PROPERTY_ICON_SIZE), 100);
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
default_size = _gtk_css_number_value_get (style->icon->icon_size, 100);
if (self->can_shrink)
{
......
......@@ -213,12 +213,12 @@ gtk_popover_native_get_surface_transform (GtkNative *native,
GtkCssStyle *style;