[gtk/css-style-split-2: 16/16] Use style values directly



commit 10e4c04e617fa4eb6c4718c49df7c55fd74a137f
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jan 28 07:38:25 2020 +0000

    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.

 gtk/gskpango.c                |  4 +-
 gtk/gtkcellrendererspinner.c  |  2 +-
 gtk/gtkcellrenderertoggle.c   |  2 +-
 gtk/gtkcssanimatedstyle.c     | 24 +++++------
 gtk/gtkcssboxesimplprivate.h  | 96 +++++++++++++++++++------------------------
 gtk/gtkcsscolorvalue.c        |  6 +--
 gtk/gtkcssdimensionvalue.c    |  6 +--
 gtk/gtkcssenumvalue.c         |  8 ++--
 gtk/gtkcssimageicontheme.c    |  2 +-
 gtk/gtkcssimagerecolor.c      |  6 +--
 gtk/gtkcssstyle.c             | 49 ++++++++++------------
 gtk/gtkdragicon.c             | 12 +++---
 gtk/gtkiconhelper.c           |  7 ++--
 gtk/gtkicontheme.c            |  6 +--
 gtk/gtkpicture.c              |  4 +-
 gtk/gtkpopover.c              | 44 ++++++++++----------
 gtk/gtkrenderbackground.c     | 34 ++++++---------
 gtk/gtkrenderborder.c         | 50 +++++++++++-----------
 gtk/gtkrendericon.c           | 28 ++++---------
 gtk/gtkroundedbox.c           | 32 +++++++--------
 gtk/gtksizerequest.c          | 42 +++++++++----------
 gtk/gtkspinner.c              | 11 ++---
 gtk/gtkstylecontext.c         | 50 ++++++++--------------
 gtk/gtktextutil.c             | 11 +++--
 gtk/gtktreeview.c             |  9 ++--
 gtk/gtkwidget.c               | 45 ++++++++++----------
 gtk/inspector/layoutoverlay.c | 29 +++++++------
 27 files changed, 281 insertions(+), 338 deletions(-)
---
diff --git a/gtk/gskpango.c b/gtk/gskpango.c
index 141267c8c3..0e04a0b95a 100644
--- a/gtk/gskpango.c
+++ b/gtk/gskpango.c
@@ -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
diff --git a/gtk/gtkcellrendererspinner.c b/gtk/gtkcellrendererspinner.c
index a77eedf43f..3ac622ccc4 100644
--- a/gtk/gtkcellrendererspinner.c
+++ b/gtk/gtkcellrendererspinner.c
@@ -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);
 }
diff --git a/gtk/gtkcellrenderertoggle.c b/gtk/gtkcellrenderertoggle.c
index 224022f56c..fca10951d3 100644
--- a/gtk/gtkcellrenderertoggle.c
+++ b/gtk/gtkcellrenderertoggle.c
@@ -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
diff --git a/gtk/gtkcssanimatedstyle.c b/gtk/gtkcssanimatedstyle.c
index 28ccf7326e..0012a93422 100644
--- a/gtk/gtkcssanimatedstyle.c
+++ b/gtk/gtkcssanimatedstyle.c
@@ -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++)
     {
diff --git a/gtk/gtkcssboxesimplprivate.h b/gtk/gtkcssboxesimplprivate.h
index 16fc3e96bc..65737e81f8 100644
--- a/gtk/gtkcssboxesimplprivate.h
+++ b/gtk/gtkcssboxesimplprivate.h
@@ -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;
 }
diff --git a/gtk/gtkcsscolorvalue.c b/gtk/gtkcsscolorvalue.c
index 80cc7a3d21..cd80e2db2f 100644
--- a/gtk/gtkcsscolorvalue.c
+++ b/gtk/gtkcsscolorvalue.c
@@ -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,
diff --git a/gtk/gtkcssdimensionvalue.c b/gtk/gtkcssdimensionvalue.c
index d8e06af052..b54309d079 100644
--- a/gtk/gtkcssdimensionvalue.c
+++ b/gtk/gtkcssdimensionvalue.c
@@ -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 *
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index d558964fc9..82d5580773 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -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;
 
diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c
index 508c90d435..bf4dc47415 100644
--- a/gtk/gtkcssimageicontheme.c
+++ b/gtk/gtkcssimageicontheme.c
@@ -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);
 
diff --git a/gtk/gtkcssimagerecolor.c b/gtk/gtkcssimagerecolor.c
index 4094de8a78..78f91d9f53 100644
--- a/gtk/gtkcssimagerecolor.c
+++ b/gtk/gtkcssimagerecolor.c
@@ -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);
 
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c
index b05ccc0d20..6957e2b126 100644
--- a/gtk/gtkcssstyle.c
+++ b/gtk/gtkcssstyle.c
@@ -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);
diff --git a/gtk/gtkdragicon.c b/gtk/gtkdragicon.c
index c4bb48ea8c..2e33f1c66c 100644
--- a/gtk/gtkdragicon.c
+++ b/gtk/gtkdragicon.c
@@ -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
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 315e6e8a6d..ff8959c6d6 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -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
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index 38a0bd2761..e5abec19fc 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -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");
diff --git a/gtk/gtkpicture.c b/gtk/gtkpicture.c
index 125d37c60b..401e0a8a07 100644
--- a/gtk/gtkpicture.c
+++ b/gtk/gtkpicture.c
@@ -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)
     {
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 752c8b9777..af1fee728b 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -213,12 +213,12 @@ gtk_popover_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
@@ -798,10 +798,10 @@ gtk_popover_get_gap_coords (GtkPopover *popover,
   pos = priv->final_position;
 
   style = gtk_css_node_get_style (gtk_widget_get_css_node (priv->contents_widget));
-  border_radius = _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS), 100);
-  border_top = _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
-  border_right = _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
-  border_bottom = _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
+  border_radius = _gtk_css_number_value_get (style->border->border_top_left_radius, 100);
+  border_top = _gtk_css_number_value_get (style->border->border_top_width, 100);
+  border_right = _gtk_css_number_value_get (style->border->border_right_width, 100);
+  border_bottom = _gtk_css_number_value_get (style->border->border_bottom_width, 100);
 
   if (pos == GTK_POS_BOTTOM || pos == GTK_POS_RIGHT)
     {
@@ -873,10 +873,10 @@ get_margin (GtkWidget *widget,
 
   style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
 
-  border->top = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MARGIN_TOP), 
100);
-  border->right = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MARGIN_RIGHT), 
100);
-  border->bottom = _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_MARGIN_BOTTOM), 100);
-  border->left = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MARGIN_LEFT), 
100);
+  border->top = _gtk_css_number_value_get (style->size->margin_top, 100);
+  border->right = _gtk_css_number_value_get (style->size->margin_right, 100);
+  border->bottom = _gtk_css_number_value_get (style->size->margin_bottom, 100);
+  border->left = _gtk_css_number_value_get (style->size->margin_left, 100);
 }
 
 static void
@@ -935,10 +935,10 @@ get_border (GtkCssNode *node,
 
   style = gtk_css_node_get_style (node);
 
-  border->top = _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
-  border->right = _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
-  border->bottom = _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
-  border->left = _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
+  border->top = _gtk_css_number_value_get (style->border->border_top_width, 100);
+  border->right = _gtk_css_number_value_get (style->border->border_right_width, 100);
+  border->bottom = _gtk_css_number_value_get (style->border->border_bottom_width, 100);
+  border->left = _gtk_css_number_value_get (style->border->border_left_width, 100);
 }
 
 static void
@@ -1033,7 +1033,7 @@ get_border_radius (GtkWidget *widget)
   GtkCssStyle *style;
 
   style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
-  return round (_gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS), 100));
+  return round (_gtk_css_number_value_get (style->border->border_top_left_radius, 100));
 }
 
 static gint
@@ -1170,11 +1170,11 @@ create_arrow_render_node (GtkPopover *popover)
   /* Render the border of the arrow tip */
   if (border.bottom > 0)
     {
-      GtkCssValue *value;
+      GtkCssStyle *style;
       const GdkRGBA *border_color;
 
-      value = gtk_css_style_get_value (gtk_css_node_get_style (priv->arrow_node), 
GTK_CSS_PROPERTY_BORDER_LEFT_COLOR);
-      border_color = gtk_css_color_value_get_rgba (value);
+      style = gtk_css_node_get_style (priv->arrow_node);
+      border_color = gtk_css_color_value_get_rgba (style->border->border_left_color ? 
style->border->border_left_color : style->core->color);
 
       gtk_popover_apply_tail_path (popover, cr);
       gdk_cairo_set_source_rgba (cr, border_color);
diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c
index 68a4a198f2..cb387f1c9d 100644
--- a/gtk/gtkrenderbackground.c
+++ b/gtk/gtkrenderbackground.c
@@ -59,10 +59,7 @@ gtk_theming_background_snapshot_color (GtkCssBoxes       *boxes,
   GtkCssArea clip;
     
   n_values = _gtk_css_array_value_get_n_values (background_image);
-  clip = _gtk_css_area_value_get 
-    (_gtk_css_array_value_get_nth 
-     (gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BACKGROUND_CLIP), 
-      n_values - 1));
+  clip = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (boxes->style->background->background_clip, 
n_values - 1)); 
   box = gtk_css_boxes_get_box (boxes, clip);
 
   if (gsk_rounded_rect_is_rectilinear (box))
@@ -86,6 +83,7 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg,
                                        guint        idx,
                                        GtkSnapshot *snapshot)
 {
+  GtkCssBackgroundValues *background = bg->style->background;
   GtkCssRepeatStyle hrepeat, vrepeat;
   const GtkCssValue *pos, *repeat;
   GtkCssImage *image;
@@ -94,25 +92,20 @@ 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 (
-                  gtk_css_style_get_value (bg->style, GTK_CSS_PROPERTY_BACKGROUND_IMAGE),
-                  idx));
+  image = _gtk_css_image_value_get_image (_gtk_css_array_value_get_nth (background->background_image, idx));
 
   if (image == NULL)
     return;
 
-  pos = _gtk_css_array_value_get_nth (gtk_css_style_get_value (bg->style, 
GTK_CSS_PROPERTY_BACKGROUND_POSITION), idx);
-  repeat = _gtk_css_array_value_get_nth (gtk_css_style_get_value (bg->style, 
GTK_CSS_PROPERTY_BACKGROUND_REPEAT), idx);
+  pos = _gtk_css_array_value_get_nth (background->background_position, idx);
+  repeat = _gtk_css_array_value_get_nth (background->background_repeat, idx);
   hrepeat = _gtk_css_background_repeat_value_get_x (repeat);
   vrepeat = _gtk_css_background_repeat_value_get_y (repeat);
 
 
   origin = gtk_css_boxes_get_box (bg,
                                   _gtk_css_area_value_get (
-                                      _gtk_css_array_value_get_nth (
-                                          gtk_css_style_get_value (bg->style, 
GTK_CSS_PROPERTY_BACKGROUND_ORIGIN),
-                                          idx)));
+                                      _gtk_css_array_value_get_nth (background->background_origin, idx)));
 
   width = origin->bounds.size.width;
   height = origin->bounds.size.height;
@@ -122,11 +115,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 (
-                                        gtk_css_style_get_value (bg->style, 
GTK_CSS_PROPERTY_BACKGROUND_CLIP),
-                                        idx)));
+                                    _gtk_css_array_value_get_nth (background->background_clip, idx)));
 
-  _gtk_css_bg_size_value_compute_size (_gtk_css_array_value_get_nth (gtk_css_style_get_value (bg->style, 
GTK_CSS_PROPERTY_BACKGROUND_SIZE), idx),
+  _gtk_css_bg_size_value_compute_size (_gtk_css_array_value_get_nth (background->background_size, idx),
                                        image,
                                        width,
                                        height,
@@ -269,9 +260,10 @@ void
 gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
                                    GtkSnapshot *snapshot)
 {
-  GtkCssValue *background_image = gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BACKGROUND_IMAGE);
-  const GdkRGBA *bg_color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BACKGROUND_COLOR));
-  const GtkCssValue *box_shadow = gtk_css_style_get_value (boxes->style, GTK_CSS_PROPERTY_BOX_SHADOW);
+  GtkCssBackgroundValues *background = boxes->style->background;
+  GtkCssValue *background_image = background->background_image;
+  const GdkRGBA *bg_color = gtk_css_color_value_get_rgba (background->background_color);
+  const GtkCssValue *box_shadow = background->box_shadow;
   const gboolean has_bg_color = !gdk_rgba_is_clear (bg_color);
   const gboolean has_bg_image = _gtk_css_image_value_get_image (_gtk_css_array_value_get_nth 
(background_image, 0)) != NULL;
   const gboolean has_shadow = !gtk_css_shadow_value_is_none (box_shadow);
@@ -290,7 +282,7 @@ gtk_css_style_snapshot_background (GtkCssBoxes *boxes,
 
   if (has_bg_image)
     {
-      GtkCssValue *blend_modes = gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE);
+      GtkCssValue *blend_modes = background->background_blend_mode;
       const int number_of_layers = _gtk_css_array_value_get_n_values (background_image);
       GskBlendMode *blend_mode_values = g_alloca (sizeof (GskBlendMode) * number_of_layers);
 
diff --git a/gtk/gtkrenderborder.c b/gtk/gtkrenderborder.c
index 232418ad64..220494178d 100644
--- a/gtk/gtkrenderborder.c
+++ b/gtk/gtkrenderborder.c
@@ -58,13 +58,13 @@ static gboolean
 gtk_border_image_init (GtkBorderImage *image,
                        GtkCssStyle    *style)
 {
-  image->source = _gtk_css_image_value_get_image (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE));
+  image->source = _gtk_css_image_value_get_image (style->border->border_image_source);
   if (image->source == NULL)
     return FALSE;
 
-  image->slice = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_IMAGE_SLICE);
-  image->width = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH);
-  image->repeat = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_IMAGE_REPEAT);
+  image->slice = style->border->border_image_slice;
+  image->width = style->border->border_image_width;
+  image->repeat = style->border->border_image_repeat;
 
   return TRUE;
 }
@@ -651,18 +651,21 @@ void
 gtk_css_style_snapshot_border (GtkCssBoxes *boxes,
                                GtkSnapshot *snapshot)
 {
+  GtkCssBorderValues *border;
   GtkBorderImage border_image;
   float border_width[4];
 
+  border = boxes->style->border;
+
   if (gtk_border_image_init (&border_image, boxes->style))
     {
       cairo_t *cr;
       const graphene_rect_t *bounds;
 
-      border_width[0] = _gtk_css_number_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
-      border_width[1] = _gtk_css_number_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
-      border_width[2] = _gtk_css_number_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
-      border_width[3] = _gtk_css_number_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
+      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);
 
       bounds = gtk_css_boxes_get_border_rect (boxes);
 
@@ -683,24 +686,24 @@ gtk_css_style_snapshot_border (GtkCssBoxes *boxes,
                                gtk_css_boxes_get_padding_rect (boxes)))
         return;
 
-      colors[0] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
-      colors[1] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR));
-      colors[2] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR));
-      colors[3] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_LEFT_COLOR));
+      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);
 
       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 (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
-      border_style[1] = _gtk_css_border_style_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE));
-      border_style[2] = _gtk_css_border_style_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE));
-      border_style[3] = _gtk_css_border_style_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_LEFT_STYLE));
+      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_width[0] = _gtk_css_number_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
-      border_width[1] = _gtk_css_number_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
-      border_width[2] = _gtk_css_number_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
-      border_width[3] = _gtk_css_number_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
+      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);
 
       gtk_snapshot_push_debug (snapshot, "CSS border");
       snapshot_border (snapshot,
@@ -716,17 +719,18 @@ void
 gtk_css_style_snapshot_outline (GtkCssBoxes *boxes,
                                 GtkSnapshot *snapshot)
 {
+  GtkCssOutlineValues *outline = boxes->style->outline;
   GtkBorderStyle border_style[4];
   float border_width[4];
   GdkRGBA colors[4];
 
-  border_style[0] = _gtk_css_border_style_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_OUTLINE_STYLE));
+  border_style[0] = _gtk_css_border_style_value_get (outline->outline_style);
   if (border_style[0] != GTK_BORDER_STYLE_NONE)
     {
       border_style[1] = border_style[2] = border_style[3] = border_style[0];
-      border_width[0] = _gtk_css_number_value_get (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_OUTLINE_WIDTH), 100);
+      border_width[0] = _gtk_css_number_value_get (outline->outline_width, 100);
       border_width[3] = border_width[2] = border_width[1] = border_width[0];
-      colors[0] = *gtk_css_color_value_get_rgba (gtk_css_style_get_value (boxes->style, 
GTK_CSS_PROPERTY_OUTLINE_COLOR));
+      colors[0] = *gtk_css_color_value_get_rgba (outline->outline_color ? outline->outline_color : 
boxes->style->core->color);
       colors[3] = colors[2] = colors[1] = colors[0];
 
       snapshot_border (snapshot,
diff --git a/gtk/gtkrendericon.c b/gtk/gtkrendericon.c
index 4844f915bd..7ba2fa83e3 100644
--- a/gtk/gtkrendericon.c
+++ b/gtk/gtkrendericon.c
@@ -38,7 +38,6 @@ gtk_css_style_snapshot_icon (GtkCssStyle            *style,
                              double                  width,
                              double                  height)
 {
-  const GtkCssValue *shadows_value, *transform_value, *filter_value;
   GskTransform *transform;
   GtkCssImage *image;
   gboolean has_shadow;
@@ -49,21 +48,17 @@ gtk_css_style_snapshot_icon (GtkCssStyle            *style,
   if (width == 0.0 || height == 0.0)
     return;
 
-  image = _gtk_css_image_value_get_image (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SOURCE));
+  image = _gtk_css_image_value_get_image (style->other->icon_source);
   if (image == NULL)
     return;
 
-  shadows_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SHADOW);
-  transform_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM);
-  filter_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_FILTER);
-
-  transform = gtk_css_transform_value_get_transform (transform_value);
+  transform = gtk_css_transform_value_get_transform (style->other->icon_transform);
 
   gtk_snapshot_push_debug (snapshot, "CSS Icon @ %gx%g", width, height);
 
-  gtk_css_filter_value_push_snapshot (filter_value, snapshot);
+  gtk_css_filter_value_push_snapshot (style->other->icon_filter, snapshot);
 
-  has_shadow = gtk_css_shadow_value_push_snapshot (shadows_value, snapshot);
+  has_shadow = gtk_css_shadow_value_push_snapshot (style->icon->icon_shadow, snapshot);
 
   if (transform == NULL)
     {
@@ -86,7 +81,7 @@ gtk_css_style_snapshot_icon (GtkCssStyle            *style,
   if (has_shadow)
     gtk_snapshot_pop (snapshot);
 
-  gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
+  gtk_css_filter_value_pop_snapshot (style->other->icon_filter, snapshot);
 
   gtk_snapshot_pop (snapshot);
 
@@ -101,7 +96,6 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle  *style,
                                        double        height,
                                        gboolean      recolor)
 {
-  const GtkCssValue *shadows_value, *transform_value, *filter_value;
   GskTransform *transform;
   gboolean has_shadow;
 
@@ -111,15 +105,11 @@ gtk_css_style_snapshot_icon_paintable (GtkCssStyle  *style,
   g_return_if_fail (width > 0);
   g_return_if_fail (height > 0);
 
-  shadows_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SHADOW);
-  transform_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_TRANSFORM);
-  filter_value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_FILTER);
-
-  transform = gtk_css_transform_value_get_transform (transform_value);
+  transform = gtk_css_transform_value_get_transform (style->other->icon_transform);
 
-  gtk_css_filter_value_push_snapshot (filter_value, snapshot);
+  gtk_css_filter_value_push_snapshot (style->other->icon_filter, snapshot);
 
-  has_shadow = gtk_css_shadow_value_push_snapshot (shadows_value, snapshot);
+  has_shadow = gtk_css_shadow_value_push_snapshot (style->icon->icon_shadow, snapshot);
 
   if (recolor)
     {
@@ -168,7 +158,7 @@ transparent:
   if (has_shadow)
     gtk_snapshot_pop (snapshot);
 
-  gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
+  gtk_css_filter_value_pop_snapshot (style->other->icon_filter, snapshot);
 
   gsk_transform_unref (transform);
 }
diff --git a/gtk/gtkroundedbox.c b/gtk/gtkroundedbox.c
index 2f447d12af..ee0c3e6339 100644
--- a/gtk/gtkroundedbox.c
+++ b/gtk/gtkroundedbox.c
@@ -127,10 +127,10 @@ gtk_rounded_boxes_init_for_style (GskRoundedRect *border_box,
 
   gsk_rounded_rect_init_from_rect (&box, &GRAPHENE_RECT_INIT (x, y, width, height), 0);
 
-  corner[GSK_CORNER_TOP_LEFT] = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS);
-  corner[GSK_CORNER_TOP_RIGHT] = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS);
-  corner[GSK_CORNER_BOTTOM_LEFT] = gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS);
-  corner[GSK_CORNER_BOTTOM_RIGHT] = gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS);
+  corner[GSK_CORNER_TOP_LEFT] = style->border->border_top_left_radius;
+  corner[GSK_CORNER_TOP_RIGHT] = style->border->border_top_right_radius;
+  corner[GSK_CORNER_BOTTOM_LEFT] = style->border->border_bottom_left_radius;
+  corner[GSK_CORNER_BOTTOM_RIGHT] = style->border->border_bottom_right_radius;
 
   _gtk_rounded_box_apply_border_radius (&box, corner);
 
@@ -140,20 +140,20 @@ gtk_rounded_boxes_init_for_style (GskRoundedRect *border_box,
   if (padding_box || content_box)
     {
       gsk_rounded_rect_shrink (&box,
-                               _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_BORDER_RIGHT_WIDTH), 100),
-                               _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100),
-                               _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100));
+                               _gtk_css_number_value_get (style->border->border_top_width, 100),
+                               _gtk_css_number_value_get (style->border->border_right_width, 100),
+                               _gtk_css_number_value_get (style->border->border_bottom_width, 100),
+                               _gtk_css_number_value_get (style->border->border_left_width, 100));
       if (padding_box)
         gsk_rounded_rect_init_copy (padding_box, &box);
 
       if (content_box)
         {
           gsk_rounded_rect_shrink (&box,
-                                   _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_PADDING_TOP), 100),
-                                   _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_PADDING_RIGHT), 100),
-                                   _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_PADDING_BOTTOM), 100),
-                                   _gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_PADDING_LEFT), 100));
+                                   _gtk_css_number_value_get (style->size->padding_top, 100),
+                                   _gtk_css_number_value_get (style->size->padding_right, 100),
+                                   _gtk_css_number_value_get (style->size->padding_bottom, 100),
+                                   _gtk_css_number_value_get (style->size->padding_left, 100));
           gsk_rounded_rect_init_copy (content_box, &box);
         }
     }
@@ -165,10 +165,10 @@ _gtk_rounded_box_apply_outline_radius_for_style (GskRoundedRect   *box,
 {
   const GtkCssValue *corner[4];
 
-  corner[GSK_CORNER_TOP_LEFT] = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_TOP_LEFT_RADIUS);
-  corner[GSK_CORNER_TOP_RIGHT] = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_TOP_RIGHT_RADIUS);
-  corner[GSK_CORNER_BOTTOM_LEFT] = gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_OUTLINE_BOTTOM_LEFT_RADIUS);
-  corner[GSK_CORNER_BOTTOM_RIGHT] = gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_OUTLINE_BOTTOM_RIGHT_RADIUS);
+  corner[GSK_CORNER_TOP_LEFT] = style->outline->outline_top_left_radius;
+  corner[GSK_CORNER_TOP_RIGHT] = style->outline->outline_top_right_radius;
+  corner[GSK_CORNER_BOTTOM_LEFT] = style->outline->outline_bottom_left_radius;
+  corner[GSK_CORNER_BOTTOM_RIGHT] = style->outline->outline_bottom_right_radius;
 
   _gtk_rounded_box_apply_border_radius (box, corner);
 }
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index ecc6642ada..83dbd2f0c6 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -83,10 +83,9 @@ fetch_request_mode (GtkWidget *widget)
 }
 
 static gint
-get_number (GtkCssStyle *style,
-            guint        property)
+get_number (GtkCssValue *value)
 {
-  double d = _gtk_css_number_value_get (gtk_css_style_get_value (style, property), 100);
+  double d = _gtk_css_number_value_get (value, 100);
 
   if (d < 1)
     return ceil (d);
@@ -96,40 +95,39 @@ get_number (GtkCssStyle *style,
 
 /* Special-case min-width|height to round upwards, to avoid underalloc by 1px */
 static int
-get_number_ceil (GtkCssStyle *style,
-                 guint        property)
+get_number_ceil (GtkCssValue *value)
 {
-  return ceil (_gtk_css_number_value_get (gtk_css_style_get_value (style, property), 100));
+  return ceil (_gtk_css_number_value_get (value, 100));
 }
 
 static void
 get_box_margin (GtkCssStyle *style,
                 GtkBorder   *margin)
 {
-  margin->top = get_number (style, GTK_CSS_PROPERTY_MARGIN_TOP);
-  margin->left = get_number (style, GTK_CSS_PROPERTY_MARGIN_LEFT);
-  margin->bottom = get_number (style, GTK_CSS_PROPERTY_MARGIN_BOTTOM);
-  margin->right = get_number (style, GTK_CSS_PROPERTY_MARGIN_RIGHT);
+  margin->top = get_number (style->size->margin_top);
+  margin->left = get_number (style->size->margin_left);
+  margin->bottom = get_number (style->size->margin_bottom);
+  margin->right = get_number (style->size->margin_right);
 }
 
 static void
 get_box_border (GtkCssStyle *style,
                 GtkBorder   *border)
 {
-  border->top = get_number (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH);
-  border->left = get_number (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH);
-  border->bottom = get_number (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH);
-  border->right = get_number (style, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH);
+  border->top = get_number (style->border->border_top_width);
+  border->left = get_number (style->border->border_left_width);
+  border->bottom = get_number (style->border->border_bottom_width);
+  border->right = get_number (style->border->border_right_width);
 }
 
 static void
 get_box_padding (GtkCssStyle *style,
                  GtkBorder   *border)
 {
-  border->top = get_number (style, GTK_CSS_PROPERTY_PADDING_TOP);
-  border->left = get_number (style, GTK_CSS_PROPERTY_PADDING_LEFT);
-  border->bottom = get_number (style, GTK_CSS_PROPERTY_PADDING_BOTTOM);
-  border->right = get_number (style, GTK_CSS_PROPERTY_PADDING_RIGHT);
+  border->top = get_number (style->size->padding_top);
+  border->left = get_number (style->size->padding_left);
+  border->bottom = get_number (style->size->padding_bottom);
+  border->right = get_number (style->size->padding_right);
 }
 
 static void
@@ -196,15 +194,15 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
         {
           css_extra_size = margin.left + margin.right + border.left + border.right + padding.left + 
padding.right;
           css_extra_for_size = margin.top + margin.bottom + border.top + border.bottom + padding.top + 
padding.bottom;
-          css_min_size = get_number_ceil (style, GTK_CSS_PROPERTY_MIN_WIDTH);
-          css_min_for_size = get_number_ceil (style, GTK_CSS_PROPERTY_MIN_HEIGHT);
+          css_min_size = get_number_ceil (style->size->min_width);
+          css_min_for_size = get_number_ceil (style->size->min_height);
         }
       else
         {
           css_extra_size = margin.top + margin.bottom + border.top + border.bottom + padding.top + 
padding.bottom;
           css_extra_for_size = margin.left + margin.right + border.left + border.right + padding.left + 
padding.right;
-          css_min_size = get_number_ceil (style, GTK_CSS_PROPERTY_MIN_HEIGHT);
-          css_min_for_size = get_number_ceil (style, GTK_CSS_PROPERTY_MIN_WIDTH);
+          css_min_size = get_number_ceil (style->size->min_height);
+          css_min_for_size = get_number_ceil (style->size->min_width);
         }
 
       GtkLayoutManager *layout_manager = gtk_widget_get_layout_manager (widget);
diff --git a/gtk/gtkspinner.c b/gtk/gtkspinner.c
index 92d6ce6b32..c117347652 100644
--- a/gtk/gtkspinner.c
+++ b/gtk/gtkspinner.c
@@ -93,17 +93,14 @@ gtk_spinner_measure (GtkWidget      *widget,
                      int            *natural_baseline)
 {
   double min_size;
-  guint property;
   GtkCssStyle *style;
 
-  if (orientation == GTK_ORIENTATION_HORIZONTAL)
-    property = GTK_CSS_PROPERTY_MIN_WIDTH;
-  else
-    property = GTK_CSS_PROPERTY_MIN_HEIGHT;
-
   style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
 
-  min_size = _gtk_css_number_value_get (gtk_css_style_get_value (style, property), 100);
+  if (orientation == GTK_ORIENTATION_HORIZONTAL)
+    min_size = _gtk_css_number_value_get (style->size->min_width, 100);
+  else
+    min_size = _gtk_css_number_value_get (style->size->min_height, 100);
 
   if (min_size > 0.0)
     *minimum = *natural = min_size;
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index ad22895e90..cd0d628942 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -1202,22 +1202,16 @@ gtk_style_context_get_border (GtkStyleContext *context,
                               GtkBorder       *border)
 {
   GtkCssStyle *style;
-  double top, left, bottom, right;
 
   g_return_if_fail (border != NULL);
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
 
   style = gtk_style_context_lookup_style (context);
 
-  top = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100));
-  right = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100));
-  bottom = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100));
-  left = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100));
-
-  border->top = top;
-  border->left = left;
-  border->bottom = bottom;
-  border->right = right;
+  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));
 }
 
 /**
@@ -1234,22 +1228,16 @@ gtk_style_context_get_padding (GtkStyleContext *context,
                                GtkBorder       *padding)
 {
   GtkCssStyle *style;
-  double top, left, bottom, right;
 
   g_return_if_fail (padding != NULL);
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
 
   style = gtk_style_context_lookup_style (context);
 
-  top = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_PADDING_TOP), 
100));
-  right = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_PADDING_RIGHT), 
100));
-  bottom = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_PADDING_BOTTOM), 100));
-  left = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_PADDING_LEFT), 
100));
-
-  padding->top = top;
-  padding->left = left;
-  padding->bottom = bottom;
-  padding->right = right;
+  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));
 }
 
 /**
@@ -1266,22 +1254,16 @@ gtk_style_context_get_margin (GtkStyleContext *context,
                               GtkBorder       *margin)
 {
   GtkCssStyle *style;
-  double top, left, bottom, right;
 
   g_return_if_fail (margin != NULL);
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
 
   style = gtk_style_context_lookup_style (context);
 
-  top = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MARGIN_TOP), 
100));
-  right = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MARGIN_RIGHT), 
100));
-  bottom = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_MARGIN_BOTTOM), 100));
-  left = round (_gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MARGIN_LEFT), 
100));
-
-  margin->top = top;
-  margin->left = left;
-  margin->bottom = bottom;
-  margin->right = right;
+  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
@@ -1289,11 +1271,15 @@ _gtk_style_context_get_cursor_color (GtkStyleContext *context,
                                      GdkRGBA         *primary_color,
                                      GdkRGBA         *secondary_color)
 {
+  GtkCssStyle *style;
+
+  style = gtk_style_context_lookup_style (context);
+
   if (primary_color)
-    *primary_color = *gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, 
GTK_CSS_PROPERTY_CARET_COLOR));
+    *primary_color = *gtk_css_color_value_get_rgba (style->font->caret_color ? style->font->caret_color : 
style->core->color);
 
   if (secondary_color)
-    *secondary_color = *gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, 
GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR));
+    *secondary_color = *gtk_css_color_value_get_rgba (style->font->secondary_caret_color ? 
style->font->secondary_caret_color : style->core->color);
 }
 
 static void
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index bc5be49127..6b95684e3c 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -131,7 +131,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 (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
+  color = gtk_css_color_value_get_rgba (style->core->color);
 
   gtk_snapshot_append_layout (snapshot, layout, color);
 
@@ -145,6 +145,7 @@ static void
 set_attributes_from_style (GtkWidget         *widget,
                            GtkTextAttributes *values)
 {
+  GtkCssStyle *style;
   GtkStyleContext *context;
   const GdkRGBA black = { 0, };
 
@@ -154,13 +155,15 @@ set_attributes_from_style (GtkWidget         *widget,
     values->appearance.fg_rgba = gdk_rgba_copy (&black);
 
   context = gtk_widget_get_style_context (widget);
-  *values->appearance.bg_rgba = *gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, 
GTK_CSS_PROPERTY_BACKGROUND_COLOR));
-  *values->appearance.fg_rgba = *gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, 
GTK_CSS_PROPERTY_COLOR));
+  style = gtk_style_context_lookup_style (context);
+
+  *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);
 
   if (values->font)
     pango_font_description_free (values->font);
 
-  values->font = gtk_css_style_get_pango_font (gtk_style_context_lookup_style (context));
+  values->font = gtk_css_style_get_pango_font (style);
 }
 
 static gint
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 40de39aae4..4b2f995207 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -2767,10 +2767,8 @@ gtk_tree_view_get_expander_size (GtkTreeView *tree_view)
   gtk_style_context_add_class (context, GTK_STYLE_CLASS_EXPANDER);
 
   style = gtk_style_context_lookup_style (context);
-  min_width = _gtk_css_number_value_get
-    (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MIN_WIDTH), 100);
-  min_height = _gtk_css_number_value_get
-    (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_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);
 
@@ -5602,8 +5600,7 @@ get_separator_height (GtkTreeView *tree_view)
   gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
 
   style = gtk_style_context_lookup_style (context);
-  d = _gtk_css_number_value_get
-    (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MIN_HEIGHT), 100);
+  d = _gtk_css_number_value_get (style->size->min_height, 100);
 
   if (d < 1)
     min_size = ceil (d);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index ba4f4b461c..c1a36fbd02 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3810,10 +3810,9 @@ gtk_widget_get_frame_clock (GtkWidget *widget)
 }
 
 static gint
-get_number (GtkCssStyle *style,
-            guint        property)
+get_number (GtkCssValue *value)
 {
-  double d = _gtk_css_number_value_get (gtk_css_style_get_value (style, property), 100);
+  double d = _gtk_css_number_value_get (value, 100);
 
   if (d < 1)
     return ceil (d);
@@ -3825,30 +3824,30 @@ static void
 get_box_margin (GtkCssStyle *style,
                 GtkBorder   *margin)
 {
-  margin->top = get_number (style, GTK_CSS_PROPERTY_MARGIN_TOP);
-  margin->left = get_number (style, GTK_CSS_PROPERTY_MARGIN_LEFT);
-  margin->bottom = get_number (style, GTK_CSS_PROPERTY_MARGIN_BOTTOM);
-  margin->right = get_number (style, GTK_CSS_PROPERTY_MARGIN_RIGHT);
+  margin->top = get_number (style->size->margin_top);
+  margin->left = get_number (style->size->margin_left);
+  margin->bottom = get_number (style->size->margin_bottom);
+  margin->right = get_number (style->size->margin_right);
 }
 
 static void
 get_box_border (GtkCssStyle *style,
                 GtkBorder   *border)
 {
-  border->top = get_number (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH);
-  border->left = get_number (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH);
-  border->bottom = get_number (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH);
-  border->right = get_number (style, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH);
+  border->top = get_number (style->border->border_top_width);
+  border->left = get_number (style->border->border_left_width);
+  border->bottom = get_number (style->border->border_bottom_width);
+  border->right = get_number (style->border->border_right_width);
 }
 
 static void
 get_box_padding (GtkCssStyle *style,
                  GtkBorder   *border)
 {
-  border->top = get_number (style, GTK_CSS_PROPERTY_PADDING_TOP);
-  border->left = get_number (style, GTK_CSS_PROPERTY_PADDING_LEFT);
-  border->bottom = get_number (style, GTK_CSS_PROPERTY_PADDING_BOTTOM);
-  border->right = get_number (style, GTK_CSS_PROPERTY_PADDING_RIGHT);
+  border->top = get_number (style->size->padding_top);
+  border->left = get_number (style->size->padding_left);
+  border->bottom = get_number (style->size->padding_bottom);
+  border->right = get_number (style->size->padding_right);
 }
 
 /**
@@ -4034,7 +4033,7 @@ gtk_widget_allocate (GtkWidget    *widget,
   adjusted.y += margin.top;
   adjusted.width -= margin.left + margin.right;
   adjusted.height -= margin.top + margin.bottom;
-  css_transform = gtk_css_transform_value_get_transform (gtk_css_style_get_value (style, 
GTK_CSS_PROPERTY_TRANSFORM));
+  css_transform = gtk_css_transform_value_get_transform (style->other->transform);
 
   if (css_transform)
     {
@@ -6588,9 +6587,7 @@ update_pango_context (GtkWidget    *widget,
                              _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR ?
                              PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL);
 
-  pango_cairo_context_set_resolution (context,
-                                      _gtk_css_number_value_get (
-                                          gtk_css_style_get_value (style, GTK_CSS_PROPERTY_DPI), 100));
+  pango_cairo_context_set_resolution (context, _gtk_css_number_value_get (style->core->dpi, 100));
 
   settings = gtk_widget_get_settings (widget);
   font_options = (cairo_font_options_t*)g_object_get_qdata (G_OBJECT (widget), quark_font_options);
@@ -10829,15 +10826,15 @@ static void
 gtk_widget_update_alpha (GtkWidget *widget)
 {
   GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
+  GtkCssStyle *style;
   gdouble opacity;
   guint8 alpha;
 
-  opacity = _gtk_css_number_value_get (gtk_css_style_get_value (gtk_css_node_get_style (priv->cssnode),
-                                                                GTK_CSS_PROPERTY_OPACITY),
-                                       100);
-
+  style = gtk_css_node_get_style (priv->cssnode);
 
+  opacity = _gtk_css_number_value_get (style->other->opacity, 100);
   opacity = CLAMP (opacity, 0.0, 1.0);
+
   alpha = round (priv->user_alpha * opacity);
 
   if (alpha == priv->alpha)
@@ -12165,7 +12162,7 @@ gtk_widget_create_render_node (GtkWidget   *widget,
                            "RenderNode for %s %p",
                            G_OBJECT_TYPE_NAME (widget), widget);
 
-  filter_value = gtk_css_style_get_value (gtk_css_node_get_style (priv->cssnode), GTK_CSS_PROPERTY_FILTER);
+  filter_value = gtk_css_node_get_style (priv->cssnode)->other->filter;
   if (filter_value)
     gtk_css_filter_value_push_snapshot (filter_value, snapshot);
 
diff --git a/gtk/inspector/layoutoverlay.c b/gtk/inspector/layoutoverlay.c
index f3653a2844..f1afa20acb 100644
--- a/gtk/inspector/layoutoverlay.c
+++ b/gtk/inspector/layoutoverlay.c
@@ -20,10 +20,9 @@ G_DEFINE_TYPE (GtkLayoutOverlay, gtk_layout_overlay, GTK_TYPE_INSPECTOR_OVERLAY)
 
 
 static gint
-get_number (GtkCssStyle *style,
-            guint        property)
+get_number (GtkCssValue *value)
 {
-  double d = _gtk_css_number_value_get (gtk_css_style_get_value (style, property), 100);
+  double d = _gtk_css_number_value_get (value, 100);
 
   if (d < 1)
     return ceil (d);
@@ -35,30 +34,30 @@ static void
 get_box_margin (GtkCssStyle *style,
                 GtkBorder   *margin)
 {
-  margin->top = get_number (style, GTK_CSS_PROPERTY_MARGIN_TOP);
-  margin->left = get_number (style, GTK_CSS_PROPERTY_MARGIN_LEFT);
-  margin->bottom = get_number (style, GTK_CSS_PROPERTY_MARGIN_BOTTOM);
-  margin->right = get_number (style, GTK_CSS_PROPERTY_MARGIN_RIGHT);
+  margin->top = get_number (style->size->margin_top);
+  margin->left = get_number (style->size->margin_left);
+  margin->bottom = get_number (style->size->margin_bottom);
+  margin->right = get_number (style->size->margin_right);
 }
 
 static void
 get_box_border (GtkCssStyle *style,
                 GtkBorder   *border)
 {
-  border->top = get_number (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH);
-  border->left = get_number (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH);
-  border->bottom = get_number (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH);
-  border->right = get_number (style, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH);
+  border->top = get_number (style->border->border_top_width);
+  border->left = get_number (style->border->border_left_width);
+  border->bottom = get_number (style->border->border_bottom_width);
+  border->right = get_number (style->border->border_right_width);
 }
 
 static void
 get_box_padding (GtkCssStyle *style,
                  GtkBorder   *border)
 {
-  border->top = get_number (style, GTK_CSS_PROPERTY_PADDING_TOP);
-  border->left = get_number (style, GTK_CSS_PROPERTY_PADDING_LEFT);
-  border->bottom = get_number (style, GTK_CSS_PROPERTY_PADDING_BOTTOM);
-  border->right = get_number (style, GTK_CSS_PROPERTY_PADDING_RIGHT);
+  border->top = get_number (style->size->padding_top);
+  border->left = get_number (style->size->padding_left);
+  border->bottom = get_number (style->size->padding_bottom);
+  border->right = get_number (style->size->padding_right);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]