[gtk/wip/otte/css: 297/307] cssvalue: Pass a "root" widget to compute()



commit 3b23cfa8fb059e5a56702d67bec8e6ad3e192da1
Author: Benjamin Otte <otte redhat com>
Date:   Sun Feb 9 16:07:57 2020 +0100

    cssvalue: Pass a "root" widget to compute()
    
    This widget is meant to be the GtkRoot that manages the display and
    settings that provide default and viewport-relevant values for the CSS
    engine (like scale factor, icon theme or all the stuff we might ever
    expose for @media).
    
    For now, this is just the plumbing. We always pass %NULL.

 gtk/gtkcssanimatedstyle.c        |   6 +-
 gtk/gtkcssanimatedstyleprivate.h |   1 +
 gtk/gtkcssarrayvalue.c           |   3 +-
 gtk/gtkcssbgsizevalue.c          |   5 +-
 gtk/gtkcssbordervalue.c          |   3 +-
 gtk/gtkcsscalcvalue.c            |   3 +-
 gtk/gtkcsscolorvalue.c           |  61 +++++++-------
 gtk/gtkcsscolorvalueprivate.h    |   3 +-
 gtk/gtkcsscornervalue.c          |   5 +-
 gtk/gtkcssdimensionvalue.c       |  19 ++---
 gtk/gtkcsseasevalue.c            |   1 +
 gtk/gtkcssenumvalue.c            |  33 ++++----
 gtk/gtkcssenumvalueprivate.h     |   2 +-
 gtk/gtkcssfiltervalue.c          |  21 ++---
 gtk/gtkcssfontfeaturesvalue.c    |   1 +
 gtk/gtkcssfontvariationsvalue.c  |   1 +
 gtk/gtkcssiconthemevalue.c       |   1 +
 gtk/gtkcssimage.c                |  14 ++--
 gtk/gtkcssimagecrossfade.c       |   3 +-
 gtk/gtkcssimagefallback.c        |  23 +++---
 gtk/gtkcssimageicontheme.c       |   1 +
 gtk/gtkcssimagelinear.c          |   7 +-
 gtk/gtkcssimagepaintable.c       |   1 +
 gtk/gtkcssimageprivate.h         |   4 +-
 gtk/gtkcssimageradial.c          |  11 +--
 gtk/gtkcssimagerecolor.c         |   3 +-
 gtk/gtkcssimagescaled.c          |  12 +--
 gtk/gtkcssimageurl.c             |   1 +
 gtk/gtkcssimagevalue.c           |   3 +-
 gtk/gtkcssinheritvalue.c         |  12 +--
 gtk/gtkcssinitialvalue.c         |  23 +++---
 gtk/gtkcssinitialvalueprivate.h  |   3 +-
 gtk/gtkcsskeyframes.c            |  20 ++---
 gtk/gtkcsskeyframesprivate.h     |   9 ++-
 gtk/gtkcssnode.c                 |   7 ++
 gtk/gtkcssnodeprivate.h          |  11 +--
 gtk/gtkcsspalettevalue.c         |   3 +-
 gtk/gtkcsspositionvalue.c        |   5 +-
 gtk/gtkcssrepeatvalue.c          |   1 +
 gtk/gtkcssshadowvalue.c          |  11 +--
 gtk/gtkcssstaticstyle.c          | 170 ++++++++++++++++++++-------------------
 gtk/gtkcssstringvalue.c          |   1 +
 gtk/gtkcsstransformvalue.c       |  33 ++++----
 gtk/gtkcssunsetvalue.c           |  12 +--
 gtk/gtkcssvalue.c                |  18 +++--
 gtk/gtkcssvalueprivate.h         |   6 +-
 gtk/gtkstylecontext.c            |   9 ++-
 47 files changed, 346 insertions(+), 260 deletions(-)
---
diff --git a/gtk/gtkcssanimatedstyle.c b/gtk/gtkcssanimatedstyle.c
index 15745f9b9e..d1d3267be5 100644
--- a/gtk/gtkcssanimatedstyle.c
+++ b/gtk/gtkcssanimatedstyle.c
@@ -765,6 +765,7 @@ gtk_css_animated_style_create_css_animations (GPtrArray        *animations,
                                               GtkCssStyle      *parent_style,
                                               gint64            timestamp,
                                               GtkStyleProvider *provider,
+                                              GtkWidget        *root,
                                               GtkCssStyle      *source)
 {
   GtkCssValue *durations, *delays, *timing_functions, *animation_names;
@@ -813,7 +814,7 @@ gtk_css_animated_style_create_css_animations (GPtrArray        *animations,
           if (keyframes == NULL)
             continue;
 
-          keyframes = _gtk_css_keyframes_compute (keyframes, provider, base_style, parent_style);
+          keyframes = gtk_css_keyframes_compute (keyframes, provider, root, base_style, parent_style);
 
           animation = _gtk_css_animation_new (name,
                                               keyframes,
@@ -857,6 +858,7 @@ gtk_css_animated_style_new (GtkCssStyle      *base_style,
                             GtkCssStyle      *parent_style,
                             gint64            timestamp,
                             GtkStyleProvider *provider,
+                            GtkWidget        *root,
                             GtkCssStyle      *previous_style)
 {
   GtkCssAnimatedStyle *result;
@@ -874,7 +876,7 @@ gtk_css_animated_style_new (GtkCssStyle      *base_style,
   if (previous_style != NULL)
     animations = gtk_css_animated_style_create_css_transitions (animations, base_style, timestamp, 
previous_style);
 
-  animations = gtk_css_animated_style_create_css_animations (animations, base_style, parent_style, 
timestamp, provider, previous_style);
+  animations = gtk_css_animated_style_create_css_animations (animations, base_style, parent_style, 
timestamp, provider, root, previous_style);
   animations = gtk_css_animated_style_create_dynamic (animations, base_style, timestamp);
 
   if (animations == NULL)
diff --git a/gtk/gtkcssanimatedstyleprivate.h b/gtk/gtkcssanimatedstyleprivate.h
index 90e1af83bf..96910c537f 100644
--- a/gtk/gtkcssanimatedstyleprivate.h
+++ b/gtk/gtkcssanimatedstyleprivate.h
@@ -56,6 +56,7 @@ GtkCssStyle *           gtk_css_animated_style_new              (GtkCssStyle
                                                                  GtkCssStyle            *parent_style,
                                                                  gint64                  timestamp,
                                                                  GtkStyleProvider       *provider,
+                                                                 GtkWidget              *root,
                                                                  GtkCssStyle            *previous_style);
 GtkCssStyle *           gtk_css_animated_style_new_advance      (GtkCssAnimatedStyle    *source,
                                                                  GtkCssStyle            *base,
diff --git a/gtk/gtkcssarrayvalue.c b/gtk/gtkcssarrayvalue.c
index 28bea64088..fadfe9e1f5 100644
--- a/gtk/gtkcssarrayvalue.c
+++ b/gtk/gtkcssarrayvalue.c
@@ -46,6 +46,7 @@ static GtkCssValue *
 gtk_css_value_array_compute (GtkCssValue      *value,
                              guint             property_id,
                              GtkStyleProvider *provider,
+                             GtkWidget        *root,
                              GtkCssStyle      *style,
                              GtkCssStyle      *parent_style)
 {
@@ -56,7 +57,7 @@ gtk_css_value_array_compute (GtkCssValue      *value,
   result = NULL;
   for (i = 0; i < value->n_values; i++)
     {
-      i_value =  _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
+      i_value =  gtk_css_value_compute (value->values[i], property_id, provider, root, style, parent_style);
 
       if (result == NULL &&
          i_value != value->values[i])
diff --git a/gtk/gtkcssbgsizevalue.c b/gtk/gtkcssbgsizevalue.c
index eb54840016..b941cbef32 100644
--- a/gtk/gtkcssbgsizevalue.c
+++ b/gtk/gtkcssbgsizevalue.c
@@ -44,6 +44,7 @@ static GtkCssValue *
 gtk_css_value_bg_size_compute (GtkCssValue      *value,
                                guint             property_id,
                                GtkStyleProvider *provider,
+                               GtkWidget        *root,
                                GtkCssStyle      *style,
                                GtkCssStyle      *parent_style)
 {
@@ -55,10 +56,10 @@ gtk_css_value_bg_size_compute (GtkCssValue      *value,
   x = y = NULL;
 
   if (value->x)
-    x = _gtk_css_value_compute (value->x, property_id, provider, style, parent_style);
+    x = gtk_css_value_compute (value->x, property_id, provider, root, style, parent_style);
 
   if (value->y)
-    y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style);
+    y = gtk_css_value_compute (value->y, property_id, provider, root, style, parent_style);
 
   if (x == value->x && y == value->y)
     {
diff --git a/gtk/gtkcssbordervalue.c b/gtk/gtkcssbordervalue.c
index 7e5c32b86b..c5555d3234 100644
--- a/gtk/gtkcssbordervalue.c
+++ b/gtk/gtkcssbordervalue.c
@@ -45,6 +45,7 @@ static GtkCssValue *
 gtk_css_value_border_compute (GtkCssValue      *value,
                               guint             property_id,
                               GtkStyleProvider *provider,
+                              GtkWidget        *root,
                               GtkCssStyle      *style,
                               GtkCssStyle      *parent_style)
 {
@@ -57,7 +58,7 @@ gtk_css_value_border_compute (GtkCssValue      *value,
     {
       if (value->values[i])
         {
-          values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
+          values[i] = gtk_css_value_compute (value->values[i], property_id, provider, root, style, 
parent_style);
           changed |= (values[i] != value->values[i]);
         }
       else
diff --git a/gtk/gtkcsscalcvalue.c b/gtk/gtkcsscalcvalue.c
index 55fb47a43e..830fd3489f 100644
--- a/gtk/gtkcsscalcvalue.c
+++ b/gtk/gtkcsscalcvalue.c
@@ -101,6 +101,7 @@ static GtkCssValue *
 gtk_css_value_calc_compute (GtkCssValue      *value,
                             guint             property_id,
                             GtkStyleProvider *provider,
+                            GtkWidget        *root,
                             GtkCssStyle      *style,
                             GtkCssStyle      *parent_style)
 {
@@ -112,7 +113,7 @@ gtk_css_value_calc_compute (GtkCssValue      *value,
   array = g_ptr_array_new ();
   for (i = 0; i < value->n_terms; i++)
     {
-      GtkCssValue *computed = _gtk_css_value_compute (value->terms[i], property_id, provider, style, 
parent_style);
+      GtkCssValue *computed = gtk_css_value_compute (value->terms[i], property_id, provider, root, style, 
parent_style);
       changed |= computed != value->terms[i];
       gtk_css_calc_array_add (array, computed);
     }
diff --git a/gtk/gtkcsscolorvalue.c b/gtk/gtkcsscolorvalue.c
index cd80e2db2f..6e7939b58b 100644
--- a/gtk/gtkcsscolorvalue.c
+++ b/gtk/gtkcsscolorvalue.c
@@ -94,6 +94,7 @@ gtk_css_value_color_free (GtkCssValue *color)
 static GtkCssValue *
 gtk_css_value_color_get_fallback (guint             property_id,
                                   GtkStyleProvider *provider,
+                                  GtkWidget        *root,
                                   GtkCssStyle      *style,
                                   GtkCssStyle      *parent_style)
 {
@@ -114,11 +115,12 @@ gtk_css_value_color_get_fallback (guint             property_id,
       case GTK_CSS_PROPERTY_OUTLINE_COLOR:
       case GTK_CSS_PROPERTY_CARET_COLOR:
       case GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR:
-        return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value 
(_gtk_css_style_property_lookup_by_id (property_id)),
-                                       property_id,
-                                       provider,
-                                       style,
-                                       parent_style);
+        return gtk_css_value_compute (_gtk_css_style_property_get_initial_value 
(_gtk_css_style_property_lookup_by_id (property_id)),
+                                      property_id,
+                                      provider,
+                                      root,
+                                      style,
+                                      parent_style);
       case GTK_CSS_PROPERTY_ICON_PALETTE:
         return _gtk_css_value_ref (style->core->color);
       default:
@@ -133,6 +135,7 @@ static GtkCssValue *
 gtk_css_value_color_compute (GtkCssValue      *value,
                              guint             property_id,
                              GtkStyleProvider *provider,
+                             GtkWidget        *root,
                              GtkCssStyle      *style,
                              GtkCssStyle      *parent_style)
 {
@@ -151,10 +154,11 @@ gtk_css_value_color_compute (GtkCssValue      *value,
       else
         current = NULL;
 
-      resolved = _gtk_css_color_value_resolve (value,
-                                               provider,
-                                               current,
-                                               NULL);
+      resolved = gtk_css_color_value_resolve (value,
+                                              provider,
+                                              root,
+                                              current,
+                                              NULL);
     }
   else if (value->type == COLOR_TYPE_LITERAL)
     {
@@ -164,14 +168,15 @@ gtk_css_value_color_compute (GtkCssValue      *value,
     {
       GtkCssValue *current = style->core->color;
 
-      resolved = _gtk_css_color_value_resolve (value,
-                                               provider,
-                                               current,
-                                               NULL);
+      resolved = gtk_css_color_value_resolve (value,
+                                              provider,
+                                              root,
+                                              current,
+                                              NULL);
     }
 
   if (resolved == NULL)
-    return gtk_css_value_color_get_fallback (property_id, provider, style, parent_style);
+    return gtk_css_value_color_get_fallback (property_id, provider, root, style, parent_style);
 
   return resolved;
 }
@@ -346,10 +351,11 @@ apply_mix (const GdkRGBA *in1,
 }
 
 GtkCssValue *
-_gtk_css_color_value_resolve (GtkCssValue      *color,
-                              GtkStyleProvider *provider,
-                              GtkCssValue      *current,
-                              GSList           *cycle_list)
+gtk_css_color_value_resolve (GtkCssValue      *color,
+                             GtkStyleProvider *provider,
+                             GtkWidget        *root,
+                             GtkCssValue      *current,
+                             GSList           *cycle_list)
 {
   GtkCssValue *value;
 
@@ -373,7 +379,7 @@ _gtk_css_color_value_resolve (GtkCssValue      *color,
        if (named == NULL)
          return NULL;
 
-        value = _gtk_css_color_value_resolve (named, provider, current, &cycle);
+        value = gtk_css_color_value_resolve (named, provider, root, current, &cycle);
        if (value == NULL)
          return NULL;
       }
@@ -385,7 +391,7 @@ _gtk_css_color_value_resolve (GtkCssValue      *color,
         GtkCssValue *val;
         GdkRGBA shade;
 
-        val = _gtk_css_color_value_resolve (color->sym_col.shade.color, provider, current, cycle_list);
+        val = gtk_css_color_value_resolve (color->sym_col.shade.color, provider, root, current, cycle_list);
         if (val == NULL)
           return NULL;
         c = gtk_css_color_value_get_rgba (val);
@@ -403,7 +409,7 @@ _gtk_css_color_value_resolve (GtkCssValue      *color,
         GtkCssValue *val;
         GdkRGBA alpha;
 
-        val = _gtk_css_color_value_resolve (color->sym_col.alpha.color, provider, current, cycle_list);
+        val = gtk_css_color_value_resolve (color->sym_col.alpha.color, provider, root, current, cycle_list);
         if (val == NULL)
           return NULL;
         c = gtk_css_color_value_get_rgba (val);
@@ -421,12 +427,12 @@ _gtk_css_color_value_resolve (GtkCssValue      *color,
         GtkCssValue *val1, *val2;
         GdkRGBA res;
 
-        val1 = _gtk_css_color_value_resolve (color->sym_col.mix.color1, provider, current, cycle_list);
+        val1 = gtk_css_color_value_resolve (color->sym_col.mix.color1, provider, root, current, cycle_list);
         if (val1 == NULL)
           return NULL;
         color1 = gtk_css_color_value_get_rgba (val1);
 
-        val2 = _gtk_css_color_value_resolve (color->sym_col.mix.color2, provider, current, cycle_list);
+        val2 = gtk_css_color_value_resolve (color->sym_col.mix.color2, provider, root, current, cycle_list);
         if (val2 == NULL)
           return NULL;
         color2 = gtk_css_color_value_get_rgba (val2);
@@ -450,10 +456,11 @@ _gtk_css_color_value_resolve (GtkCssValue      *color,
 
           if (initial->class == &GTK_CSS_VALUE_COLOR)
             {
-              return _gtk_css_color_value_resolve (initial,
-                                                   provider,
-                                                   NULL,
-                                                   cycle_list);
+              return gtk_css_color_value_resolve (initial,
+                                                  provider,
+                                                  root,
+                                                  NULL,
+                                                  cycle_list);
             }
           else
             {
diff --git a/gtk/gtkcsscolorvalueprivate.h b/gtk/gtkcsscolorvalueprivate.h
index 15c6a0055e..33e05e88e9 100644
--- a/gtk/gtkcsscolorvalueprivate.h
+++ b/gtk/gtkcsscolorvalueprivate.h
@@ -40,8 +40,9 @@ GtkCssValue *   _gtk_css_color_value_new_current_color  (void) G_GNUC_PURE;
 gboolean        gtk_css_color_value_can_parse           (GtkCssParser   *parser);
 GtkCssValue *   _gtk_css_color_value_parse              (GtkCssParser   *parser);
 
-GtkCssValue *   _gtk_css_color_value_resolve            (GtkCssValue      *color,
+GtkCssValue *   gtk_css_color_value_resolve             (GtkCssValue      *color,
                                                          GtkStyleProvider *provider,
+                                                         GtkWidget        *root,
                                                          GtkCssValue      *current,
                                                          GSList           *cycle_list);
 const GdkRGBA * gtk_css_color_value_get_rgba            (const GtkCssValue *color) G_GNUC_CONST;
diff --git a/gtk/gtkcsscornervalue.c b/gtk/gtkcsscornervalue.c
index b25e6a6fef..06b1992da8 100644
--- a/gtk/gtkcsscornervalue.c
+++ b/gtk/gtkcsscornervalue.c
@@ -40,13 +40,14 @@ static GtkCssValue *
 gtk_css_value_corner_compute (GtkCssValue      *corner,
                               guint             property_id,
                               GtkStyleProvider *provider,
+                              GtkWidget        *root,
                               GtkCssStyle      *style,
                               GtkCssStyle      *parent_style)
 {
   GtkCssValue *x, *y;
 
-  x = _gtk_css_value_compute (corner->x, property_id, provider, style, parent_style);
-  y = _gtk_css_value_compute (corner->y, property_id, provider, style, parent_style);
+  x = gtk_css_value_compute (corner->x, property_id, provider, root, style, parent_style);
+  y = gtk_css_value_compute (corner->y, property_id, provider, root, style, parent_style);
   if (x == corner->x && y == corner->y)
     {
       _gtk_css_value_unref (x);
diff --git a/gtk/gtkcssdimensionvalue.c b/gtk/gtkcssdimensionvalue.c
index b54309d079..6c50114923 100644
--- a/gtk/gtkcssdimensionvalue.c
+++ b/gtk/gtkcssdimensionvalue.c
@@ -37,17 +37,17 @@ gtk_css_value_dimension_free (GtkCssValue *value)
 }
 
 static double
-get_base_font_size_px (guint             property_id,
-                       GtkStyleProvider *provider,
-                       GtkCssStyle      *style,
-                       GtkCssStyle      *parent_style)
+get_base_font_size_px (guint        property_id,
+                       GtkWidget   *root,
+                       GtkCssStyle *style,
+                       GtkCssStyle *parent_style)
 {
   if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
     {
       if (parent_style)
         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_font_size_get_default_px (root, style);
     }
 
   return _gtk_css_number_value_get (style->core->font_size, 100);
@@ -63,6 +63,7 @@ static GtkCssValue *
 gtk_css_value_dimension_compute (GtkCssValue      *number,
                                  guint             property_id,
                                  GtkStyleProvider *provider,
+                                 GtkWidget        *root,
                                  GtkCssStyle      *style,
                                  GtkCssStyle      *parent_style)
 {
@@ -75,7 +76,7 @@ gtk_css_value_dimension_compute (GtkCssValue      *number,
       /* percentages for font sizes are computed, other percentages aren't */
       if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
         return gtk_css_dimension_value_new (number->value / 100.0 * 
-                                            get_base_font_size_px (property_id, provider, style, 
parent_style),
+                                            get_base_font_size_px (property_id, root, style, parent_style),
                                             GTK_CSS_PX);
       G_GNUC_FALLTHROUGH;
     case GTK_CSS_NUMBER:
@@ -100,16 +101,16 @@ gtk_css_value_dimension_compute (GtkCssValue      *number,
                                           GTK_CSS_PX);
     case GTK_CSS_EM:
       return gtk_css_dimension_value_new (number->value *
-                                          get_base_font_size_px (property_id, provider, style, parent_style),
+                                          get_base_font_size_px (property_id, root, style, parent_style),
                                           GTK_CSS_PX);
     case GTK_CSS_EX:
       /* for now we pretend ex is half of em */
       return gtk_css_dimension_value_new (number->value * 0.5 *
-                                          get_base_font_size_px (property_id, provider, style, parent_style),
+                                          get_base_font_size_px (property_id, root, style, parent_style),
                                           GTK_CSS_PX);
     case GTK_CSS_REM:
       return gtk_css_dimension_value_new (number->value *
-                                          gtk_css_font_size_get_default_px (provider, style),
+                                          gtk_css_font_size_get_default_px (root, style),
                                           GTK_CSS_PX);
     case GTK_CSS_RAD:
       return gtk_css_dimension_value_new (number->value * 360.0 / (2 * G_PI),
diff --git a/gtk/gtkcsseasevalue.c b/gtk/gtkcsseasevalue.c
index 5ea1c6285d..9495d83d20 100644
--- a/gtk/gtkcsseasevalue.c
+++ b/gtk/gtkcsseasevalue.c
@@ -53,6 +53,7 @@ static GtkCssValue *
 gtk_css_value_ease_compute (GtkCssValue      *value,
                             guint             property_id,
                             GtkStyleProvider *provider,
+                            GtkWidget        *root,
                             GtkCssStyle      *style,
                             GtkCssStyle      *parent_style)
 {
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index 82d5580773..d72ac1b06d 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -19,10 +19,10 @@
 
 #include "gtkcssenumvalueprivate.h"
 
-#include "gtkcssstyleprivate.h"
 #include "gtkcssnumbervalueprivate.h"
-#include "gtkstyleproviderprivate.h"
+#include "gtkcssstyleprivate.h"
 #include "gtksettingsprivate.h"
+#include "gtkwidget.h"
 
 #ifdef _MSC_VER
 # include <intrin.h>
@@ -46,6 +46,7 @@ static GtkCssValue *
 gtk_css_value_enum_compute (GtkCssValue      *value,
                             guint             property_id,
                             GtkStyleProvider *provider,
+                            GtkWidget        *root,
                             GtkCssStyle      *style,
                             GtkCssStyle      *parent_style)
 {
@@ -211,16 +212,16 @@ get_dpi (GtkCssStyle *style)
 #define DEFAULT_FONT_SIZE_PT 10
 
 double
-gtk_css_font_size_get_default_px (GtkStyleProvider *provider,
-                                  GtkCssStyle      *style)
+gtk_css_font_size_get_default_px (GtkWidget   *root,
+                                  GtkCssStyle *style)
 {
   GtkSettings *settings;
   int font_size;
 
-  settings = gtk_style_provider_get_settings (provider);
-  if (settings == NULL)
+  if (root == NULL)
     return DEFAULT_FONT_SIZE_PT * get_dpi (style) / 72.0;
 
+  settings = gtk_widget_get_settings (root);
   font_size = gtk_settings_get_font_size (settings);
   if (font_size == 0)
     return DEFAULT_FONT_SIZE_PT * get_dpi (style) / 72.0;
@@ -234,6 +235,7 @@ static GtkCssValue *
 gtk_css_value_font_size_compute (GtkCssValue      *value,
                                  guint             property_id,
                                  GtkStyleProvider *provider,
+                                 GtkWidget        *root,
                                  GtkCssStyle      *style,
                                  GtkCssStyle      *parent_style)
 {
@@ -242,34 +244,34 @@ gtk_css_value_font_size_compute (GtkCssValue      *value,
   switch (value->value)
     {
     case GTK_CSS_FONT_SIZE_XX_SMALL:
-      font_size = gtk_css_font_size_get_default_px (provider, style) * 3. / 5;
+      font_size = gtk_css_font_size_get_default_px (root, style) * 3. / 5;
       break;
     case GTK_CSS_FONT_SIZE_X_SMALL:
-      font_size = gtk_css_font_size_get_default_px (provider, style) * 3. / 4;
+      font_size = gtk_css_font_size_get_default_px (root, style) * 3. / 4;
       break;
     case GTK_CSS_FONT_SIZE_SMALL:
-      font_size = gtk_css_font_size_get_default_px (provider, style) * 8. / 9;
+      font_size = gtk_css_font_size_get_default_px (root, style) * 8. / 9;
       break;
     default:
       g_assert_not_reached ();
       /* fall thru */
     case GTK_CSS_FONT_SIZE_MEDIUM:
-      font_size = gtk_css_font_size_get_default_px (provider, style);
+      font_size = gtk_css_font_size_get_default_px (root, style);
       break;
     case GTK_CSS_FONT_SIZE_LARGE:
-      font_size = gtk_css_font_size_get_default_px (provider, style) * 6. / 5;
+      font_size = gtk_css_font_size_get_default_px (root, style) * 6. / 5;
       break;
     case GTK_CSS_FONT_SIZE_X_LARGE:
-      font_size = gtk_css_font_size_get_default_px (provider, style) * 3. / 2;
+      font_size = gtk_css_font_size_get_default_px (root, style) * 3. / 2;
       break;
     case GTK_CSS_FONT_SIZE_XX_LARGE:
-      font_size = gtk_css_font_size_get_default_px (provider, style) * 2;
+      font_size = gtk_css_font_size_get_default_px (root, style) * 2;
       break;
     case GTK_CSS_FONT_SIZE_SMALLER:
       if (parent_style)
         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);
+        font_size = gtk_css_font_size_get_default_px (root, style);
       /* XXX: This is what WebKit does... */
       font_size /= 1.2;
       break;
@@ -277,7 +279,7 @@ gtk_css_value_font_size_compute (GtkCssValue      *value,
       if (parent_style)
         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);
+        font_size = gtk_css_font_size_get_default_px (root, style);
       /* XXX: This is what WebKit does... */
       font_size *= 1.2;
       break;
@@ -401,6 +403,7 @@ static GtkCssValue *
 gtk_css_value_font_weight_compute (GtkCssValue      *value,
                                    guint             property_id,
                                    GtkStyleProvider *provider,
+                                   GtkWidget        *root,
                                    GtkCssStyle      *style,
                                    GtkCssStyle      *parent_style)
 {
diff --git a/gtk/gtkcssenumvalueprivate.h b/gtk/gtkcssenumvalueprivate.h
index 22bab5f1f4..fc43417013 100644
--- a/gtk/gtkcssenumvalueprivate.h
+++ b/gtk/gtkcssenumvalueprivate.h
@@ -38,7 +38,7 @@ GtkBorderStyle  _gtk_css_border_style_value_get       (const GtkCssValue *value)
 GtkCssValue *   _gtk_css_font_size_value_new          (GtkCssFontSize     size);
 GtkCssValue *   _gtk_css_font_size_value_try_parse    (GtkCssParser      *parser);
 GtkCssFontSize  _gtk_css_font_size_value_get          (const GtkCssValue *value);
-double          gtk_css_font_size_get_default_px      (GtkStyleProvider  *provider,
+double          gtk_css_font_size_get_default_px      (GtkWidget         *root,
                                                        GtkCssStyle       *style);
 
 GtkCssValue *   _gtk_css_font_style_value_new         (PangoStyle         style);
diff --git a/gtk/gtkcssfiltervalue.c b/gtk/gtkcssfiltervalue.c
index 453803000e..7702652444 100644
--- a/gtk/gtkcssfiltervalue.c
+++ b/gtk/gtkcssfiltervalue.c
@@ -304,6 +304,7 @@ gtk_css_filter_compute (GtkCssFilter     *dest,
                         GtkCssFilter     *src,
                         guint             property_id,
                         GtkStyleProvider *provider,
+                        GtkWidget        *root,
                         GtkCssStyle      *style,
                         GtkCssStyle      *parent_style)
 {
@@ -312,39 +313,39 @@ gtk_css_filter_compute (GtkCssFilter     *dest,
   switch (src->type)
     {
     case GTK_CSS_FILTER_BRIGHTNESS:
-      dest->brightness.value = _gtk_css_value_compute (src->brightness.value, property_id, provider, style, 
parent_style);
+      dest->brightness.value = gtk_css_value_compute (src->brightness.value, property_id, provider, root, 
style, parent_style);
       return dest->brightness.value == src->brightness.value;
 
     case GTK_CSS_FILTER_CONTRAST:
-      dest->contrast.value = _gtk_css_value_compute (src->contrast.value, property_id, provider, style, 
parent_style);
+      dest->contrast.value = gtk_css_value_compute (src->contrast.value, property_id, provider, root, style, 
parent_style);
       return dest->contrast.value == src->contrast.value;
 
     case GTK_CSS_FILTER_GRAYSCALE:
-      dest->grayscale.value = _gtk_css_value_compute (src->grayscale.value, property_id, provider, style, 
parent_style);
+      dest->grayscale.value = gtk_css_value_compute (src->grayscale.value, property_id, provider, root, 
style, parent_style);
       return dest->grayscale.value == src->grayscale.value;
 
     case GTK_CSS_FILTER_HUE_ROTATE:
-      dest->hue_rotate.value = _gtk_css_value_compute (src->hue_rotate.value, property_id, provider, style, 
parent_style);
+      dest->hue_rotate.value = gtk_css_value_compute (src->hue_rotate.value, property_id, provider, root, 
style, parent_style);
       return dest->hue_rotate.value == src->hue_rotate.value;
 
     case GTK_CSS_FILTER_INVERT:
-      dest->invert.value = _gtk_css_value_compute (src->invert.value, property_id, provider, style, 
parent_style);
+      dest->invert.value = gtk_css_value_compute (src->invert.value, property_id, provider, root, style, 
parent_style);
       return dest->invert.value == src->invert.value;
 
     case GTK_CSS_FILTER_OPACITY:
-      dest->opacity.value = _gtk_css_value_compute (src->opacity.value, property_id, provider, style, 
parent_style);
+      dest->opacity.value = gtk_css_value_compute (src->opacity.value, property_id, provider, root, style, 
parent_style);
       return dest->opacity.value == src->opacity.value;
 
     case GTK_CSS_FILTER_SATURATE:
-      dest->saturate.value = _gtk_css_value_compute (src->saturate.value, property_id, provider, style, 
parent_style);
+      dest->saturate.value = gtk_css_value_compute (src->saturate.value, property_id, provider, root, style, 
parent_style);
       return dest->saturate.value == src->saturate.value;
 
     case GTK_CSS_FILTER_SEPIA:
-      dest->sepia.value = _gtk_css_value_compute (src->sepia.value, property_id, provider, style, 
parent_style);
+      dest->sepia.value = gtk_css_value_compute (src->sepia.value, property_id, provider, root, style, 
parent_style);
       return dest->sepia.value == src->sepia.value;
 
     case GTK_CSS_FILTER_BLUR:
-      dest->blur.value = _gtk_css_value_compute (src->blur.value, property_id, provider, style, 
parent_style);
+      dest->blur.value = gtk_css_value_compute (src->blur.value, property_id, provider, root, style, 
parent_style);
       return dest->blur.value == src->blur.value;
 
     case GTK_CSS_FILTER_NONE:
@@ -359,6 +360,7 @@ static GtkCssValue *
 gtk_css_value_filter_compute (GtkCssValue      *value,
                               guint             property_id,
                               GtkStyleProvider *provider,
+                              GtkWidget        *root,
                               GtkCssStyle      *style,
                               GtkCssStyle      *parent_style)
 {
@@ -379,6 +381,7 @@ gtk_css_value_filter_compute (GtkCssValue      *value,
                                           &value->filters[i],
                                           property_id,
                                           provider,
+                                          root,
                                           style,
                                           parent_style);
     }
diff --git a/gtk/gtkcssfontfeaturesvalue.c b/gtk/gtkcssfontfeaturesvalue.c
index 9e1b0ad267..a268b93b5c 100644
--- a/gtk/gtkcssfontfeaturesvalue.c
+++ b/gtk/gtkcssfontfeaturesvalue.c
@@ -54,6 +54,7 @@ static GtkCssValue *
 gtk_css_value_font_features_compute (GtkCssValue      *specified,
                                      guint             property_id,
                                      GtkStyleProvider *provider,
+                                     GtkWidget        *root,
                                      GtkCssStyle      *style,
                                      GtkCssStyle      *parent_style)
 {
diff --git a/gtk/gtkcssfontvariationsvalue.c b/gtk/gtkcssfontvariationsvalue.c
index 174cacf417..3e58053337 100644
--- a/gtk/gtkcssfontvariationsvalue.c
+++ b/gtk/gtkcssfontvariationsvalue.c
@@ -53,6 +53,7 @@ static GtkCssValue *
 gtk_css_value_font_variations_compute (GtkCssValue      *specified,
                                        guint             property_id,
                                        GtkStyleProvider *provider,
+                                       GtkWidget        *root,
                                        GtkCssStyle      *style,
                                        GtkCssStyle      *parent_style)
 {
diff --git a/gtk/gtkcssiconthemevalue.c b/gtk/gtkcssiconthemevalue.c
index 50d021f113..55f90f18b3 100644
--- a/gtk/gtkcssiconthemevalue.c
+++ b/gtk/gtkcssiconthemevalue.c
@@ -74,6 +74,7 @@ static GtkCssValue *
 gtk_css_value_icon_theme_compute (GtkCssValue      *icon_theme,
                                   guint             property_id,
                                   GtkStyleProvider *provider,
+                                  GtkWidget        *root,
                                   GtkCssStyle      *style,
                                   GtkCssStyle      *parent_style)
 {
diff --git a/gtk/gtkcssimage.c b/gtk/gtkcssimage.c
index f4cb6c59ee..c2668c7adb 100644
--- a/gtk/gtkcssimage.c
+++ b/gtk/gtkcssimage.c
@@ -67,6 +67,7 @@ static GtkCssImage *
 gtk_css_image_real_compute (GtkCssImage      *image,
                             guint             property_id,
                             GtkStyleProvider *provider,
+                            GtkWidget        *root,
                             GtkCssStyle      *style,
                             GtkCssStyle      *parent_style)
 {
@@ -172,11 +173,12 @@ _gtk_css_image_get_aspect_ratio (GtkCssImage *image)
 }
 
 GtkCssImage *
-_gtk_css_image_compute (GtkCssImage      *image,
-                        guint             property_id,
-                        GtkStyleProvider *provider,
-                        GtkCssStyle      *style,
-                        GtkCssStyle      *parent_style)
+gtk_css_image_compute (GtkCssImage      *image,
+                       guint             property_id,
+                       GtkStyleProvider *provider,
+                       GtkWidget        *root,
+                       GtkCssStyle      *style,
+                       GtkCssStyle      *parent_style)
 {
   GtkCssImageClass *klass;
 
@@ -186,7 +188,7 @@ _gtk_css_image_compute (GtkCssImage      *image,
 
   klass = GTK_CSS_IMAGE_GET_CLASS (image);
 
-  return klass->compute (image, property_id, provider, style, parent_style);
+  return klass->compute (image, property_id, provider, root, style, parent_style);
 }
 
 GtkCssImage *
diff --git a/gtk/gtkcssimagecrossfade.c b/gtk/gtkcssimagecrossfade.c
index 2d281b26cc..4a50f082b2 100644
--- a/gtk/gtkcssimagecrossfade.c
+++ b/gtk/gtkcssimagecrossfade.c
@@ -382,6 +382,7 @@ static GtkCssImage *
 gtk_css_image_cross_fade_compute (GtkCssImage      *image,
                                   guint             property_id,
                                   GtkStyleProvider *provider,
+                                  GtkWidget        *root,
                                   GtkCssStyle      *style,
                                   GtkCssStyle      *parent_style)
 {
@@ -398,7 +399,7 @@ gtk_css_image_cross_fade_compute (GtkCssImage      *image,
       gtk_css_image_cross_fade_add (result,
                                     entry->has_progress,
                                     entry->progress,
-                                    _gtk_css_image_compute (entry->image, property_id, provider, style, 
parent_style));
+                                    gtk_css_image_compute (entry->image, property_id, provider, root, style, 
parent_style));
     }
 
   return GTK_CSS_IMAGE (result);
diff --git a/gtk/gtkcssimagefallback.c b/gtk/gtkcssimagefallback.c
index c6549c6bd4..61dafcd69e 100644
--- a/gtk/gtkcssimagefallback.c
+++ b/gtk/gtkcssimagefallback.c
@@ -136,6 +136,7 @@ static GtkCssImage *
 gtk_css_image_fallback_compute (GtkCssImage      *image,
                                 guint             property_id,
                                 GtkStyleProvider *provider,
+                                GtkWidget        *root,
                                 GtkCssStyle      *style,
                                 GtkCssStyle      *parent_style)
 {
@@ -148,11 +149,12 @@ gtk_css_image_fallback_compute (GtkCssImage      *image,
       GtkCssValue *computed_color = NULL;
 
       if (fallback->color)
-          computed_color= _gtk_css_value_compute (fallback->color,
-                                                           property_id,
-                                                           provider,
-                                                           style,
-                                                           parent_style);
+          computed_color= gtk_css_value_compute (fallback->color,
+                                                 property_id,
+                                                 provider,
+                                                 root,
+                                                 style,
+                                                 parent_style);
 
       /* image($color) that didn't change */
       if (computed_color && !fallback->images &&
@@ -164,11 +166,12 @@ gtk_css_image_fallback_compute (GtkCssImage      *image,
       copy->images = g_new (GtkCssImage *, fallback->n_images);
       for (i = 0; i < fallback->n_images; i++)
         {
-          copy->images[i] = _gtk_css_image_compute (fallback->images[i],
-                                                    property_id,
-                                                    provider,
-                                                    style,
-                                                    parent_style);
+          copy->images[i] = gtk_css_image_compute (fallback->images[i],
+                                                   property_id,
+                                                   provider,
+                                                   root,
+                                                   style,
+                                                   parent_style);
 
           if (gtk_css_image_is_invalid (copy->images[i]))
             continue;
diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c
index c886e2447c..520876847e 100644
--- a/gtk/gtkcssimageicontheme.c
+++ b/gtk/gtkcssimageicontheme.c
@@ -141,6 +141,7 @@ static GtkCssImage *
 gtk_css_image_icon_theme_compute (GtkCssImage      *image,
                                   guint             property_id,
                                   GtkStyleProvider *provider,
+                                  GtkWidget        *root,
                                   GtkCssStyle      *style,
                                   GtkCssStyle      *parent_style)
 {
diff --git a/gtk/gtkcssimagelinear.c b/gtk/gtkcssimagelinear.c
index 13f848d945..845515ee6e 100644
--- a/gtk/gtkcssimagelinear.c
+++ b/gtk/gtkcssimagelinear.c
@@ -491,6 +491,7 @@ static GtkCssImage *
 gtk_css_image_linear_compute (GtkCssImage      *image,
                               guint             property_id,
                               GtkStyleProvider *provider,
+                              GtkWidget        *root,
                               GtkCssStyle      *style,
                               GtkCssStyle      *parent_style)
 {
@@ -503,7 +504,7 @@ gtk_css_image_linear_compute (GtkCssImage      *image,
   copy->side = linear->side;
 
   if (linear->angle)
-    copy->angle = _gtk_css_value_compute (linear->angle, property_id, provider, style, parent_style);
+    copy->angle = gtk_css_value_compute (linear->angle, property_id, provider, root, style, parent_style);
 
   copy->n_stops = linear->n_stops;
   copy->color_stops = g_malloc (sizeof (GtkCssImageLinearColorStop) * copy->n_stops);
@@ -512,11 +513,11 @@ gtk_css_image_linear_compute (GtkCssImage      *image,
       const GtkCssImageLinearColorStop *stop = &linear->color_stops[i];
       GtkCssImageLinearColorStop *scopy = &copy->color_stops[i];
 
-      scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style);
+      scopy->color = gtk_css_value_compute (stop->color, property_id, provider, root, style, parent_style);
 
       if (stop->offset)
         {
-          scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style);
+          scopy->offset = gtk_css_value_compute (stop->offset, property_id, provider, root, style, 
parent_style);
         }
       else
         {
diff --git a/gtk/gtkcssimagepaintable.c b/gtk/gtkcssimagepaintable.c
index d4056ab263..a173c034c6 100644
--- a/gtk/gtkcssimagepaintable.c
+++ b/gtk/gtkcssimagepaintable.c
@@ -99,6 +99,7 @@ static GtkCssImage *
 gtk_css_image_paintable_compute (GtkCssImage      *image,
                                  guint             property_id,
                                  GtkStyleProvider *provider,
+                                 GtkWidget        *root,
                                  GtkCssStyle      *style,
                                  GtkCssStyle      *parent_style)
 {
diff --git a/gtk/gtkcssimageprivate.h b/gtk/gtkcssimageprivate.h
index d4e4e669ea..817b4f1c5b 100644
--- a/gtk/gtkcssimageprivate.h
+++ b/gtk/gtkcssimageprivate.h
@@ -60,6 +60,7 @@ struct _GtkCssImageClass
   GtkCssImage *(* compute)                         (GtkCssImage                *image,
                                                     guint                       property_id,
                                                     GtkStyleProvider           *provider,
+                                                    GtkWidget                  *root,
                                                     GtkCssStyle                *style,
                                                     GtkCssStyle                *parent_style);
   /* compare two images for equality */
@@ -101,9 +102,10 @@ int            _gtk_css_image_get_width            (GtkCssImage                *
 int            _gtk_css_image_get_height           (GtkCssImage                *image) G_GNUC_PURE;
 double         _gtk_css_image_get_aspect_ratio     (GtkCssImage                *image) G_GNUC_PURE;
 
-GtkCssImage *  _gtk_css_image_compute              (GtkCssImage                *image,
+GtkCssImage *  gtk_css_image_compute               (GtkCssImage                *image,
                                                     guint                       property_id,
                                                     GtkStyleProvider           *provider,
+                                                    GtkWidget                  *root,
                                                     GtkCssStyle                *style,
                                                     GtkCssStyle                *parent_style);
 gboolean       _gtk_css_image_equal                (GtkCssImage                *image1,
diff --git a/gtk/gtkcssimageradial.c b/gtk/gtkcssimageradial.c
index 46e6da1584..db4ce8f8ae 100644
--- a/gtk/gtkcssimageradial.c
+++ b/gtk/gtkcssimageradial.c
@@ -507,6 +507,7 @@ static GtkCssImage *
 gtk_css_image_radial_compute (GtkCssImage      *image,
                               guint             property_id,
                               GtkStyleProvider *provider,
+                              GtkWidget        *root,
                               GtkCssStyle      *style,
                               GtkCssStyle      *parent_style)
 {
@@ -519,13 +520,13 @@ gtk_css_image_radial_compute (GtkCssImage      *image,
   copy->circle = radial->circle;
   copy->size = radial->size;
 
-  copy->position = _gtk_css_value_compute (radial->position, property_id, provider, style, parent_style);
+  copy->position = gtk_css_value_compute (radial->position, property_id, provider, root, style, 
parent_style);
 
   if (radial->sizes[0])
-    copy->sizes[0] = _gtk_css_value_compute (radial->sizes[0], property_id, provider, style, parent_style);
+    copy->sizes[0] = gtk_css_value_compute (radial->sizes[0], property_id, provider, root, style, 
parent_style);
 
   if (radial->sizes[1])
-    copy->sizes[1] = _gtk_css_value_compute (radial->sizes[1], property_id, provider, style, parent_style);
+    copy->sizes[1] = gtk_css_value_compute (radial->sizes[1], property_id, provider, root, style, 
parent_style);
 
   copy->n_stops = radial->n_stops;
   copy->color_stops = g_malloc (sizeof (GtkCssImageRadialColorStop) * copy->n_stops);
@@ -534,11 +535,11 @@ gtk_css_image_radial_compute (GtkCssImage      *image,
       const GtkCssImageRadialColorStop *stop = &radial->color_stops[i];
       GtkCssImageRadialColorStop *scopy = &copy->color_stops[i];
 
-      scopy->color = _gtk_css_value_compute (stop->color, property_id, provider, style, parent_style);
+      scopy->color = gtk_css_value_compute (stop->color, property_id, provider, root, style, parent_style);
 
       if (stop->offset)
         {
-          scopy->offset = _gtk_css_value_compute (stop->offset, property_id, provider, style, parent_style);
+          scopy->offset = gtk_css_value_compute (stop->offset, property_id, provider, root, style, 
parent_style);
         }
       else
         {
diff --git a/gtk/gtkcssimagerecolor.c b/gtk/gtkcssimagerecolor.c
index 23cbb16bbe..368b016f9d 100644
--- a/gtk/gtkcssimagerecolor.c
+++ b/gtk/gtkcssimagerecolor.c
@@ -204,6 +204,7 @@ static GtkCssImage *
 gtk_css_image_recolor_compute (GtkCssImage      *image,
                                guint             property_id,
                                GtkStyleProvider *provider,
+                               GtkWidget        *root,
                                GtkCssStyle      *style,
                                GtkCssStyle      *parent_style)
 {
@@ -216,7 +217,7 @@ gtk_css_image_recolor_compute (GtkCssImage      *image,
   scale = gtk_style_provider_get_scale (provider);
 
   if (recolor->palette)
-    palette = _gtk_css_value_compute (recolor->palette, property_id, provider, style, parent_style);
+    palette = gtk_css_value_compute (recolor->palette, property_id, provider, root, style, parent_style);
   else
     palette = _gtk_css_value_ref (style->core->icon_palette);
 
diff --git a/gtk/gtkcssimagescaled.c b/gtk/gtkcssimagescaled.c
index 6dd3b05b4e..a6ca7fe1ce 100644
--- a/gtk/gtkcssimagescaled.c
+++ b/gtk/gtkcssimagescaled.c
@@ -100,6 +100,7 @@ static GtkCssImage *
 gtk_css_image_scaled_compute (GtkCssImage      *image,
                               guint             property_id,
                               GtkStyleProvider *provider,
+                              GtkWidget        *root,
                               GtkCssStyle      *style,
                               GtkCssStyle      *parent_style)
 {
@@ -133,11 +134,12 @@ gtk_css_image_scaled_compute (GtkCssImage      *image,
   res->images = g_new (GtkCssImage *, 1);
   res->scales = g_new (int, 1);
 
-  res->images[0] = _gtk_css_image_compute (scaled->images[best],
-                                           property_id,
-                                           provider,
-                                           style,
-                                           parent_style);
+  res->images[0] = gtk_css_image_compute (scaled->images[best],
+                                          property_id,
+                                          provider,
+                                          root,
+                                          style,
+                                          parent_style);
   res->scales[0] = scaled->scales[best];
 
   return GTK_CSS_IMAGE (res);
diff --git a/gtk/gtkcssimageurl.c b/gtk/gtkcssimageurl.c
index 3820b5c966..8fa9df19a8 100644
--- a/gtk/gtkcssimageurl.c
+++ b/gtk/gtkcssimageurl.c
@@ -125,6 +125,7 @@ static GtkCssImage *
 gtk_css_image_url_compute (GtkCssImage      *image,
                            guint             property_id,
                            GtkStyleProvider *provider,
+                           GtkWidget        *root,
                            GtkCssStyle      *style,
                            GtkCssStyle      *parent_style)
 {
diff --git a/gtk/gtkcssimagevalue.c b/gtk/gtkcssimagevalue.c
index 3c1ce454cd..d063c04967 100644
--- a/gtk/gtkcssimagevalue.c
+++ b/gtk/gtkcssimagevalue.c
@@ -37,6 +37,7 @@ static GtkCssValue *
 gtk_css_value_image_compute (GtkCssValue      *value,
                              guint             property_id,
                              GtkStyleProvider *provider,
+                             GtkWidget        *root,
                              GtkCssStyle      *style,
                              GtkCssStyle      *parent_style)
 {
@@ -47,7 +48,7 @@ gtk_css_value_image_compute (GtkCssValue      *value,
   if (image == NULL)
     return _gtk_css_value_ref (value);
 
-  computed = _gtk_css_image_compute (image, property_id, provider, style, parent_style);
+  computed = gtk_css_image_compute (image, property_id, provider, root, style, parent_style);
 
   if (computed == image)
     {
diff --git a/gtk/gtkcssinheritvalue.c b/gtk/gtkcssinheritvalue.c
index d30b844e29..67c9c463b8 100644
--- a/gtk/gtkcssinheritvalue.c
+++ b/gtk/gtkcssinheritvalue.c
@@ -37,6 +37,7 @@ static GtkCssValue *
 gtk_css_value_inherit_compute (GtkCssValue      *value,
                                guint             property_id,
                                GtkStyleProvider *provider,
+                               GtkWidget        *root,
                                GtkCssStyle      *style,
                                GtkCssStyle      *parent_style)
 {
@@ -46,11 +47,12 @@ gtk_css_value_inherit_compute (GtkCssValue      *value,
     }
   else
     {
-      return _gtk_css_value_compute (_gtk_css_initial_value_get (),
-                                     property_id,
-                                     provider,
-                                     style,
-                                     parent_style);
+      return gtk_css_value_compute (_gtk_css_initial_value_get (),
+                                    property_id,
+                                    provider,
+                                    root,
+                                    style,
+                                    parent_style);
     }
 }
 
diff --git a/gtk/gtkcssinitialvalue.c b/gtk/gtkcssinitialvalue.c
index f01b49c612..912fc4f721 100644
--- a/gtk/gtkcssinitialvalue.c
+++ b/gtk/gtkcssinitialvalue.c
@@ -41,6 +41,7 @@ static GtkCssValue *
 gtk_css_value_initial_compute (GtkCssValue      *value,
                                guint             property_id,
                                GtkStyleProvider *provider,
+                               GtkWidget        *root,
                                GtkCssStyle      *style,
                                GtkCssStyle      *parent_style)
 {
@@ -71,11 +72,12 @@ gtk_css_value_initial_compute (GtkCssValue      *value,
       break;
     }
 
-  return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value 
(_gtk_css_style_property_lookup_by_id (property_id)),
-                                 property_id,
-                                 provider,
-                                 style,
-                                 parent_style);
+  return gtk_css_value_compute (_gtk_css_style_property_get_initial_value 
(_gtk_css_style_property_lookup_by_id (property_id)),
+                                property_id,
+                                provider,
+                                root,
+                                style,
+                                parent_style);
 }
 
 static gboolean
@@ -125,15 +127,18 @@ _gtk_css_initial_value_get (void)
 {
   return &initial;
 }
+
 GtkCssValue *
-_gtk_css_initial_value_new_compute (guint             property_id,
-                                    GtkStyleProvider *provider,
-                                    GtkCssStyle      *style,
-                                    GtkCssStyle      *parent_style)
+gtk_css_initial_value_new_compute (guint             property_id,
+                                   GtkStyleProvider *provider,
+                                   GtkWidget        *root,
+                                   GtkCssStyle      *style,
+                                   GtkCssStyle      *parent_style)
 {
   return gtk_css_value_initial_compute (NULL,
                                         property_id,
                                         provider,
+                                        root,
                                         style,
                                         parent_style);
 }
diff --git a/gtk/gtkcssinitialvalueprivate.h b/gtk/gtkcssinitialvalueprivate.h
index 7bec6bd5a0..c519660114 100644
--- a/gtk/gtkcssinitialvalueprivate.h
+++ b/gtk/gtkcssinitialvalueprivate.h
@@ -26,8 +26,9 @@ G_BEGIN_DECLS
 
 GtkCssValue *   _gtk_css_initial_value_new            (void);
 GtkCssValue *   _gtk_css_initial_value_get            (void);
-GtkCssValue *   _gtk_css_initial_value_new_compute    (guint             property_id,
+GtkCssValue *   gtk_css_initial_value_new_compute     (guint             property_id,
                                                        GtkStyleProvider *provider,
+                                                       GtkWidget        *root,
                                                        GtkCssStyle      *style,
                                                        GtkCssStyle      *parent_style);
 
diff --git a/gtk/gtkcsskeyframes.c b/gtk/gtkcsskeyframes.c
index e4a577379d..74e96cdfd4 100644
--- a/gtk/gtkcsskeyframes.c
+++ b/gtk/gtkcsskeyframes.c
@@ -426,10 +426,11 @@ _gtk_css_keyframes_print (GtkCssKeyframes *keyframes,
 }
 
 GtkCssKeyframes *
-_gtk_css_keyframes_compute (GtkCssKeyframes  *keyframes,
-                            GtkStyleProvider *provider,
-                            GtkCssStyle      *style,
-                            GtkCssStyle      *parent_style)
+gtk_css_keyframes_compute (GtkCssKeyframes  *keyframes,
+                           GtkStyleProvider *provider,
+                           GtkWidget        *root,
+                           GtkCssStyle      *style,
+                           GtkCssStyle      *parent_style)
 {
   GtkCssKeyframes *resolved;
   guint k, p;
@@ -453,11 +454,12 @@ _gtk_css_keyframes_compute (GtkCssKeyframes  *keyframes,
           if (KEYFRAMES_VALUE (keyframes, k, p) == NULL)
             continue;
 
-          KEYFRAMES_VALUE (resolved, k, p) =  _gtk_css_value_compute (KEYFRAMES_VALUE (keyframes, k, p),
-                                                                      resolved->property_ids[p],
-                                                                      provider,
-                                                                      style,
-                                                                      parent_style);
+          KEYFRAMES_VALUE (resolved, k, p) =  gtk_css_value_compute (KEYFRAMES_VALUE (keyframes, k, p),
+                                                                     resolved->property_ids[p],
+                                                                     provider,
+                                                                     root,
+                                                                     style,
+                                                                     parent_style);
         }
     }
 
diff --git a/gtk/gtkcsskeyframesprivate.h b/gtk/gtkcsskeyframesprivate.h
index 89de02536c..5058407bd7 100644
--- a/gtk/gtkcsskeyframesprivate.h
+++ b/gtk/gtkcsskeyframesprivate.h
@@ -36,10 +36,11 @@ void                _gtk_css_keyframes_unref                  (GtkCssKeyframes
 void                _gtk_css_keyframes_print                  (GtkCssKeyframes        *keyframes,
                                                                GString                *string);
 
-GtkCssKeyframes *   _gtk_css_keyframes_compute                (GtkCssKeyframes         *keyframes,
-                                                               GtkStyleProvider        *provider,
-                                                               GtkCssStyle             *style,
-                                                               GtkCssStyle             *parent_style);
+GtkCssKeyframes *   gtk_css_keyframes_compute                 (GtkCssKeyframes        *keyframes,
+                                                               GtkStyleProvider       *provider,
+                                                               GtkWidget              *root,
+                                                               GtkCssStyle            *style,
+                                                               GtkCssStyle            *parent_style);
 
 guint               _gtk_css_keyframes_get_n_properties       (GtkCssKeyframes        *keyframes) 
G_GNUC_PURE;
 guint               _gtk_css_keyframes_get_property_id        (GtkCssKeyframes        *keyframes,
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 081662b084..45118495b7 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -437,6 +437,7 @@ gtk_css_node_real_update_style (GtkCssNode                   *cssnode,
                                               parent ? gtk_css_node_get_style (parent) : NULL,
                                               timestamp,
                                               gtk_css_node_get_style_provider (cssnode),
+                                              gtk_css_node_get_root (cssnode),
                                               should_create_transitions (change) ? style : NULL);
 
       /* Clear the cache again, the static style we looked up above
@@ -1377,6 +1378,12 @@ gtk_css_node_get_style_provider (GtkCssNode *cssnode)
   return GTK_STYLE_PROVIDER (_gtk_settings_get_style_cascade (gtk_settings_get_default (), 1));
 }
 
+GtkWidget *
+gtk_css_node_get_root (GtkCssNode *cssnode)
+{
+  return NULL;
+}
+
 void
 gtk_css_node_print (GtkCssNode                *cssnode,
                     GtkStyleContextPrintFlags  flags,
diff --git a/gtk/gtkcssnodeprivate.h b/gtk/gtkcssnodeprivate.h
index ae07da00cb..8138e4ff60 100644
--- a/gtk/gtkcssnodeprivate.h
+++ b/gtk/gtkcssnodeprivate.h
@@ -150,12 +150,13 @@ void                    gtk_css_node_invalidate         (GtkCssNode            *
                                                          GtkCssChange           change);
 void                    gtk_css_node_validate           (GtkCssNode            *cssnode);
 
-GtkStyleProvider *      gtk_css_node_get_style_provider (GtkCssNode            *cssnode) G_GNUC_PURE;
+GtkStyleProvider *      gtk_css_node_get_style_provider (GtkCssNode                     *cssnode) 
G_GNUC_PURE;
+GtkWidget *             gtk_css_node_get_root           (GtkCssNode                     *cssnode) 
G_GNUC_PURE;
 
-void                    gtk_css_node_print              (GtkCssNode                *cssnode,
-                                                         GtkStyleContextPrintFlags  flags,
-                                                         GString                   *string,
-                                                         guint                      indent);
+void                    gtk_css_node_print              (GtkCssNode                     *cssnode,
+                                                         GtkStyleContextPrintFlags       flags,
+                                                         GString                        *string,
+                                                         guint                           indent);
 
 G_END_DECLS
 
diff --git a/gtk/gtkcsspalettevalue.c b/gtk/gtkcsspalettevalue.c
index 8245be9123..473f4d35ac 100644
--- a/gtk/gtkcsspalettevalue.c
+++ b/gtk/gtkcsspalettevalue.c
@@ -108,6 +108,7 @@ static GtkCssValue *
 gtk_css_value_palette_compute (GtkCssValue      *specified,
                                guint             property_id,
                                GtkStyleProvider *provider,
+                               GtkWidget        *root,
                                GtkCssStyle      *style,
                                GtkCssStyle      *parent_style)
 {
@@ -122,7 +123,7 @@ gtk_css_value_palette_compute (GtkCssValue      *specified,
     {
       GtkCssValue *value = specified->color_values[i];
 
-      computed_color = _gtk_css_value_compute (value, property_id, provider, style, parent_style);
+      computed_color = gtk_css_value_compute (value, property_id, provider, root, style, parent_style);
       result->color_names[i] = g_strdup (specified->color_names[i]);
       result->color_values[i] = computed_color;
 
diff --git a/gtk/gtkcsspositionvalue.c b/gtk/gtkcsspositionvalue.c
index 4164d18ca2..d82fa94fee 100644
--- a/gtk/gtkcsspositionvalue.c
+++ b/gtk/gtkcsspositionvalue.c
@@ -40,13 +40,14 @@ static GtkCssValue *
 gtk_css_value_position_compute (GtkCssValue      *position,
                                 guint             property_id,
                                 GtkStyleProvider *provider,
+                                GtkWidget        *root,
                                 GtkCssStyle      *style,
                                 GtkCssStyle      *parent_style)
 {
   GtkCssValue *x, *y;
 
-  x = _gtk_css_value_compute (position->x, property_id, provider, style, parent_style);
-  y = _gtk_css_value_compute (position->y, property_id, provider, style, parent_style);
+  x = gtk_css_value_compute (position->x, property_id, provider, root, style, parent_style);
+  y = gtk_css_value_compute (position->y, property_id, provider, root, style, parent_style);
   if (x == position->x && y == position->y)
     {
       _gtk_css_value_unref (x);
diff --git a/gtk/gtkcssrepeatvalue.c b/gtk/gtkcssrepeatvalue.c
index 26a7ac27fa..69fba2ef28 100644
--- a/gtk/gtkcssrepeatvalue.c
+++ b/gtk/gtkcssrepeatvalue.c
@@ -37,6 +37,7 @@ static GtkCssValue *
 gtk_css_value_repeat_compute (GtkCssValue      *value,
                               guint             property_id,
                               GtkStyleProvider *provider,
+                              GtkWidget        *root,
                               GtkCssStyle      *style,
                               GtkCssStyle      *parent_style)
 {
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index 9a0917ef94..01d0fa34b8 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -114,6 +114,7 @@ static GtkCssValue *
 gtk_css_value_shadow_compute (GtkCssValue      *value,
                               guint             property_id,
                               GtkStyleProvider *provider,
+                              GtkWidget        *root,
                               GtkCssStyle      *style,
                               GtkCssStyle      *parent_style)
 {
@@ -126,11 +127,11 @@ gtk_css_value_shadow_compute (GtkCssValue      *value,
     {
       const ShadowValue *shadow = &value->shadows[i];
 
-      shadows[i].hoffset = _gtk_css_value_compute (shadow->hoffset, property_id, provider, style, 
parent_style);
-      shadows[i].voffset = _gtk_css_value_compute (shadow->voffset, property_id, provider, style, 
parent_style);
-      shadows[i].radius = _gtk_css_value_compute (shadow->radius, property_id, provider, style, 
parent_style);
-      shadows[i].spread = _gtk_css_value_compute (shadow->spread, property_id, provider, style, 
parent_style),
-      shadows[i].color = _gtk_css_value_compute (shadow->color, property_id, provider, style, parent_style);
+      shadows[i].hoffset = gtk_css_value_compute (shadow->hoffset, property_id, provider, root, style, 
parent_style);
+      shadows[i].voffset = gtk_css_value_compute (shadow->voffset, property_id, provider, root, style, 
parent_style);
+      shadows[i].radius = gtk_css_value_compute (shadow->radius, property_id, provider, root, style, 
parent_style);
+      shadows[i].spread = gtk_css_value_compute (shadow->spread, property_id, provider, root, style, 
parent_style),
+      shadows[i].color = gtk_css_value_compute (shadow->color, property_id, provider, root, style, 
parent_style);
       shadows[i].inset = shadow->inset;
     }
 
diff --git a/gtk/gtkcssstaticstyle.c b/gtk/gtkcssstaticstyle.c
index fee5c01e56..80923d9620 100644
--- a/gtk/gtkcssstaticstyle.c
+++ b/gtk/gtkcssstaticstyle.c
@@ -41,6 +41,7 @@
 
 static void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
                                                 GtkStyleProvider  *provider,
+                                                GtkWidget         *root,
                                                 GtkCssStyle       *parent_style,
                                                 guint              id,
                                                 GtkCssValue       *specified,
@@ -196,6 +197,7 @@ gtk_css_## NAME ## _values_compute_changes_and_affects (GtkCssStyle *style1, \
 static inline void \
 gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
                                          GtkStyleProvider *provider, \
+                                         GtkWidget *root, \
                                          GtkCssStyle *parent_style, \
                                          GtkCssLookup *lookup) \
 { \
@@ -209,6 +211,7 @@ gtk_css_ ## NAME ## _values_new_compute (GtkCssStaticStyle *sstyle, \
       guint id = NAME ## _props[i]; \
       gtk_css_static_style_compute_value (sstyle, \
                                           provider, \
+                                          root, \
                                           parent_style, \
                                           id, \
                                           lookup->values[id].value, \
@@ -725,15 +728,15 @@ gtk_css_background_create_initial_values (void)
 
   values = (GtkCssBackgroundValues *)gtk_css_values_new (GTK_CSS_BACKGROUND_INITIAL_VALUES);
 
-  values->background_color = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_COLOR, NULL, 
NULL, NULL);
-  values->box_shadow = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BOX_SHADOW, NULL, NULL, NULL);
-  values->background_clip = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_CLIP, NULL, 
NULL, NULL);
-  values->background_origin = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_ORIGIN, NULL, 
NULL, NULL);
-  values->background_size = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_SIZE, NULL, 
NULL, NULL);
-  values->background_position = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_POSITION, 
NULL, NULL, NULL);
-  values->background_repeat = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_REPEAT, NULL, 
NULL, NULL);
-  values->background_image = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_IMAGE, NULL, 
NULL, NULL);
-  values->background_blend_mode = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE, NULL, NULL, NULL);
+  values->background_color = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_COLOR, NULL, 
NULL, NULL, NULL);
+  values->box_shadow = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BOX_SHADOW, NULL, NULL, NULL, 
NULL);
+  values->background_clip = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_CLIP, NULL, NULL, 
NULL, NULL);
+  values->background_origin = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_ORIGIN, NULL, 
NULL, NULL, NULL);
+  values->background_size = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_SIZE, NULL, NULL, 
NULL, NULL);
+  values->background_position = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_POSITION, 
NULL, NULL, NULL, NULL);
+  values->background_repeat = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_REPEAT, NULL, 
NULL, NULL, NULL);
+  values->background_image = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_IMAGE, NULL, 
NULL, NULL, NULL);
+  values->background_blend_mode = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE, 
NULL, NULL, NULL, NULL);
 
   return (GtkCssValues *)values;
 }
@@ -745,26 +748,26 @@ gtk_css_border_create_initial_values (void)
 
   values = (GtkCssBorderValues *)gtk_css_values_new (GTK_CSS_BORDER_INITIAL_VALUES);
 
-  values->border_top_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_STYLE, NULL, 
NULL, NULL);
-  values->border_top_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_WIDTH, NULL, 
NULL, NULL);
-  values->border_left_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_LEFT_STYLE, NULL, 
NULL, NULL);
-  values->border_left_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH, NULL, 
NULL, NULL);
-  values->border_bottom_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE, 
NULL, NULL, NULL);
-  values->border_bottom_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH, 
NULL, NULL, NULL);
-  values->border_right_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE, 
NULL, NULL, NULL);
-  values->border_right_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH, 
NULL, NULL, NULL);
-  values->border_top_left_radius = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS, NULL, NULL, NULL);
-  values->border_top_right_radius = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS, NULL, NULL, NULL);
-  values->border_bottom_left_radius = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS, NULL, NULL, NULL);
-  values->border_bottom_right_radius = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS, NULL, NULL, NULL);
+  values->border_top_style = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_STYLE, NULL, 
NULL, NULL, NULL);
+  values->border_top_width = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_TOP_WIDTH, NULL, 
NULL, NULL, NULL);
+  values->border_left_style = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_LEFT_STYLE, NULL, 
NULL, NULL, NULL);
+  values->border_left_width = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH, NULL, 
NULL, NULL, NULL);
+  values->border_bottom_style = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE, 
NULL, NULL, NULL, NULL);
+  values->border_bottom_width = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH, 
NULL, NULL, NULL, NULL);
+  values->border_right_style = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE, NULL, 
NULL, NULL, NULL);
+  values->border_right_width = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH, NULL, 
NULL, NULL, NULL);
+  values->border_top_left_radius = gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS, NULL, NULL, NULL, NULL);
+  values->border_top_right_radius = gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS, NULL, NULL, NULL, NULL);
+  values->border_bottom_left_radius = gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS, NULL, NULL, NULL, NULL);
+  values->border_bottom_right_radius = gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS, NULL, NULL, NULL, NULL);
   values->border_top_color = NULL;
   values->border_right_color = NULL;
   values->border_bottom_color = NULL;
   values->border_left_color = NULL;
-  values->border_image_source = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE, 
NULL, NULL, NULL);
-  values->border_image_repeat = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_REPEAT, 
NULL, NULL, NULL);
-  values->border_image_slice = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_SLICE, 
NULL, NULL, NULL);
-  values->border_image_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH, 
NULL, NULL, NULL);
+  values->border_image_source = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE, 
NULL, NULL, NULL, NULL);
+  values->border_image_repeat = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_REPEAT, 
NULL, NULL, NULL, NULL);
+  values->border_image_slice = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_SLICE, NULL, 
NULL, NULL, NULL);
+  values->border_image_width = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH, NULL, 
NULL, NULL, NULL);
 
   return (GtkCssValues *)values;
 }
@@ -776,9 +779,9 @@ gtk_css_outline_create_initial_values (void)
 
   values = (GtkCssOutlineValues *)gtk_css_values_new (GTK_CSS_OUTLINE_INITIAL_VALUES);
 
-  values->outline_style = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_STYLE, NULL, NULL, 
NULL);
-  values->outline_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_WIDTH, NULL, NULL, 
NULL);
-  values->outline_offset = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_OFFSET, NULL, NULL, 
NULL);
+  values->outline_style = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_STYLE, NULL, NULL, 
NULL, NULL);
+  values->outline_width = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_WIDTH, NULL, NULL, 
NULL, NULL);
+  values->outline_offset = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OUTLINE_OFFSET, NULL, NULL, 
NULL, NULL);
   values->outline_color = NULL;
 
   return (GtkCssValues *)values;
@@ -803,16 +806,16 @@ gtk_css_font_variant_create_initial_values (void)
 
   values = (GtkCssFontVariantValues *)gtk_css_values_new (GTK_CSS_FONT_VARIANT_INITIAL_VALUES);
 
-  values->text_decoration_line = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_DECORATION_LINE, 
NULL, NULL, NULL);
+  values->text_decoration_line = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_DECORATION_LINE, 
NULL, NULL, NULL, NULL);
   values->text_decoration_color = NULL;
-  values->text_decoration_style = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE, NULL, NULL, NULL);
-  values->font_kerning = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_KERNING, NULL, NULL, 
NULL);
-  values->font_variant_ligatures = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_FONT_VARIANT_LIGATURES, NULL, NULL, NULL);
-  values->font_variant_position = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_FONT_VARIANT_POSITION, NULL, NULL, NULL);
-  values->font_variant_caps = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_CAPS, NULL, 
NULL, NULL);
-  values->font_variant_numeric = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_NUMERIC, 
NULL, NULL, NULL);
-  values->font_variant_alternates = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_FONT_VARIANT_ALTERNATES, NULL, NULL, NULL);
-  values->font_variant_east_asian = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_FONT_VARIANT_EAST_ASIAN, NULL, NULL, NULL);
+  values->text_decoration_style = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE, 
NULL, NULL, NULL, NULL);
+  values->font_kerning = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_KERNING, NULL, NULL, NULL, 
NULL);
+  values->font_variant_ligatures = gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_FONT_VARIANT_LIGATURES, NULL, NULL, NULL, NULL);
+  values->font_variant_position = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_POSITION, 
NULL, NULL, NULL, NULL);
+  values->font_variant_caps = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_CAPS, NULL, 
NULL, NULL, NULL);
+  values->font_variant_numeric = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FONT_VARIANT_NUMERIC, 
NULL, NULL, NULL, NULL);
+  values->font_variant_alternates = gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_FONT_VARIANT_ALTERNATES, NULL, NULL, NULL, NULL);
+  values->font_variant_east_asian = gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_FONT_VARIANT_EAST_ASIAN, NULL, NULL, NULL, NULL);
 
   return (GtkCssValues *)values;
 }
@@ -824,14 +827,14 @@ gtk_css_animation_create_initial_values (void)
 
   values = (GtkCssAnimationValues *)gtk_css_values_new (GTK_CSS_ANIMATION_INITIAL_VALUES);
 
-  values->animation_name = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_NAME, NULL, NULL, 
NULL);
-  values->animation_duration = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DURATION, 
NULL, NULL, NULL);
-  values->animation_timing_function = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION, NULL, NULL, NULL);
-  values->animation_iteration_count = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT, NULL, NULL, NULL);
-  values->animation_direction = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DIRECTION, 
NULL, NULL, NULL);
-  values->animation_play_state = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE, 
NULL, NULL, NULL);
-  values->animation_delay = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DELAY, NULL, 
NULL, NULL);
-  values->animation_fill_mode = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_FILL_MODE, 
NULL, NULL, NULL);
+  values->animation_name = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_NAME, NULL, NULL, 
NULL, NULL);
+  values->animation_duration = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DURATION, NULL, 
NULL, NULL, NULL);
+  values->animation_timing_function = gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION, NULL, NULL, NULL, NULL);
+  values->animation_iteration_count = gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT, NULL, NULL, NULL, NULL);
+  values->animation_direction = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DIRECTION, 
NULL, NULL, NULL, NULL);
+  values->animation_play_state = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE, 
NULL, NULL, NULL, NULL);
+  values->animation_delay = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_DELAY, NULL, NULL, 
NULL, NULL);
+  values->animation_fill_mode = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ANIMATION_FILL_MODE, 
NULL, NULL, NULL, NULL);
 
   return (GtkCssValues *)values;
 }
@@ -843,10 +846,10 @@ gtk_css_transition_create_initial_values (void)
 
   values = (GtkCssTransitionValues *)gtk_css_values_new (GTK_CSS_TRANSITION_INITIAL_VALUES);
 
-  values->transition_property = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_PROPERTY, 
NULL, NULL, NULL);
-  values->transition_duration = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_DURATION, 
NULL, NULL, NULL);
-  values->transition_timing_function = _gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION, NULL, NULL, NULL);
-  values->transition_delay = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_DELAY, NULL, 
NULL, NULL);
+  values->transition_property = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_PROPERTY, 
NULL, NULL, NULL, NULL);
+  values->transition_duration = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_DURATION, 
NULL, NULL, NULL, NULL);
+  values->transition_timing_function = gtk_css_initial_value_new_compute 
(GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION, NULL, NULL, NULL, NULL);
+  values->transition_delay = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSITION_DELAY, NULL, 
NULL, NULL, NULL);
 
   return (GtkCssValues *)values;
 }
@@ -858,17 +861,17 @@ gtk_css_size_create_initial_values (void)
 
   values = (GtkCssSizeValues *)gtk_css_values_new (GTK_CSS_SIZE_INITIAL_VALUES);
 
-  values->margin_top = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_TOP, NULL, NULL, NULL);
-  values->margin_left = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_LEFT, NULL, NULL, NULL);
-  values->margin_bottom = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_BOTTOM, NULL, NULL, 
NULL);
-  values->margin_right = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_RIGHT, NULL, NULL, 
NULL);
-  values->padding_top = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_TOP, NULL, NULL, NULL);
-  values->padding_left = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_LEFT, NULL, NULL, 
NULL);
-  values->padding_bottom = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_BOTTOM, NULL, NULL, 
NULL);
-  values->padding_right = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_RIGHT, NULL, NULL, 
NULL);
-  values->border_spacing = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_SPACING, NULL, NULL, 
NULL);
-  values->min_width = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MIN_WIDTH, NULL, NULL, NULL);
-  values->min_height = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MIN_HEIGHT, NULL, NULL, NULL);
+  values->margin_top = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_TOP, NULL, NULL, NULL, 
NULL);
+  values->margin_left = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_LEFT, NULL, NULL, NULL, 
NULL);
+  values->margin_bottom = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_BOTTOM, NULL, NULL, 
NULL, NULL);
+  values->margin_right = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MARGIN_RIGHT, NULL, NULL, NULL, 
NULL);
+  values->padding_top = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_TOP, NULL, NULL, NULL, 
NULL);
+  values->padding_left = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_LEFT, NULL, NULL, NULL, 
NULL);
+  values->padding_bottom = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_BOTTOM, NULL, NULL, 
NULL, NULL);
+  values->padding_right = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_PADDING_RIGHT, NULL, NULL, 
NULL, NULL);
+  values->border_spacing = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_BORDER_SPACING, NULL, NULL, 
NULL, NULL);
+  values->min_width = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MIN_WIDTH, NULL, NULL, NULL, NULL);
+  values->min_height = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_MIN_HEIGHT, NULL, NULL, NULL, 
NULL);
 
   return (GtkCssValues *)values;
 }
@@ -880,12 +883,12 @@ gtk_css_other_create_initial_values (void)
 
   values = (GtkCssOtherValues *)gtk_css_values_new (GTK_CSS_OTHER_INITIAL_VALUES);
 
-  values->icon_source = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_SOURCE, NULL, NULL, NULL);
-  values->icon_transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_TRANSFORM, NULL, NULL, 
NULL);
-  values->icon_filter = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_FILTER, NULL, NULL, NULL);
-  values->transform = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSFORM, NULL, NULL, NULL);
-  values->opacity = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OPACITY, NULL, NULL, NULL);
-  values->filter = _gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FILTER, NULL, NULL, NULL);
+  values->icon_source = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_SOURCE, NULL, NULL, NULL, 
NULL);
+  values->icon_transform = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_TRANSFORM, NULL, NULL, 
NULL, NULL);
+  values->icon_filter = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_ICON_FILTER, NULL, NULL, NULL, 
NULL);
+  values->transform = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_TRANSFORM, NULL, NULL, NULL, NULL);
+  values->opacity = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_OPACITY, NULL, NULL, NULL, NULL);
+  values->filter = gtk_css_initial_value_new_compute (GTK_CSS_PROPERTY_FILTER, NULL, NULL, NULL, NULL);
 
   return (GtkCssValues *)values;
 }
@@ -893,6 +896,7 @@ gtk_css_other_create_initial_values (void)
 static void
 gtk_css_lookup_resolve (GtkCssLookup      *lookup,
                         GtkStyleProvider  *provider,
+                        GtkWidget         *root,
                         GtkCssStaticStyle *sstyle,
                         GtkCssStyle       *parent_style)
 {
@@ -922,9 +926,9 @@ gtk_css_lookup_resolve (GtkCssLookup      *lookup,
         }
       else
         {
-          gtk_css_core_values_new_compute (sstyle, provider, parent_style, lookup);
-          gtk_css_icon_values_new_compute (sstyle, provider, parent_style, lookup);
-          gtk_css_font_values_new_compute (sstyle, provider, parent_style, lookup);
+          gtk_css_core_values_new_compute (sstyle, provider, root, parent_style, lookup);
+          gtk_css_icon_values_new_compute (sstyle, provider, root, parent_style, lookup);
+          gtk_css_font_values_new_compute (sstyle, provider, root, parent_style, lookup);
         }
 
       return;
@@ -933,57 +937,57 @@ gtk_css_lookup_resolve (GtkCssLookup      *lookup,
   if (parent_style && gtk_css_core_values_unset (lookup))
     style->core = (GtkCssCoreValues *)gtk_css_values_ref ((GtkCssValues *)parent_style->core);
   else
-    gtk_css_core_values_new_compute (sstyle, provider, parent_style, lookup);
+    gtk_css_core_values_new_compute (sstyle, provider, root, parent_style, lookup);
 
   if (gtk_css_background_values_unset (lookup))
     style->background = (GtkCssBackgroundValues *)gtk_css_values_ref (gtk_css_background_initial_values);
   else
-    gtk_css_background_values_new_compute (sstyle, provider, parent_style, lookup);
+    gtk_css_background_values_new_compute (sstyle, provider, root, parent_style, lookup);
 
   if (gtk_css_border_values_unset (lookup))
     style->border = (GtkCssBorderValues *)gtk_css_values_ref (gtk_css_border_initial_values);
   else
-    gtk_css_border_values_new_compute (sstyle, provider, parent_style, lookup);
+    gtk_css_border_values_new_compute (sstyle, provider, root, parent_style, lookup);
 
   if (parent_style && gtk_css_icon_values_unset (lookup))
     style->icon = (GtkCssIconValues *)gtk_css_values_ref ((GtkCssValues *)parent_style->icon);
   else
-    gtk_css_icon_values_new_compute (sstyle, provider, parent_style, lookup);
+    gtk_css_icon_values_new_compute (sstyle, provider, root, parent_style, lookup);
 
   if (gtk_css_outline_values_unset (lookup))
     style->outline = (GtkCssOutlineValues *)gtk_css_values_ref (gtk_css_outline_initial_values);
   else
-    gtk_css_outline_values_new_compute (sstyle, provider, parent_style, lookup);
+    gtk_css_outline_values_new_compute (sstyle, provider, root, parent_style, lookup);
 
   if (parent_style && gtk_css_font_values_unset (lookup))
     style->font = (GtkCssFontValues *)gtk_css_values_ref ((GtkCssValues *)parent_style->font);
   else
-    gtk_css_font_values_new_compute (sstyle, provider, parent_style, lookup);
+    gtk_css_font_values_new_compute (sstyle, provider, root, parent_style, lookup);
 
   if (gtk_css_font_variant_values_unset (lookup))
     style->font_variant = (GtkCssFontVariantValues *)gtk_css_values_ref 
(gtk_css_font_variant_initial_values);
   else
-    gtk_css_font_variant_values_new_compute (sstyle, provider, parent_style, lookup);
+    gtk_css_font_variant_values_new_compute (sstyle, provider, root, parent_style, lookup);
 
   if (gtk_css_animation_values_unset (lookup))
     style->animation = (GtkCssAnimationValues *)gtk_css_values_ref (gtk_css_animation_initial_values);
   else
-    gtk_css_animation_values_new_compute (sstyle, provider, parent_style, lookup);
+    gtk_css_animation_values_new_compute (sstyle, provider, root, parent_style, lookup);
 
   if (gtk_css_transition_values_unset (lookup))
     style->transition = (GtkCssTransitionValues *)gtk_css_values_ref (gtk_css_transition_initial_values);
   else
-    gtk_css_transition_values_new_compute (sstyle, provider, parent_style, lookup);
+    gtk_css_transition_values_new_compute (sstyle, provider, root, parent_style, lookup);
 
   if (gtk_css_size_values_unset (lookup))
     style->size = (GtkCssSizeValues *)gtk_css_values_ref (gtk_css_size_initial_values);
   else
-    gtk_css_size_values_new_compute (sstyle, provider, parent_style, lookup);
+    gtk_css_size_values_new_compute (sstyle, provider, root, parent_style, lookup);
 
   if (gtk_css_other_values_unset (lookup))
     style->other = (GtkCssOtherValues *)gtk_css_values_ref (gtk_css_other_initial_values);
   else
-    gtk_css_other_values_new_compute (sstyle, provider, parent_style, lookup);
+    gtk_css_other_values_new_compute (sstyle, provider, root, parent_style, lookup);
 }
 
 GtkCssStyle *
@@ -1016,6 +1020,7 @@ gtk_css_static_style_new_compute (GtkStyleProvider             *provider,
 
   gtk_css_lookup_resolve (&lookup,
                           provider,
+                          node ? gtk_css_node_get_root (node) : NULL,
                           result,
                           parent ? gtk_css_node_get_style (parent) : NULL);
 
@@ -1033,6 +1038,7 @@ G_STATIC_ASSERT (GTK_CSS_PROPERTY_OUTLINE_STYLE == GTK_CSS_PROPERTY_OUTLINE_WIDT
 static void
 gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
                                     GtkStyleProvider  *provider,
+                                    GtkWidget         *root,
                                     GtkCssStyle       *parent_style,
                                     guint              id,
                                     GtkCssValue       *specified,
@@ -1076,7 +1082,7 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
    */
   if (specified)
     {
-      value = _gtk_css_value_compute (specified, id, provider, (GtkCssStyle *)style, parent_style);
+      value = gtk_css_value_compute (specified, id, provider, root, (GtkCssStyle *)style, parent_style);
     }
   else if (parent_style && _gtk_css_style_property_is_inherit (_gtk_css_style_property_lookup_by_id (id)))
     {
@@ -1085,7 +1091,7 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
     }
   else
     {
-      value = _gtk_css_initial_value_new_compute (id, provider, (GtkCssStyle *)style, parent_style);
+      value = gtk_css_initial_value_new_compute (id, provider, root, (GtkCssStyle *)style, parent_style);
     }
 
   gtk_css_static_style_set_value (style, id, value, section);
diff --git a/gtk/gtkcssstringvalue.c b/gtk/gtkcssstringvalue.c
index c211c33afa..69d3aedcdf 100644
--- a/gtk/gtkcssstringvalue.c
+++ b/gtk/gtkcssstringvalue.c
@@ -37,6 +37,7 @@ static GtkCssValue *
 gtk_css_value_string_compute (GtkCssValue      *value,
                               guint             property_id,
                               GtkStyleProvider *provider,
+                              GtkWidget        *root,
                               GtkCssStyle      *style,
                               GtkCssStyle      *parent_style)
 {
diff --git a/gtk/gtkcsstransformvalue.c b/gtk/gtkcsstransformvalue.c
index e190c450b3..253d64594f 100644
--- a/gtk/gtkcsstransformvalue.c
+++ b/gtk/gtkcsstransformvalue.c
@@ -277,6 +277,7 @@ gtk_css_transform_compute (GtkCssTransform  *dest,
                            GtkCssTransform  *src,
                            guint             property_id,
                            GtkStyleProvider *provider,
+                           GtkWidget        *root,
                            GtkCssStyle      *style,
                            GtkCssStyle      *parent_style)
 {
@@ -287,41 +288,41 @@ gtk_css_transform_compute (GtkCssTransform  *dest,
     case GTK_CSS_TRANSFORM_MATRIX:
       return TRUE;
     case GTK_CSS_TRANSFORM_TRANSLATE:
-      dest->translate.x = _gtk_css_value_compute (src->translate.x, property_id, provider, style, 
parent_style);
-      dest->translate.y = _gtk_css_value_compute (src->translate.y, property_id, provider, style, 
parent_style);
-      dest->translate.z = _gtk_css_value_compute (src->translate.z, property_id, provider, style, 
parent_style);
+      dest->translate.x = gtk_css_value_compute (src->translate.x, property_id, provider, root, style, 
parent_style);
+      dest->translate.y = gtk_css_value_compute (src->translate.y, property_id, provider, root, style, 
parent_style);
+      dest->translate.z = gtk_css_value_compute (src->translate.z, property_id, provider, root, style, 
parent_style);
       return dest->translate.x == src->translate.x
           && dest->translate.y == src->translate.y
           && dest->translate.z == src->translate.z;
     case GTK_CSS_TRANSFORM_ROTATE:
-      dest->rotate.x = _gtk_css_value_compute (src->rotate.x, property_id, provider, style, parent_style);
-      dest->rotate.y = _gtk_css_value_compute (src->rotate.y, property_id, provider, style, parent_style);
-      dest->rotate.z = _gtk_css_value_compute (src->rotate.z, property_id, provider, style, parent_style);
-      dest->rotate.angle = _gtk_css_value_compute (src->rotate.angle, property_id, provider, style, 
parent_style);
+      dest->rotate.x = gtk_css_value_compute (src->rotate.x, property_id, provider, root, style, 
parent_style);
+      dest->rotate.y = gtk_css_value_compute (src->rotate.y, property_id, provider, root, style, 
parent_style);
+      dest->rotate.z = gtk_css_value_compute (src->rotate.z, property_id, provider, root, style, 
parent_style);
+      dest->rotate.angle = gtk_css_value_compute (src->rotate.angle, property_id, provider, root, style, 
parent_style);
       return dest->rotate.x == src->rotate.x
           && dest->rotate.y == src->rotate.y
           && dest->rotate.z == src->rotate.z
           && dest->rotate.angle == src->rotate.angle;
     case GTK_CSS_TRANSFORM_SCALE:
-      dest->scale.x = _gtk_css_value_compute (src->scale.x, property_id, provider, style, parent_style);
-      dest->scale.y = _gtk_css_value_compute (src->scale.y, property_id, provider, style, parent_style);
-      dest->scale.z = _gtk_css_value_compute (src->scale.z, property_id, provider, style, parent_style);
+      dest->scale.x = gtk_css_value_compute (src->scale.x, property_id, provider, root, style, parent_style);
+      dest->scale.y = gtk_css_value_compute (src->scale.y, property_id, provider, root, style, parent_style);
+      dest->scale.z = gtk_css_value_compute (src->scale.z, property_id, provider, root, style, parent_style);
       return dest->scale.x == src->scale.x
           && dest->scale.y == src->scale.y
           && dest->scale.z == src->scale.z;
     case GTK_CSS_TRANSFORM_SKEW:
-      dest->skew.x = _gtk_css_value_compute (src->skew.x, property_id, provider, style, parent_style);
-      dest->skew.y = _gtk_css_value_compute (src->skew.y, property_id, provider, style, parent_style);
+      dest->skew.x = gtk_css_value_compute (src->skew.x, property_id, provider, root, style, parent_style);
+      dest->skew.y = gtk_css_value_compute (src->skew.y, property_id, provider, root, style, parent_style);
       return dest->skew.x == src->skew.x
           && dest->skew.y == src->skew.y;
     case GTK_CSS_TRANSFORM_SKEW_X:
-      dest->skew_x.skew = _gtk_css_value_compute (src->skew_x.skew, property_id, provider, style, 
parent_style);
+      dest->skew_x.skew = gtk_css_value_compute (src->skew_x.skew, property_id, provider, root, style, 
parent_style);
       return dest->skew_x.skew == src->skew_x.skew;
     case GTK_CSS_TRANSFORM_SKEW_Y:
-      dest->skew_y.skew = _gtk_css_value_compute (src->skew_y.skew, property_id, provider, style, 
parent_style);
+      dest->skew_y.skew = gtk_css_value_compute (src->skew_y.skew, property_id, provider, root, style, 
parent_style);
       return dest->skew_y.skew == src->skew_y.skew;
     case GTK_CSS_TRANSFORM_PERSPECTIVE:
-      dest->perspective.depth = _gtk_css_value_compute (src->perspective.depth, property_id, provider, 
style, parent_style);
+      dest->perspective.depth = gtk_css_value_compute (src->perspective.depth, property_id, provider, root, 
style, parent_style);
       return dest->perspective.depth == src->perspective.depth;
     case GTK_CSS_TRANSFORM_NONE:
     default:
@@ -334,6 +335,7 @@ static GtkCssValue *
 gtk_css_value_transform_compute (GtkCssValue      *value,
                                  guint             property_id,
                                  GtkStyleProvider *provider,
+                                 GtkWidget        *root,
                                  GtkCssStyle      *style,
                                  GtkCssStyle      *parent_style)
 {
@@ -354,6 +356,7 @@ gtk_css_value_transform_compute (GtkCssValue      *value,
                                              &value->transforms[i],
                                              property_id,
                                              provider,
+                                             root,
                                              style,
                                              parent_style);
     }
diff --git a/gtk/gtkcssunsetvalue.c b/gtk/gtkcssunsetvalue.c
index 76fb64d5b7..ef31a40e4b 100644
--- a/gtk/gtkcssunsetvalue.c
+++ b/gtk/gtkcssunsetvalue.c
@@ -38,6 +38,7 @@ static GtkCssValue *
 gtk_css_value_unset_compute (GtkCssValue      *value,
                              guint             property_id,
                              GtkStyleProvider *provider,
+                             GtkWidget        *root,
                              GtkCssStyle      *style,
                              GtkCssStyle      *parent_style)
 {
@@ -51,11 +52,12 @@ gtk_css_value_unset_compute (GtkCssValue      *value,
   else
     unset_value = _gtk_css_initial_value_get ();
 
-  return _gtk_css_value_compute (unset_value,
-                                 property_id,
-                                 provider,
-                                 style,
-                                 parent_style);
+  return gtk_css_value_compute (unset_value,
+                                property_id,
+                                provider,
+                                root,
+                                style,
+                                parent_style);
 }
 
 static gboolean
diff --git a/gtk/gtkcssvalue.c b/gtk/gtkcssvalue.c
index ce6c3fac3b..1e45dc7a65 100644
--- a/gtk/gtkcssvalue.c
+++ b/gtk/gtkcssvalue.c
@@ -193,10 +193,13 @@ gtk_css_value_unref (GtkCssValue *value)
 }
 
 /**
- * _gtk_css_value_compute:
+ * gtk_css_value_compute:
  * @value: the value to compute from
  * @property_id: the ID of the property to compute
  * @provider: Style provider for looking up extra information
+ * @root: (nullable): root widget of the CSS tree for looking up extra
+ *     information or %NULL if the value is not looked up for a style of
+ *     a rooted window.
  * @style: Style to compute for
  * @parent_style: parent style to use for inherited values
  *
@@ -208,11 +211,12 @@ gtk_css_value_unref (GtkCssValue *value)
  * Returns: the computed value
  **/
 GtkCssValue *
-_gtk_css_value_compute (GtkCssValue      *value,
-                        guint             property_id,
-                        GtkStyleProvider *provider,
-                        GtkCssStyle      *style,
-                        GtkCssStyle      *parent_style)
+gtk_css_value_compute (GtkCssValue      *value,
+                       guint             property_id,
+                       GtkStyleProvider *provider,
+                       GtkWidget        *root,
+                       GtkCssStyle      *style,
+                       GtkCssStyle      *parent_style)
 {
   if (gtk_css_value_is_computed (value))
     return _gtk_css_value_ref (value);
@@ -221,7 +225,7 @@ _gtk_css_value_compute (GtkCssValue      *value,
   get_accounting_data (value->class->type_name)->computed++;
 #endif
 
-  return value->class->compute (value, property_id, provider, style, parent_style);
+  return value->class->compute (value, property_id, provider, root, style, parent_style);
 }
 
 gboolean
diff --git a/gtk/gtkcssvalueprivate.h b/gtk/gtkcssvalueprivate.h
index d09b366c00..22e167ae79 100644
--- a/gtk/gtkcssvalueprivate.h
+++ b/gtk/gtkcssvalueprivate.h
@@ -47,6 +47,7 @@ struct _GtkCssValueClass {
   GtkCssValue * (* compute)                           (GtkCssValue                *value,
                                                        guint                       property_id,
                                                        GtkStyleProvider           *provider,
+                                                       GtkWidget                  *root,
                                                        GtkCssStyle                *style,
                                                        GtkCssStyle                *parent_style);
   gboolean      (* equal)                             (const GtkCssValue          *value1,
@@ -73,11 +74,12 @@ GtkCssValue *   gtk_css_value_ref                     (GtkCssValue
 #define _gtk_css_value_unref gtk_css_value_unref
 void            gtk_css_value_unref                   (GtkCssValue                *value);
 
-GtkCssValue *_gtk_css_value_compute                   (GtkCssValue                *value,
+GtkCssValue *   gtk_css_value_compute                 (GtkCssValue                *value,
                                                        guint                       property_id,
                                                        GtkStyleProvider           *provider,
+                                                       GtkWidget                  *root,
                                                        GtkCssStyle                *style,
-                                                       GtkCssStyle                *parent_style) G_GNUC_PURE;
+                                                       GtkCssStyle                *parent_style);
 gboolean     _gtk_css_value_equal                     (const GtkCssValue          *value1,
                                                        const GtkCssValue          *value2) G_GNUC_PURE;
 gboolean     _gtk_css_value_equal0                    (const GtkCssValue          *value1,
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 5d9d321f94..c5dabf7b47 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -922,10 +922,11 @@ gtk_style_context_resolve_color (GtkStyleContext    *context,
   g_return_val_if_fail (color != NULL, FALSE);
   g_return_val_if_fail (result != NULL, FALSE);
 
-  val = _gtk_css_color_value_resolve (color,
-                                      GTK_STYLE_PROVIDER (priv->cascade),
-                                      _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR),
-                                      NULL);
+  val = gtk_css_color_value_resolve (color,
+                                     GTK_STYLE_PROVIDER (priv->cascade),
+                                     NULL,
+                                     _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR),
+                                     NULL);
   if (val == NULL)
     return FALSE;
 


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