[gnome-shell/shell-toolkit: 16/32] Port our imported parts of Mx to ShellTheme



commit 207748582793297c582d30f1808bd2f34d80340f
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sat Sep 19 21:10:15 2009 -0400

    Port our imported parts of Mx to ShellTheme
    
    ShellTheme replaces both StStyle and ccss_stylesheet_t.
    
    The interface StStylable is replaced by usage of ShellThemeNode.
    A concrete node class allows some significant optimizations of property
    inheritance that would have been much more difficult to achieve with
    the highly abstract pair of StStylable and ccss_node_t.
    
    Some operations that were previously on StStylable (like the
    ::style-changed signal) are directly on NtkWidget.
    
    Custom properties are no longer registered as param-specs; instead you
    call directly into shell theme node to look up a length or color:
    
    shell_theme_node_get_length (theme_node, "border-spacing", FALSE, &spacing);
    
    The dependency on libccss is dropped, while preserving all existing
    functionality and adding proper parsing and inheritance of font properties
    and proper inheritance for the 'color' property.
    
    Some more javascript tests for CSS functionality are added; workarounds for
    a CSS bug where *.some-class was needed instead of .some-class are removed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=595990

 configure.ac                   |    3 +-
 data/theme/gnome-shell.css     |   16 +-
 js/ui/main.js                  |    5 +-
 src/Makefile-st.am             |    4 -
 src/st/st-bin.c                |    1 -
 src/st/st-button.c             |  125 ++-----
 src/st/st-entry.c              |  104 +----
 src/st/st-label.c              |   53 +--
 src/st/st-scroll-bar.c         |   64 +---
 src/st/st-scroll-view.c        |   88 ++---
 src/st/st-stylable.c           |  850 ----------------------------------------
 src/st/st-stylable.h           |  125 ------
 src/st/st-style.c              |  781 ------------------------------------
 src/st/st-style.h              |   95 -----
 src/st/st-tooltip.c            |   49 +--
 src/st/st-types.h              |    3 -
 src/st/st-widget.c             |  535 ++++++++++---------------
 src/st/st-widget.h             |    9 +
 tests/Makefile.am              |    1 +
 tests/interactive/css-fonts.js |   39 ++
 tests/interactive/scrolling.js |   28 ++
 tests/run-test.sh.in           |    2 +-
 tests/testcommon/test.css      |   26 ++-
 tests/testcommon/ui.js         |    7 +-
 24 files changed, 466 insertions(+), 2547 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9a0452f..88ca871 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,10 +57,9 @@ PKG_CHECK_MODULES(MUTTER_PLUGIN, gio-unix-2.0 gtk+-2.0 dbus-glib-1 mutter-plugin
                                  gnome-desktop-2.0 >= 2.26 libstartup-notification-1.0
                                  gobject-introspection-1.0 >= 0.6.5)
 PKG_CHECK_MODULES(TIDY, clutter-1.0)
-PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-2.0 libccss-1 >= 0.3.1 clutter-imcontext-0.1)
+PKG_CHECK_MODULES(ST, clutter-1.0 gtk+-2.0 clutter-imcontext-0.1 libcroco-0.6)
 PKG_CHECK_MODULES(BIG, clutter-1.0 gtk+-2.0 librsvg-2.0)
 PKG_CHECK_MODULES(GDMUSER, dbus-glib-1 gtk+-2.0)
-PKG_CHECK_MODULES(TOOLKIT, clutter-1.0 libcroco-0.6)
 PKG_CHECK_MODULES(TRAY, gtk+-2.0)
 
 MUTTER_BIN_DIR=`$PKG_CONFIG --variable=exec_prefix mutter-plugins`/bin
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 4eac5f6..c8d6989 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -25,38 +25,38 @@ StScrollBar
 
 StScrollView
 {
-  scrollbar-width: 16;
-  scrollbar-height: 16;
+  scrollbar-width: 16px;
+  scrollbar-height: 16px;
 }
 
 StButton#up-stepper
 {
-  border-image: url("file://scroll-button-up.png") 5;
+  -st-background-image: url("scroll-button-up.png") 5px;
 }
 
 StButton#up-stepper:hover,
 StButton#up-stepper:active
 {
-  border-image: url("file://scroll-button-up-hover.png") 5;
+  -st-background-image: url("scroll-button-up-hover.png") 5px;
 }
 
 StButton#down-stepper
 {
-  border-image: url("file://scroll-button-down.png") 5;
+  -st-background-image: url("scroll-button-down.png") 5px;
 }
 
 StButton#down-stepper:hover,
 StButton#down-stepper:active
 {
-  border-image: url("file://scroll-button-down-hover.png") 5;
+  -st-background-image: url("scroll-button-down-hover.png") 5px;
 }
 
 StScrollBar StButton#vhandle
 {
-  border-image: url("file://scroll-vhandle.png") 5;
+  -st-background-image: url("scroll-vhandle.png") 5px;
 }
 
 StScrollBar StButton#vhandle:hover
 {
-  border-image: url("file://scroll-vhandle.png") 5;
+  -st-background-image: url("scroll-vhandle.png") 5px;
 }
diff --git a/js/ui/main.js b/js/ui/main.js
index fd577fb..e9dca39 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -76,9 +76,10 @@ function start() {
     for (let i = 0; i < children.length; i++)
         children[i].destroy();
 
-    let style = St.Style.get_default();
+    let themeContext = St.ThemeContext.get_for_stage (global.stage);
     let stylesheetPath = global.datadir + "/theme/gnome-shell.css";
-    style.load_from_file(stylesheetPath);
+    let theme = new St.Theme ({ application_stylesheet: stylesheetPath });
+    themeContext.set_theme (theme);
 
     global.connect('panel-run-dialog', function(panel) {
         // Make sure not more than one run dialog is shown.
diff --git a/src/Makefile-st.am b/src/Makefile-st.am
index 454dce4..d8070ce 100644
--- a/src/Makefile-st.am
+++ b/src/Makefile-st.am
@@ -73,8 +73,6 @@ st_source_h =					\
     st/st-clipboard.h				\
     st/st-entry.h				\
     st/st-label.h				\
-    st/st-stylable.h				\
-    st/st-style.h				\
     st/st-scrollable.h				\
     st/st-scroll-bar.h				\
     st/st-scroll-view.h				\
@@ -108,8 +106,6 @@ st_source_c =					\
     st/st-scrollable.c				\
     st/st-scroll-bar.c				\
     st/st-scroll-view.c				\
-    st/st-stylable.c				\
-    st/st-style.c				\
     st/st-subtexture.c				\
     st/st-texture-cache.c			\
     st/st-texture-frame.c			\
diff --git a/src/st/st-bin.c b/src/st/st-bin.c
index bc3eecb..f48e735 100644
--- a/src/st/st-bin.c
+++ b/src/st/st-bin.c
@@ -40,7 +40,6 @@
 #include "st-bin.h"
 #include "st-enum-types.h"
 #include "st-private.h"
-#include "st-stylable.h"
 
 #define ST_BIN_GET_PRIVATE(obj)       (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_BIN, StBinPrivate))
 
diff --git a/src/st/st-button.c b/src/st/st-button.c
index c17a485..19493fb 100644
--- a/src/st/st-button.c
+++ b/src/st/st-button.c
@@ -35,6 +35,7 @@
 #include "config.h"
 #endif
 
+#include <math.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -45,8 +46,6 @@
 #include "st-button.h"
 
 #include "st-marshal.h"
-#include "st-stylable.h"
-#include "st-style.h"
 #include "st-texture-frame.h"
 #include "st-texture-cache.h"
 #include "st-private.h"
@@ -94,51 +93,16 @@ struct _StButtonPrivate
 
 static guint button_signals[LAST_SIGNAL] = { 0, };
 
-static void st_stylable_iface_init (StStylableIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (StButton, st_button, ST_TYPE_BIN,
-                         G_IMPLEMENT_INTERFACE (ST_TYPE_STYLABLE,
-                                                st_stylable_iface_init));
-
-static void
-st_stylable_iface_init (StStylableIface *iface)
-{
-  static gboolean is_initialized = FALSE;
-
-  if (G_UNLIKELY (!is_initialized))
-    {
-      ClutterColor bg_color = { 0xcc, 0xcc, 0xcc, 0x00 };
-      GParamSpec *pspec;
-
-      is_initialized = TRUE;
-
-      pspec = g_param_spec_int ("border-spacing",
-                                "Border Spacing",
-                                "Spacing between internal elements",
-                                0, G_MAXINT, 6,
-                                G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_BUTTON, pspec);
-
-
-      is_initialized = TRUE;
-
-      pspec = clutter_param_spec_color ("background-color",
-                                        "Background Color",
-                                        "The background color of an actor",
-                                        &bg_color,
-                                        G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_BUTTON, pspec);
-    }
-}
+G_DEFINE_TYPE (StButton, st_button, ST_TYPE_BIN);
 
 static void
 st_button_update_label_style (StButton *button)
 {
-  ClutterColor *real_color = NULL;
-  gchar *font_string = NULL;
-  gchar *font_name = NULL;
-  gint font_size = 0;
   ClutterActor *label;
+  StThemeNode *theme_node;
+  ClutterColor color;
+  const PangoFontDescription *font;
+  gchar *font_string = NULL;
 
   label = st_bin_get_child ((StBin*) button);
 
@@ -146,37 +110,15 @@ st_button_update_label_style (StButton *button)
   if (!CLUTTER_IS_TEXT (label))
     return;
 
-  st_stylable_get (ST_STYLABLE (button),
-                   "color", &real_color,
-                   "font-family", &font_name,
-                   "font-size", &font_size,
-                   NULL);
-
-  if (font_name || font_size)
-    {
-      if (font_name && font_size)
-        font_string = g_strdup_printf ("%s %dpx", font_name, font_size);
-      else
-        {
-          if (font_size)
-            font_string = g_strdup_printf ("%dpx", font_size);
-          else
-            font_string = font_name;
-        }
-
-      clutter_text_set_font_name (CLUTTER_TEXT (label), font_string);
-
-      if (font_string != font_name)
-        g_free (font_string);
-    }
+  theme_node = st_widget_get_theme_node (ST_WIDGET (button));
 
-  g_free (font_name);
+  st_theme_node_get_foreground_color (theme_node, &color);
+  clutter_text_set_color (CLUTTER_TEXT (label), &color);
 
-  if (real_color)
-    {
-      clutter_text_set_color (CLUTTER_TEXT (label), real_color);
-      clutter_color_free (real_color);
-    }
+  font = st_theme_node_get_font (theme_node);
+  font_string = pango_font_description_to_string (font);
+  clutter_text_set_font_name (CLUTTER_TEXT (label), font_string);
+  g_free (font_string);
 }
 
 static void
@@ -197,19 +139,6 @@ st_button_dispose_old_bg (StButton *button)
 }
 
 static void
-st_button_stylable_changed (StStylable *stylable)
-{
-  StButton *button = ST_BUTTON (stylable);
-  ClutterActor *bg_image;
-
-  st_button_dispose_old_bg (button);
-
-  bg_image = st_widget_get_border_image ((StWidget*) button);
-  if (bg_image)
-    button->priv->old_bg = g_object_ref (bg_image);
-}
-
-static void
 st_animation_completed (ClutterAnimation *animation,
                         StButton         *button)
 {
@@ -222,11 +151,21 @@ st_button_style_changed (StWidget *widget)
   StButton *button = ST_BUTTON (widget);
   StButtonPrivate *priv = button->priv;
   StButtonClass *button_class = ST_BUTTON_GET_CLASS (button);
+  StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (button));
+  ClutterActor *bg_image;
+  double spacing;
 
-  /* get the spacing value */
-  st_stylable_get (ST_STYLABLE (widget),
-                   "border-spacing", &priv->spacing,
-                   NULL);
+  st_button_dispose_old_bg (button);
+
+  bg_image = st_widget_get_border_image ((StWidget*) button);
+  if (bg_image)
+    button->priv->old_bg = g_object_ref (bg_image);
+
+  ST_WIDGET_CLASS (st_button_parent_class)->style_changed (widget);
+
+  spacing = 6;
+  st_theme_node_get_length (theme_node, "border-spacing", FALSE, &spacing);
+  priv->spacing = round (spacing);
 
   /* update the label styling */
   st_button_update_label_style (button);
@@ -527,6 +466,7 @@ st_button_class_init (StButtonClass *klass)
   actor_class->unmap = st_button_unmap;
 
   widget_class->draw_background = st_button_draw_background;
+  widget_class->style_changed = st_button_style_changed;
 
   pspec = g_param_spec_string ("label",
                                "Label",
@@ -580,12 +520,6 @@ st_button_init (StButton *button)
   button->priv->spacing = 6;
 
   clutter_actor_set_reactive ((ClutterActor *) button, TRUE);
-
-  g_signal_connect (button, "style-changed",
-                    G_CALLBACK (st_button_style_changed), NULL);
-
-  g_signal_connect (button, "stylable-changed",
-                    G_CALLBACK (st_button_stylable_changed), NULL);
 }
 
 /**
@@ -673,7 +607,8 @@ st_button_set_label (StButton    *button,
       st_bin_set_child ((StBin*) button, label);
     }
 
-  st_stylable_changed ((StStylable*) button);
+  /* Fake a style change so that we reset the style properties on the label */
+  st_widget_style_changed (ST_WIDGET (button));
 
   g_object_notify (G_OBJECT (button), "label");
 }
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index f225625..9a17b51 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -58,7 +58,6 @@
 #include "st-entry.h"
 
 #include "st-widget.h"
-#include "st-stylable.h"
 #include "st-texture-cache.h"
 #include "st-marshal.h"
 #include "st-clipboard.h"
@@ -101,11 +100,7 @@ struct _StEntryPrivate
 
 static guint entry_signals[LAST_SIGNAL] = { 0, };
 
-static void st_stylable_iface_init (StStylableIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (StEntry, st_entry, ST_TYPE_WIDGET,
-                         G_IMPLEMENT_INTERFACE (ST_TYPE_STYLABLE,
-                                                st_stylable_iface_init));
+G_DEFINE_TYPE (StEntry, st_entry, ST_TYPE_WIDGET);
 
 static void
 st_entry_set_property (GObject      *gobject,
@@ -176,90 +171,31 @@ st_entry_finalize (GObject *object)
 }
 
 static void
-st_stylable_iface_init (StStylableIface *iface)
-{
-  static gboolean is_initialized = FALSE;
-
-  if (!is_initialized)
-    {
-      GParamSpec *pspec;
-      static const ClutterColor default_color
-        = { 0x0, 0x9c, 0xcf, 0xff };
-
-      is_initialized = TRUE;
-
-      pspec = clutter_param_spec_color ("caret-color",
-                                        "Caret Color",
-                                        "Color of the entry's caret",
-                                        &default_color,
-                                        G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_ENTRY, pspec);
-
-      pspec = clutter_param_spec_color ("selection-background-color",
-                                        "Selection Background Color",
-                                        "Color of the entry's selection",
-                                        &default_color,
-                                        G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_ENTRY, pspec);
-    }
-}
-
-static void
 st_entry_style_changed (StWidget *self)
 {
   StEntryPrivate *priv = ST_ENTRY_PRIV (self);
-  ClutterColor *color = NULL;
-  ClutterColor *caret_color = NULL;
-  ClutterColor *selection_background_color = NULL;
-  gchar *font_name;
+  StThemeNode *theme_node;
+  ClutterColor color;
+  const PangoFontDescription *font;
   gchar *font_string;
-  gint font_size;
-
-  st_stylable_get (ST_STYLABLE (self),
-                   "color", &color,
-                   "caret-color", &caret_color,
-                   "selection-background-color", &selection_background_color,
-                   "font-family", &font_name,
-                   "font-size", &font_size,
-                   NULL);
 
-  if (color)
-    {
-      clutter_text_set_color (CLUTTER_TEXT (priv->entry), color);
-      clutter_color_free (color);
-    }
+  theme_node = st_widget_get_theme_node (self);
+ 
+  st_theme_node_get_foreground_color (theme_node, &color);
+  clutter_text_set_color (CLUTTER_TEXT (priv->entry), &color);
 
-  if (caret_color)
-    {
-      clutter_text_set_cursor_color (CLUTTER_TEXT (priv->entry), caret_color);
-      clutter_color_free (caret_color);
-    }
+  if (st_theme_node_get_color (theme_node, "caret-color", FALSE, &color))
+    clutter_text_set_cursor_color (CLUTTER_TEXT (priv->entry), &color);
 
-  if (selection_background_color)
-    {
-      clutter_text_set_selection_color (CLUTTER_TEXT (priv->entry),
-                                        selection_background_color);
-      clutter_color_free (selection_background_color);
-    }
+  if (st_theme_node_get_color (theme_node, "selection-background-color", FALSE, &color))
+    clutter_text_set_selection_color (CLUTTER_TEXT (priv->entry), &color);
 
-  if (font_name || font_size)
-    {
-      if (font_name && font_size)
-        {
-          font_string = g_strdup_printf ("%s %dpx", font_name, font_size);
-          g_free (font_name);
-        }
-      else
-        {
-          if (font_size)
-            font_string = g_strdup_printf ("%dpx", font_size);
-          else
-            font_string = font_name;
-        }
+  font = st_theme_node_get_font (theme_node);
+  font_string = pango_font_description_to_string (font);
+  clutter_text_set_font_name (CLUTTER_TEXT (priv->entry), font_string);
+  g_free (font_string);
 
-      clutter_text_set_font_name (CLUTTER_TEXT (priv->entry), font_string);
-      g_free (font_string);
-    }
+  ST_WIDGET_CLASS (st_entry_parent_class)->style_changed (self);
 }
 
 static void
@@ -636,6 +572,7 @@ st_entry_class_init (StEntryClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
+  StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
   GParamSpec *pspec;
 
   g_type_class_add_private (klass, sizeof (StEntryPrivate));
@@ -656,6 +593,8 @@ st_entry_class_init (StEntryClass *klass)
   actor_class->key_press_event = st_entry_key_press_event;
   actor_class->key_focus_in = st_entry_key_focus_in;
 
+  widget_class->style_changed = st_entry_style_changed;
+
   pspec = g_param_spec_string ("text",
                                "Text",
                                "Text of the entry",
@@ -725,9 +664,6 @@ st_entry_init (StEntry *entry)
 
   /* set cursor hidden until we receive focus */
   clutter_text_set_cursor_visible ((ClutterText *) priv->entry, FALSE);
-
-  g_signal_connect (entry, "style-changed",
-                    G_CALLBACK (st_entry_style_changed), NULL);
 }
 
 /**
diff --git a/src/st/st-label.c b/src/st/st-label.c
index 0701a0b..8d719dc 100644
--- a/src/st/st-label.c
+++ b/src/st/st-label.c
@@ -45,7 +45,6 @@
 #include "st-label.h"
 
 #include "st-widget.h"
-#include "st-stylable.h"
 
 enum
 {
@@ -106,43 +105,23 @@ st_label_get_property (GObject    *gobject,
 static void
 st_label_style_changed (StWidget *self)
 {
-  StLabelPrivate *priv = ST_LABEL (self)->priv;
-  ClutterColor *color = NULL;
-  gchar *font_name;
+  StLabelPrivate *priv;
+  StThemeNode *theme_node;
+  ClutterColor color;
+  const PangoFontDescription *font;
   gchar *font_string;
-  gint font_size;
-
-  st_stylable_get (ST_STYLABLE (self),
-                   "color", &color,
-                   "font-family", &font_name,
-                   "font-size", &font_size,
-                   NULL);
 
-  if (color)
-    {
-      clutter_text_set_color (CLUTTER_TEXT (priv->label), color);
-      clutter_color_free (color);
-    }
+  priv = ST_LABEL (self)->priv;
+  theme_node = st_widget_get_theme_node (self);
+  st_theme_node_get_foreground_color (theme_node, &color);
+  clutter_text_set_color (CLUTTER_TEXT (priv->label), &color);
 
-  if (font_name || font_size)
-    {
-      if (font_name && font_size)
-        {
-          font_string = g_strdup_printf ("%s %dpx", font_name, font_size);
-          g_free (font_name);
-        }
-      else
-        {
-          if (font_size)
-            font_string = g_strdup_printf ("%dpx", font_size);
-          else
-            font_string = font_name;
-        }
-
-      clutter_text_set_font_name (CLUTTER_TEXT (priv->label), font_string);
-      g_free (font_string);
-    }
+  font = st_theme_node_get_font (theme_node);
+  font_string = pango_font_description_to_string (font);
+  clutter_text_set_font_name (CLUTTER_TEXT (priv->label), font_string);
+  g_free (font_string);
 
+  ST_WIDGET_CLASS (st_label_parent_class)->style_changed (self);
 }
 
 static void
@@ -249,6 +228,7 @@ st_label_class_init (StLabelClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
+  StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
   GParamSpec *pspec;
 
   g_type_class_add_private (klass, sizeof (StLabelPrivate));
@@ -263,6 +243,8 @@ st_label_class_init (StLabelClass *klass)
   actor_class->map = st_label_map;
   actor_class->unmap = st_label_unmap;
 
+  widget_class->style_changed = st_label_style_changed;
+
   pspec = g_param_spec_string ("text",
                                "Text",
                                "Text of the label",
@@ -283,9 +265,6 @@ st_label_init (StLabel *label)
                                      NULL);
 
   clutter_actor_set_parent (priv->label, CLUTTER_ACTOR (label));
-
-  g_signal_connect (label, "style-changed",
-                    G_CALLBACK (st_label_style_changed), NULL);
 }
 
 /**
diff --git a/src/st/st-scroll-bar.c b/src/st/st-scroll-bar.c
index 5e33d43..fdfbd59 100644
--- a/src/st/st-scroll-bar.c
+++ b/src/st/st-scroll-bar.c
@@ -40,16 +40,11 @@
 #include "st-scroll-bar.h"
 #include "st-bin.h"
 #include "st-marshal.h"
-#include "st-stylable.h"
 #include "st-enum-types.h"
 #include "st-private.h"
 #include "st-button.h"
 
-static void st_stylable_iface_init (StStylableIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (StScrollBar, st_scroll_bar, ST_TYPE_BIN,
-                         G_IMPLEMENT_INTERFACE (ST_TYPE_STYLABLE,
-                                                st_stylable_iface_init))
+G_DEFINE_TYPE (StScrollBar, st_scroll_bar, ST_TYPE_BIN)
 
 #define ST_SCROLL_BAR_GET_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), ST_TYPE_SCROLL_BAR, StScrollBarPrivate))
 
@@ -345,10 +340,10 @@ st_scroll_bar_allocate (ClutterActor          *actor,
 
   if (priv->adjustment)
     {
-      gfloat handle_size, position, avail_size;
-      gdouble value, lower, upper, page_size, increment;
+      StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
+      float handle_size, position, avail_size;
+      gdouble value, lower, upper, page_size, increment, min_size, max_size;
       ClutterActorBox handle_box = { 0, };
-      guint min_size, max_size;
 
       st_adjustment_get_values (priv->adjustment,
                                 &value,
@@ -364,10 +359,10 @@ st_scroll_bar_allocate (ClutterActor          *actor,
       else
         increment = page_size / (upper - lower);
 
-      st_stylable_get (ST_STYLABLE (actor),
-                       "min-size", &min_size,
-                       "max-size", &max_size,
-                       NULL);
+      min_size = 32.;
+      st_theme_node_get_length (theme_node, "min-size", FALSE, &min_size);
+      max_size = G_MAXINT16;
+      st_theme_node_get_length (theme_node, "max-size", FALSE, &max_size);
 
       if (upper - lower - page_size <= 0)
         position = 0;
@@ -416,11 +411,12 @@ st_scroll_bar_style_changed (StWidget *widget)
 {
   StScrollBarPrivate *priv = ST_SCROLL_BAR (widget)->priv;
 
-  st_stylable_changed ((StStylable *) priv->bw_stepper);
-  st_stylable_changed ((StStylable *) priv->fw_stepper);
-  st_stylable_changed ((StStylable *) priv->trough);
-  st_stylable_changed ((StStylable *) priv->handle);
+  st_widget_style_changed (ST_WIDGET (priv->bw_stepper));
+  st_widget_style_changed (ST_WIDGET (priv->fw_stepper));
+  st_widget_style_changed (ST_WIDGET (priv->trough));
+  st_widget_style_changed (ST_WIDGET (priv->handle));
 
+  ST_WIDGET_CLASS (st_scroll_bar_parent_class)->style_changed (widget);
 }
 
 static void
@@ -503,6 +499,7 @@ st_scroll_bar_class_init (StScrollBarClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
+  StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
   GParamSpec *pspec;
 
   g_type_class_add_private (klass, sizeof (StScrollBarPrivate));
@@ -519,6 +516,8 @@ st_scroll_bar_class_init (StScrollBarClass *klass)
   actor_class->map            = st_scroll_bar_map;
   actor_class->unmap          = st_scroll_bar_unmap;
 
+  widget_class->style_changed = st_scroll_bar_style_changed;
+
   g_object_class_install_property
                  (object_class,
                  PROP_ADJUSTMENT,
@@ -555,35 +554,6 @@ st_scroll_bar_class_init (StScrollBarClass *klass)
 }
 
 static void
-st_stylable_iface_init (StStylableIface *iface)
-{
-  static gboolean is_initialized = FALSE;
-
-  if (!is_initialized)
-    {
-      GParamSpec *pspec;
-
-      is_initialized = TRUE;
-
-      pspec = g_param_spec_uint ("min-size",
-                                 "Minimum grabber size",
-                                 "Minimum size of the scroll grabber, in px",
-                                 0, G_MAXUINT, 32,
-                                 G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface,
-                                          ST_TYPE_SCROLL_BAR, pspec);
-
-      pspec = g_param_spec_uint ("max-size",
-                                 "Maximum grabber size",
-                                 "Maximum size of the scroll grabber, in px",
-                                 0, G_MAXINT16, G_MAXINT16,
-                                 G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface,
-                                          ST_TYPE_SCROLL_BAR, pspec);
-    }
-}
-
-static void
 move_slider (StScrollBar *bar,
              gfloat       x,
              gfloat       y)
@@ -1046,8 +1016,6 @@ st_scroll_bar_init (StScrollBar *self)
 
   clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE);
 
-  g_signal_connect (self, "style-changed",
-                    G_CALLBACK (st_scroll_bar_style_changed), NULL);
   g_signal_connect (self, "notify::reactive",
                     G_CALLBACK (st_scroll_bar_notify_reactive), NULL);
 }
diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c
index 17c31e2..09fb075 100644
--- a/src/st/st-scroll-view.c
+++ b/src/st/st-scroll-view.c
@@ -36,24 +36,23 @@
 #include "st-marshal.h"
 #include "st-scroll-bar.h"
 #include "st-scrollable.h"
-#include "st-stylable.h"
 #include <clutter/clutter.h>
 
 static void clutter_container_iface_init (ClutterContainerIface *iface);
-static void st_stylable_iface_init (StStylableIface *iface);
 
 static ClutterContainerIface *st_scroll_view_parent_iface = NULL;
 
 G_DEFINE_TYPE_WITH_CODE (StScrollView, st_scroll_view, ST_TYPE_BIN,
                          G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
-                                                clutter_container_iface_init)
-                         G_IMPLEMENT_INTERFACE (ST_TYPE_STYLABLE,
-                                                st_stylable_iface_init))
+                                                clutter_container_iface_init))
 
 #define SCROLL_VIEW_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
                                                              ST_TYPE_SCROLL_VIEW, \
                                                              StScrollViewPrivate))
 
+/* Default width (or height - the narrow dimension) for the scrollbars*/
+#define DEFAULT_SCROLLBAR_WIDTH 24
+
 struct _StScrollViewPrivate
 {
   /* a pointer to the child; this is actually stored
@@ -180,6 +179,28 @@ st_scroll_view_pick (ClutterActor       *actor,
     clutter_actor_paint (priv->vscroll);
 }
 
+static double
+get_scrollbar_width (StScrollView *scroll_view)
+{
+  StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (scroll_view));
+  double result = DEFAULT_SCROLLBAR_WIDTH;
+
+  st_theme_node_get_length (theme_node, "scrollbar-width", FALSE, &result);
+
+  return result;
+}
+
+static double
+get_scrollbar_height (StScrollView *scroll_view)
+{
+  StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (scroll_view));
+  double result = DEFAULT_SCROLLBAR_WIDTH;
+
+  st_theme_node_get_length (theme_node, "scrollbar-height", FALSE, &result);
+
+  return result;
+}
+
 static void
 st_scroll_view_get_preferred_width (ClutterActor *actor,
                                     gfloat        for_height,
@@ -187,7 +208,6 @@ st_scroll_view_get_preferred_width (ClutterActor *actor,
                                     gfloat       *natural_width_p)
 {
   StPadding padding;
-  guint xthickness;
 
   StScrollViewPrivate *priv = ST_SCROLL_VIEW (actor)->priv;
 
@@ -195,9 +215,6 @@ st_scroll_view_get_preferred_width (ClutterActor *actor,
     return;
 
   st_widget_get_padding (ST_WIDGET (actor), &padding);
-  st_stylable_get (ST_STYLABLE (actor),
-                   "scrollbar-width", &xthickness,
-                   NULL);
 
   /* Our natural width is the natural width of the child */
   clutter_actor_get_preferred_width (priv->child,
@@ -214,7 +231,7 @@ st_scroll_view_get_preferred_width (ClutterActor *actor,
                                           NULL,
                                           &natural_height);
       if (for_height < natural_height)
-        *natural_width_p += xthickness;
+        *natural_width_p += get_scrollbar_width (ST_SCROLL_VIEW (actor));
     }
 
   /* Add space for padding */
@@ -232,7 +249,6 @@ st_scroll_view_get_preferred_height (ClutterActor *actor,
                                      gfloat       *natural_height_p)
 {
   StPadding padding;
-  guint ythickness;
 
   StScrollViewPrivate *priv = ST_SCROLL_VIEW (actor)->priv;
 
@@ -240,9 +256,6 @@ st_scroll_view_get_preferred_height (ClutterActor *actor,
     return;
 
   st_widget_get_padding (ST_WIDGET (actor), &padding);
-  st_stylable_get (ST_STYLABLE (actor),
-                   "scrollbar-height", &ythickness,
-                   NULL);
 
   /* Our natural height is the natural height of the child */
   clutter_actor_get_preferred_height (priv->child,
@@ -259,7 +272,7 @@ st_scroll_view_get_preferred_height (ClutterActor *actor,
                                          NULL,
                                          &natural_width);
       if (for_width < natural_width)
-        *natural_height_p += ythickness;
+        *natural_height_p += get_scrollbar_height (ST_SCROLL_VIEW (actor));
     }
 
   /* Add space for padding */
@@ -300,10 +313,8 @@ st_scroll_view_allocate (ClutterActor          *actor,
   avail_width = (box->x2 - box->x1) - padding.left - padding.right;
   avail_height = (box->y2 - box->y1) - padding.top - padding.bottom;
 
-  st_stylable_get (ST_STYLABLE (actor),
-                   "scrollbar-width", &sb_width,
-                   "scrollbar-height", &sb_height,
-                   NULL);
+  sb_width = get_scrollbar_width (ST_SCROLL_VIEW (actor));
+  sb_height = get_scrollbar_width (ST_SCROLL_VIEW (actor));
 
   if (!CLUTTER_ACTOR_IS_VISIBLE (priv->vscroll))
     sb_width = 0;
@@ -349,8 +360,10 @@ st_scroll_view_style_changed (StWidget *widget)
 {
   StScrollViewPrivate *priv = ST_SCROLL_VIEW (widget)->priv;
 
-  st_stylable_changed ((StStylable *) priv->hscroll);
-  st_stylable_changed ((StStylable *) priv->vscroll);
+  st_widget_style_changed (ST_WIDGET (priv->hscroll));
+  st_widget_style_changed (ST_WIDGET (priv->vscroll));
+
+  ST_WIDGET_CLASS (st_scroll_view_parent_class)->style_changed (widget);
 }
 
 static gboolean
@@ -433,6 +446,7 @@ st_scroll_view_class_init (StScrollViewClass *klass)
   GParamSpec *pspec;
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
+  StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
 
   g_type_class_add_private (klass, sizeof (StScrollViewPrivate));
 
@@ -448,6 +462,8 @@ st_scroll_view_class_init (StScrollViewClass *klass)
   actor_class->allocate = st_scroll_view_allocate;
   actor_class->scroll_event = st_scroll_view_scroll_event;
 
+  widget_class->style_changed = st_scroll_view_style_changed;
+
   g_object_class_install_property (object_class,
                                    PROP_HSCROLL,
                                    g_param_spec_object ("hscroll",
@@ -476,33 +492,6 @@ st_scroll_view_class_init (StScrollViewClass *klass)
 }
 
 static void
-st_stylable_iface_init (StStylableIface *iface)
-{
-  static gboolean is_initialized = FALSE;
-
-  if (!is_initialized)
-    {
-      GParamSpec *pspec;
-
-      is_initialized = TRUE;
-
-      pspec = g_param_spec_uint ("scrollbar-width",
-                                 "Vertical scroll-bar thickness",
-                                 "Thickness of vertical scrollbar, in px",
-                                 0, G_MAXUINT, 24,
-                                 G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_SCROLL_VIEW, pspec);
-
-      pspec = g_param_spec_uint ("scrollbar-height",
-                                 "Horizontal scroll-bar thickness",
-                                 "Thickness of horizontal scrollbar, in px",
-                                 0, G_MAXUINT, 24,
-                                 G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_SCROLL_VIEW, pspec);
-    }
-}
-
-static void
 child_adjustment_changed_cb (StAdjustment *adjustment,
                              ClutterActor *bar)
 {
@@ -609,9 +598,6 @@ st_scroll_view_init (StScrollView *self)
   priv->mouse_scroll = TRUE;
   g_object_set (G_OBJECT (self), "reactive", TRUE, "clip-to-allocation", TRUE,
                 NULL);
-
-  g_signal_connect (self, "style-changed",
-                    G_CALLBACK (st_scroll_view_style_changed), NULL);
 }
 
 static void
diff --git a/src/st/st-tooltip.c b/src/st/st-tooltip.c
index 2ba9b41..bdbef3a 100644
--- a/src/st/st-tooltip.c
+++ b/src/st/st-tooltip.c
@@ -45,7 +45,6 @@
 #include "st-tooltip.h"
 
 #include "st-widget.h"
-#include "st-stylable.h"
 #include "st-private.h"
 
 enum
@@ -121,44 +120,24 @@ st_tooltip_get_property (GObject    *gobject,
 static void
 st_tooltip_style_changed (StWidget *self)
 {
-  ClutterColor *color = NULL;
   StTooltipPrivate *priv;
-  gchar *font_name;
+  StThemeNode *theme_node;
+  ClutterColor color;
+  const PangoFontDescription *font;
   gchar *font_string;
-  gint font_size;
 
   priv = ST_TOOLTIP (self)->priv;
+  theme_node = st_widget_get_theme_node (self);
 
-  st_stylable_get (ST_STYLABLE (self),
-                   "color", &color,
-                   "font-family", &font_name,
-                   "font-size", &font_size,
-                   NULL);
+  st_theme_node_get_foreground_color (theme_node, &color);
+  clutter_text_set_color (CLUTTER_TEXT (priv->label), &color);
 
-  if (color)
-    {
-      clutter_text_set_color (CLUTTER_TEXT (priv->label), color);
-      clutter_color_free (color);
-    }
-
-  if (font_name || font_size)
-    {
-      if (font_name && font_size)
-        {
-          font_string = g_strdup_printf ("%s %dpx", font_name, font_size);
-          g_free (font_name);
-        }
-      else
-      if (font_size)
-        font_string = g_strdup_printf ("%dpx", font_size);
-      else
-        font_string = font_name;
-
-      clutter_text_set_font_name (CLUTTER_TEXT (priv->label), font_string);
-
-      g_free (font_string);
-    }
+  font = st_theme_node_get_font (theme_node);
+  font_string = pango_font_description_to_string (font);
+  clutter_text_set_font_name (CLUTTER_TEXT (priv->label), font_string);
+  g_free (font_string);
 
+  ST_WIDGET_CLASS (st_tooltip_parent_class)->style_changed (self);
 }
 
 static void
@@ -406,6 +385,7 @@ st_tooltip_class_init (StTooltipClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
+  StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
   GParamSpec *pspec;
 
   g_type_class_add_private (klass, sizeof (StTooltipPrivate));
@@ -420,6 +400,8 @@ st_tooltip_class_init (StTooltipClass *klass)
   actor_class->map = st_tooltip_map;
   actor_class->unmap = st_tooltip_unmap;
 
+  widget_class->style_changed = st_tooltip_style_changed;
+
   pspec = g_param_spec_string ("label",
                                "Label",
                                "Label of the tooltip",
@@ -453,9 +435,6 @@ st_tooltip_init (StTooltip *tooltip)
   g_object_set (tooltip, "show-on-set-parent", FALSE, NULL);
 
   clutter_actor_set_reactive (CLUTTER_ACTOR (tooltip), FALSE);
-
-  g_signal_connect (tooltip, "style-changed",
-                    G_CALLBACK (st_tooltip_style_changed), NULL);
 }
 
 static void
diff --git a/src/st/st-types.h b/src/st/st-types.h
index ab775ed..c434125 100644
--- a/src/st/st-types.h
+++ b/src/st/st-types.h
@@ -37,13 +37,10 @@
 
 G_BEGIN_DECLS
 
-#define ST_TYPE_BORDER_IMAGE          (st_border_image_get_type ())
 #define ST_TYPE_PADDING               (st_padding_get_type ())
 
 typedef struct _StPadding             StPadding;
 
-GType st_border_image_get_type (void) G_GNUC_CONST;
-
 /**
  * StPadding:
  * @top: padding from the top
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index eb7a080..29cdb05 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -32,19 +32,16 @@
 #include <string.h>
 
 #include <clutter/clutter.h>
-#include <ccss/ccss.h>
 
 #include "st-widget.h"
 
 #include "st-marshal.h"
 #include "st-private.h"
-#include "st-stylable.h"
 #include "st-texture-cache.h"
 #include "st-texture-frame.h"
+#include "st-theme-context.h"
 #include "st-tooltip.h"
 
-typedef ccss_border_image_t StBorderImage;
-
 /*
  * Forward declaration for sake of StWidgetChild
  */
@@ -53,13 +50,14 @@ struct _StWidgetPrivate
   StPadding     border;
   StPadding     padding;
 
-  StStyle      *style;
+  StTheme      *theme;
+  StThemeNode  *theme_node;
   gchar        *pseudo_class;
   gchar        *style_class;
 
   ClutterActor *border_image;
   ClutterActor *background_image;
-  ClutterColor *bg_color;
+  ClutterColor  bg_color;
 
   gboolean      is_stylable : 1;
   gboolean      has_tooltip : 1;
@@ -83,7 +81,7 @@ enum
 {
   PROP_0,
 
-  PROP_STYLE,
+  PROP_THEME,
   PROP_PSEUDO_CLASS,
   PROP_STYLE_CLASS,
 
@@ -93,12 +91,16 @@ enum
   PROP_TOOLTIP_TEXT
 };
 
-static void st_stylable_iface_init (StStylableIface *iface);
+enum
+{
+  STYLE_CHANGED,
+
+  LAST_SIGNAL
+};
 
+static guint signals[LAST_SIGNAL] = { 0, };
 
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (StWidget, st_widget, CLUTTER_TYPE_ACTOR,
-                                  G_IMPLEMENT_INTERFACE (ST_TYPE_STYLABLE,
-                                                         st_stylable_iface_init));
+G_DEFINE_ABSTRACT_TYPE (StWidget, st_widget, CLUTTER_TYPE_ACTOR);
 
 #define ST_WIDGET_GET_PRIVATE(obj)    (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ST_TYPE_WIDGET, StWidgetPrivate))
 
@@ -112,9 +114,8 @@ st_widget_set_property (GObject      *gobject,
 
   switch (prop_id)
     {
-    case PROP_STYLE:
-      st_stylable_set_style (ST_STYLABLE (actor),
-                             g_value_get_object (value));
+    case PROP_THEME:
+      st_widget_set_theme (actor, g_value_get_object (value));
       break;
 
     case PROP_PSEUDO_CLASS:
@@ -158,8 +159,8 @@ st_widget_get_property (GObject    *gobject,
 
   switch (prop_id)
     {
-    case PROP_STYLE:
-      g_value_set_object (value, priv->style);
+    case PROP_THEME:
+      g_value_set_object (value, priv->theme);
       break;
 
     case PROP_PSEUDO_CLASS:
@@ -194,10 +195,10 @@ st_widget_dispose (GObject *gobject)
   StWidget *actor = ST_WIDGET (gobject);
   StWidgetPrivate *priv = ST_WIDGET (actor)->priv;
 
-  if (priv->style)
+  if (priv->theme)
     {
-      g_object_unref (priv->style);
-      priv->style = NULL;
+      g_object_unref (priv->theme);
+      priv->theme = NULL;
     }
 
   if (priv->border_image)
@@ -206,12 +207,6 @@ st_widget_dispose (GObject *gobject)
       priv->border_image = NULL;
     }
 
-  if (priv->bg_color)
-    {
-      clutter_color_free (priv->bg_color);
-      priv->bg_color = NULL;
-    }
-
   if (priv->tooltip)
     {
       ClutterContainer *parent;
@@ -387,7 +382,7 @@ st_widget_paint (ClutterActor *self)
 
   klass->draw_background (ST_WIDGET (self),
                           priv->border_image,
-                          priv->bg_color);
+                          &priv->bg_color);
 
   if (priv->background_image != NULL)
     clutter_actor_paint (priv->background_image);
@@ -408,7 +403,7 @@ st_widget_parent_set (ClutterActor *widget,
 
   /* don't send the style changed signal if we no longer have a parent actor */
   if (new_parent)
-    st_stylable_changed ((StStylable*) widget);
+    st_widget_style_changed (ST_WIDGET (widget));
 }
 
 static void
@@ -447,69 +442,67 @@ st_widget_unmap (ClutterActor *actor)
     clutter_actor_unmap ((ClutterActor *) priv->tooltip);
 }
 
+static void notify_children_of_style_change (ClutterContainer *container);
+
 static void
-st_widget_style_changed (StStylable *self)
+notify_children_of_style_change_foreach (ClutterActor *actor,
+                                         gpointer      user_data)
+{
+  if (ST_IS_WIDGET (actor))
+    st_widget_style_changed (ST_WIDGET (actor));
+  else if (CLUTTER_IS_CONTAINER (actor))
+    notify_children_of_style_change ((ClutterContainer *)actor);
+}
+
+static void
+notify_children_of_style_change (ClutterContainer *container)
+{
+  /* notify our children that their parent stylable has changed */
+  clutter_container_foreach (container,
+                             notify_children_of_style_change_foreach,
+                             NULL);
+}
+
+static void
+st_widget_real_style_changed (StWidget *self)
 {
   StWidgetPrivate *priv = ST_WIDGET (self)->priv;
-  StBorderImage *border_image = NULL;
+  StThemeNode *theme_node;
+  StThemeImage *theme_image;
   StTextureCache *texture_cache;
   ClutterTexture *texture;
-  gchar *bg_file = NULL;
-  StPadding *padding = NULL;
+  const char *bg_file = NULL;
   gboolean relayout_needed = FALSE;
   gboolean has_changed = FALSE;
-  ClutterColor *color;
+  StPadding padding;
+  ClutterColor color;
 
   /* application has request this widget is not stylable */
   if (!priv->is_stylable)
     return;
 
-  /* cache these values for use in the paint function */
-  st_stylable_get (self,
-                   "background-color", &color,
-                   "background-image", &bg_file,
-                   "border-image", &border_image,
-                   "padding", &padding,
-                   NULL);
+  theme_node = st_widget_get_theme_node (self);
 
-  if (color)
+  st_theme_node_get_background_color (theme_node, &color);
+  if (!clutter_color_equal (&color, &priv->bg_color))
     {
-      if (priv->bg_color && clutter_color_equal (color, priv->bg_color))
-        {
-          /* color is the same ... */
-          clutter_color_free (color);
-        }
-      else
-        {
-          clutter_color_free (priv->bg_color);
-          priv->bg_color = color;
-          has_changed = TRUE;
-        }
-    }
-  else
-  if (priv->bg_color)
-    {
-      clutter_color_free (priv->bg_color);
-      priv->bg_color = NULL;
+      priv->bg_color = color;
       has_changed = TRUE;
     }
 
+  padding.top = st_theme_node_get_padding (theme_node, ST_SIDE_TOP);
+  padding.right = st_theme_node_get_padding (theme_node, ST_SIDE_RIGHT);
+  padding.bottom = st_theme_node_get_padding (theme_node, ST_SIDE_BOTTOM);
+  padding.left = st_theme_node_get_padding (theme_node, ST_SIDE_LEFT);
 
-
-  if (padding)
+  if (priv->padding.top != padding.top ||
+      priv->padding.left != padding.left ||
+      priv->padding.right != padding.right ||
+      priv->padding.bottom != padding.bottom)
     {
-      if (priv->padding.top != padding->top ||
-          priv->padding.left != padding->left ||
-          priv->padding.right != padding->right ||
-          priv->padding.bottom != padding->bottom)
-        {
-          /* Padding changed. Need to relayout. */
-          has_changed = TRUE;
-          relayout_needed = TRUE;
-        }
-
-      priv->padding = *padding;
-      g_boxed_free (ST_TYPE_PADDING, padding);
+      priv->padding = padding;
+      has_changed = TRUE;
+      relayout_needed = TRUE;
     }
 
   if (priv->border_image)
@@ -526,25 +519,26 @@ st_widget_style_changed (StStylable *self)
 
   texture_cache = st_texture_cache_get_default ();
 
-  /* Check if the URL is actually present, not garbage in the property */
-  if (border_image && border_image->uri)
+  theme_image = st_theme_node_get_background_theme_image (theme_node);
+  if (theme_image)
     {
+      const char *filename;
       gint border_left, border_right, border_top, border_bottom;
       gint width, height;
 
+      filename = st_theme_image_get_filename (theme_image);
+
       /* `border-image' takes precedence over `background-image'.
        * Firefox lets the background-image shine thru when border-image has
        * alpha an channel, maybe that would be an option for the future. */
       texture = st_texture_cache_get_texture (texture_cache,
-                                              border_image->uri);
+                                                filename);
 
       clutter_texture_get_base_size (CLUTTER_TEXTURE (texture),
                                      &width, &height);
 
-      border_left = ccss_position_get_size (&border_image->left, width);
-      border_top = ccss_position_get_size (&border_image->top, height);
-      border_right = ccss_position_get_size (&border_image->right, width);
-      border_bottom = ccss_position_get_size (&border_image->bottom, height);
+      st_theme_image_get_borders (theme_image,
+                                     &border_left, &border_right, &border_top, &border_bottom);
 
       priv->border_image = st_texture_frame_new (texture,
                                                  border_top,
@@ -552,14 +546,13 @@ st_widget_style_changed (StStylable *self)
                                                  border_bottom,
                                                  border_left);
       clutter_actor_set_parent (priv->border_image, CLUTTER_ACTOR (self));
-      g_boxed_free (ST_TYPE_BORDER_IMAGE, border_image);
 
       has_changed = TRUE;
       relayout_needed = TRUE;
     }
 
-  if (bg_file != NULL &&
-      strcmp (bg_file, "none"))
+  bg_file = st_theme_node_get_background_image (theme_node);
+  if (bg_file != NULL)
     {
       texture = st_texture_cache_get_texture (texture_cache, bg_file);
       priv->background_image = (ClutterActor*) texture;
@@ -575,7 +568,6 @@ st_widget_style_changed (StStylable *self)
       has_changed = TRUE;
       relayout_needed = TRUE;
     }
-  g_free (bg_file);
 
   /* If there are any properties above that need to cause a relayout thay
    * should set this flag.
@@ -588,37 +580,89 @@ st_widget_style_changed (StStylable *self)
         clutter_actor_queue_redraw ((ClutterActor *) self);
     }
 
-  priv->is_style_dirty = FALSE;
+  if (CLUTTER_IS_CONTAINER (self))
+    notify_children_of_style_change ((ClutterContainer *)self);
 }
 
-static void
-st_widget_stylable_child_notify (ClutterActor *actor,
-                                 gpointer      user_data)
+void
+st_widget_style_changed (StWidget *widget)
 {
-  if (ST_IS_STYLABLE (actor))
-    st_stylable_changed ((StStylable*) actor);
+  widget->priv->is_style_dirty = TRUE;
+  if (widget->priv->theme_node)
+    {
+      g_object_unref (widget->priv->theme_node);
+      widget->priv->theme_node = NULL;
+    }
+
+  /* update the style only if we are mapped */
+  if (!CLUTTER_ACTOR_IS_MAPPED (CLUTTER_ACTOR (widget)))
+    return;
+
+  st_widget_ensure_style (widget);
 }
 
 static void
-st_widget_stylable_changed (StStylable *stylable)
+on_theme_context_changed (StThemeContext *context,
+                          ClutterStage      *stage)
 {
+  notify_children_of_style_change (CLUTTER_CONTAINER (stage));
+}
 
-  ST_WIDGET (stylable)->priv->is_style_dirty = TRUE;
+static StThemeNode *
+get_root_theme_node (ClutterStage *stage)
+{
+  StThemeContext *context = st_theme_context_get_for_stage (stage);
 
-  /* update the style only if we are mapped */
-  if (!CLUTTER_ACTOR_IS_MAPPED ((ClutterActor *) stylable))
-    return;
+  if (!g_object_get_data (G_OBJECT (context), "st-theme-initialized"))
+    {
+      g_object_set_data (G_OBJECT (context), "st-theme-initialized", GUINT_TO_POINTER (1));
+      g_signal_connect (G_OBJECT (context), "changed",
+                        G_CALLBACK (on_theme_context_changed), stage);
+    }
 
-  g_signal_emit_by_name (stylable, "style-changed", 0);
+  return st_theme_context_get_root_node (context);
+}
 
+StThemeNode *
+st_widget_get_theme_node (StWidget *widget)
+{
+  StWidgetPrivate *priv = widget->priv;
 
-  if (CLUTTER_IS_CONTAINER (stylable))
+  if (priv->theme_node == NULL)
     {
-      /* notify our children that their parent stylable has changed */
-      clutter_container_foreach ((ClutterContainer *) stylable,
-                                 st_widget_stylable_child_notify,
-                                 NULL);
+      StThemeNode *parent_node = NULL;
+      ClutterStage *stage = NULL;
+      ClutterActor *parent;
+
+      parent = clutter_actor_get_parent (CLUTTER_ACTOR (widget));
+      while (parent != NULL)
+        {
+          if (parent_node == NULL && ST_IS_WIDGET (parent))
+            parent_node = st_widget_get_theme_node (ST_WIDGET (parent));
+          else if (CLUTTER_IS_STAGE (parent))
+            stage = CLUTTER_STAGE (parent);
+
+          parent = clutter_actor_get_parent (parent);
+        }
+
+      if (stage == NULL)
+        {
+          g_warning ("st_widget_get_theme_node called on a widget not in a stage");
+          stage = CLUTTER_STAGE (clutter_stage_get_default ());
+        }
+
+      if (parent_node == NULL)
+        parent_node = get_root_theme_node (CLUTTER_STAGE (stage));
+
+      priv->theme_node = st_theme_node_new (st_theme_context_get_for_stage (stage),
+                                            parent_node, priv->theme,
+                                            G_OBJECT_TYPE (widget),
+                                            clutter_actor_get_name (CLUTTER_ACTOR (widget)),
+                                            priv->style_class,
+                                            priv->pseudo_class);
     }
+
+  return priv->theme_node;
 }
 
 static gboolean
@@ -691,6 +735,7 @@ st_widget_class_init (StWidgetClass *klass)
   actor_class->hide = st_widget_hide;
 
   klass->draw_background = st_widget_real_draw_background;
+  klass->style_changed = st_widget_real_style_changed;
 
   /**
    * StWidget:pseudo-class:
@@ -718,7 +763,19 @@ st_widget_class_init (StWidgetClass *klass)
                                                         "",
                                                         ST_PARAM_READWRITE));
 
-  g_object_class_override_property (gobject_class, PROP_STYLE, "style");
+  /**
+   * StWidget:theme
+   *
+   * A theme set on this actor overriding the global theming for this actor
+   * and its descendants
+   */
+  g_object_class_install_property (gobject_class,
+                                   PROP_THEME,
+                                   g_param_spec_object ("theme",
+                                                        "Theme",
+                                                        "Theme override",
+                                                        ST_TYPE_THEME,
+                                                        ST_PARAM_READWRITE));
 
   /**
    * StWidget:stylable:
@@ -762,108 +819,66 @@ st_widget_class_init (StWidgetClass *klass)
                                ST_PARAM_READWRITE);
   g_object_class_install_property (gobject_class, PROP_TOOLTIP_TEXT, pspec);
 
+  /**
+   * StWidget::style-changed:
+   *
+   * Emitted when the style information that the widget derives from the
+   * theme changes
+   */
+  signals[STYLE_CHANGED] =
+    g_signal_new ("style-changed",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (StWidgetClass, style_changed),
+                  NULL, NULL,
+                  _st_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
 }
 
-static StStyle *
-st_widget_get_style (StStylable *stylable)
-{
-  StWidgetPrivate *priv = ST_WIDGET (stylable)->priv;
-
-  return priv->style;
-}
-
-static void
-st_style_changed_cb (StStyle    *style,
-                     StStylable *stylable)
-{
-  st_stylable_changed (stylable);
-}
-
-
-static void
-st_widget_set_style (StStylable *stylable,
-                     StStyle    *style)
-{
-  StWidgetPrivate *priv = ST_WIDGET (stylable)->priv;
-
-  if (priv->style)
-    g_object_unref (priv->style);
-
-  priv->style = g_object_ref_sink (style);
-
-  g_signal_connect (priv->style,
-                    "changed",
-                    G_CALLBACK (st_style_changed_cb),
-                    stylable);
-}
-
-static StStylable*
-st_widget_get_container (StStylable *stylable)
-{
-  ClutterActor *parent;
-
-  g_return_val_if_fail (ST_IS_WIDGET (stylable), NULL);
-
-  parent = clutter_actor_get_parent (CLUTTER_ACTOR (stylable));
-
-  if (ST_IS_STYLABLE (parent))
-    return ST_STYLABLE (parent);
-  else
-    return NULL;
-}
-
-static StStylable*
-st_widget_get_base_style (StStylable *stylable)
-{
-  return NULL;
-}
-
-static const gchar*
-st_widget_get_style_id (StStylable *stylable)
+/**
+ * st_widget_set_theme:
+ * @actor: a #StWidget
+ * @theme: a new style class string
+ *
+ * Overrides the theme that would be inherited from the actor's parent
+ * or the stage with an entirely new theme (set of stylesheets).
+ */
+void
+st_widget_set_theme (StWidget  *actor,
+                      StTheme  *theme)
 {
-  g_return_val_if_fail (ST_IS_WIDGET (stylable), NULL);
-
-  return clutter_actor_get_name (CLUTTER_ACTOR (stylable));
-}
+  StWidgetPrivate *priv = actor->priv;
 
-static const gchar*
-st_widget_get_style_type (StStylable *stylable)
-{
-  return G_OBJECT_TYPE_NAME (stylable);
-}
+  g_return_if_fail (ST_IS_WIDGET (actor));
 
-static const gchar*
-st_widget_get_style_class (StStylable *stylable)
-{
-  g_return_val_if_fail (ST_IS_WIDGET (stylable), NULL);
+  priv = actor->priv;
 
-  return ST_WIDGET (stylable)->priv->style_class;
-}
+  if (theme !=priv->theme)
+    {
+      if (priv->theme)
+        g_object_unref (priv->theme);
+      priv->theme = g_object_ref (priv->theme);
 
-static const gchar*
-st_widget_get_pseudo_class (StStylable *stylable)
-{
-  g_return_val_if_fail (ST_IS_WIDGET (stylable), NULL);
+      st_widget_style_changed (actor);
 
-  return ST_WIDGET (stylable)->priv->pseudo_class;
+      g_object_notify (G_OBJECT (actor), "theme");
+    }
 }
 
-static gboolean
-st_widget_get_viewport (StStylable *stylable,
-                        gint       *x,
-                        gint       *y,
-                        gint       *width,
-                        gint       *height)
+/**
+ * st_widget_get_theme:
+ * @actor: a #StWidget
+ *
+ * Gets the overriding theme set on the actor. See st_widget_set_theme()
+ *
+ * Return value: (transfer none): the overriding theme, or %NULL
+ */
+StTheme *
+st_widget_get_theme (StWidget *actor)
 {
-  g_return_val_if_fail (ST_IS_WIDGET (stylable), FALSE);
-
-  *x = 0;
-  *y = 0;
+  g_return_val_if_fail (ST_IS_WIDGET (actor), NULL);
 
-  *width = clutter_actor_get_width (CLUTTER_ACTOR (stylable));
-  *height = clutter_actor_get_height (CLUTTER_ACTOR (stylable));
-
-  return TRUE;
+  return actor->priv->theme;
 }
 
 /**
@@ -879,7 +894,7 @@ st_widget_set_style_class_name (StWidget    *actor,
 {
   StWidgetPrivate *priv = actor->priv;
 
-  g_return_if_fail (ST_WIDGET (actor));
+  g_return_if_fail (ST_IS_WIDGET (actor));
 
   priv = actor->priv;
 
@@ -888,7 +903,7 @@ st_widget_set_style_class_name (StWidget    *actor,
       g_free (priv->style_class);
       priv->style_class = g_strdup (style_class);
 
-      st_stylable_changed ((StStylable*) actor);
+      st_widget_style_changed (actor);
 
       g_object_notify (G_OBJECT (actor), "style-class");
     }
@@ -907,7 +922,7 @@ st_widget_set_style_class_name (StWidget    *actor,
 const gchar*
 st_widget_get_style_class_name (StWidget *actor)
 {
-  g_return_val_if_fail (ST_WIDGET (actor), NULL);
+  g_return_val_if_fail (ST_IS_WIDGET (actor), NULL);
 
   return actor->priv->style_class;
 }
@@ -924,7 +939,7 @@ st_widget_get_style_class_name (StWidget *actor)
 const gchar*
 st_widget_get_style_pseudo_class (StWidget *actor)
 {
-  g_return_val_if_fail (ST_WIDGET (actor), NULL);
+  g_return_val_if_fail (ST_IS_WIDGET (actor), NULL);
 
   return actor->priv->pseudo_class;
 }
@@ -942,7 +957,7 @@ st_widget_set_style_pseudo_class (StWidget    *actor,
 {
   StWidgetPrivate *priv;
 
-  g_return_if_fail (ST_WIDGET (actor));
+  g_return_if_fail (ST_IS_WIDGET (actor));
 
   priv = actor->priv;
 
@@ -951,99 +966,18 @@ st_widget_set_style_pseudo_class (StWidget    *actor,
       g_free (priv->pseudo_class);
       priv->pseudo_class = g_strdup (pseudo_class);
 
-      st_stylable_changed ((StStylable*) actor);
+      st_widget_style_changed (actor);
 
       g_object_notify (G_OBJECT (actor), "pseudo-class");
     }
 }
 
-
-static void
-st_stylable_iface_init (StStylableIface *iface)
-{
-  static gboolean is_initialized = FALSE;
-
-  if (!is_initialized)
-    {
-      GParamSpec *pspec;
-      ClutterColor color = { 0x00, 0x00, 0x00, 0xff };
-      ClutterColor bg_color = { 0xff, 0xff, 0xff, 0x00 };
-
-      is_initialized = TRUE;
-
-      pspec = clutter_param_spec_color ("background-color",
-                                        "Background Color",
-                                        "The background color of an actor",
-                                        &bg_color,
-                                        G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_WIDGET, pspec);
-
-      pspec = clutter_param_spec_color ("color",
-                                        "Text Color",
-                                        "The color of the text of an actor",
-                                        &color,
-                                        G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_WIDGET, pspec);
-
-      pspec = g_param_spec_string ("background-image",
-                                   "Background Image",
-                                   "Background image filename",
-                                   NULL,
-                                   G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_WIDGET, pspec);
-
-      pspec = g_param_spec_string ("font-family",
-                                   "Font Family",
-                                   "Name of the font to use",
-                                   "Sans",
-                                   G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_WIDGET, pspec);
-
-      pspec = g_param_spec_int ("font-size",
-                                "Font Size",
-                                "Size of the font to use in pixels",
-                                0, G_MAXINT, 12,
-                                G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_WIDGET, pspec);
-
-      pspec = g_param_spec_boxed ("border-image",
-                                  "Border image",
-                                  "9-slice image to use for drawing borders and background",
-                                  ST_TYPE_BORDER_IMAGE,
-                                  G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_WIDGET, pspec);
-
-      pspec = g_param_spec_boxed ("padding",
-                                  "Padding",
-                                  "Padding between the widget's borders "
-                                  "and its content",
-                                  ST_TYPE_PADDING,
-                                  G_PARAM_READWRITE);
-      st_stylable_iface_install_property (iface, ST_TYPE_WIDGET, pspec);
-
-      iface->style_changed = st_widget_style_changed;
-      iface->stylable_changed = st_widget_stylable_changed;
-
-      iface->get_style = st_widget_get_style;
-      iface->set_style = st_widget_set_style;
-      iface->get_base_style = st_widget_get_base_style;
-      iface->get_container = st_widget_get_container;
-      iface->get_style_id = st_widget_get_style_id;
-      iface->get_style_type = st_widget_get_style_type;
-      iface->get_style_class = st_widget_get_style_class;
-      iface->get_pseudo_class = st_widget_get_pseudo_class;
-      /* iface->get_attribute = st_widget_get_attribute; */
-      iface->get_viewport = st_widget_get_viewport;
-    }
-}
-
-
 static void
 st_widget_name_notify (StWidget   *widget,
                        GParamSpec *pspec,
                        gpointer    data)
 {
-  st_stylable_changed ((StStylable*) widget);
+  st_widget_style_changed (widget);
 }
 
 static void
@@ -1056,44 +990,6 @@ st_widget_init (StWidget *actor)
 
   /* connect style changed */
   g_signal_connect (actor, "notify::name", G_CALLBACK (st_widget_name_notify), NULL);
-
-  /* set the default style */
-  st_widget_set_style (ST_STYLABLE (actor), st_style_get_default ());
-
-}
-
-static StBorderImage *
-st_border_image_copy (const StBorderImage *border_image)
-{
-  StBorderImage *copy;
-
-  g_return_val_if_fail (border_image != NULL, NULL);
-
-  copy = g_slice_new (StBorderImage);
-  *copy = *border_image;
-
-  return copy;
-}
-
-static void
-st_border_image_free (StBorderImage *border_image)
-{
-  if (G_LIKELY (border_image))
-    g_slice_free (StBorderImage, border_image);
-}
-
-GType
-st_border_image_get_type (void)
-{
-  static GType our_type = 0;
-
-  if (G_UNLIKELY (our_type == 0))
-    our_type =
-      g_boxed_type_register_static (I_("StBorderImage"),
-                                    (GBoxedCopyFunc) st_border_image_copy,
-                                    (GBoxedFreeFunc) st_border_image_free);
-
-  return our_type;
 }
 
 /**
@@ -1110,11 +1006,11 @@ st_widget_ensure_style (StWidget *widget)
 
   if (widget->priv->is_style_dirty)
     {
-      g_signal_emit_by_name (widget, "style-changed", 0);
+      g_signal_emit (widget, signals[STYLE_CHANGED], 0);
+      widget->priv->is_style_dirty = FALSE;
     }
 }
 
-
 /**
  * st_widget_get_border_image:
  * @actor: A #StWidget
@@ -1353,6 +1249,5 @@ st_widget_draw_background (StWidget *self)
   klass = ST_WIDGET_GET_CLASS (self);
   klass->draw_background (ST_WIDGET (self),
                           priv->border_image,
-                          priv->bg_color);
-
+                          &priv->bg_color);
 }
diff --git a/src/st/st-widget.h b/src/st/st-widget.h
index c06cc4f..2c636c9 100644
--- a/src/st/st-widget.h
+++ b/src/st/st-widget.h
@@ -30,6 +30,8 @@
 
 #include <clutter/clutter.h>
 #include <st/st-types.h>
+#include <st/st-theme.h>
+#include <st/st-theme-node.h>
 
 G_BEGIN_DECLS
 
@@ -73,6 +75,7 @@ struct _StWidgetClass
   void (* draw_background) (StWidget           *self,
                             ClutterActor       *background,
                             const ClutterColor *color);
+  void (* style_changed)   (StWidget           *self);
 };
 
 GType st_widget_get_type (void) G_GNUC_CONST;
@@ -83,6 +86,9 @@ G_CONST_RETURN gchar *st_widget_get_style_pseudo_class (StWidget    *actor);
 void                  st_widget_set_style_class_name   (StWidget    *actor,
                                                         const gchar *style_class);
 G_CONST_RETURN gchar *st_widget_get_style_class_name   (StWidget    *actor);
+void                  st_widget_set_theme              (StWidget    *actor,
+                                                        StTheme     *theme);
+StTheme *             st_widget_get_theme              (StWidget    *actor);
 
 void         st_widget_set_has_tooltip  (StWidget    *widget,
                                          gboolean     has_tooltip);
@@ -98,6 +104,9 @@ void st_widget_ensure_style (StWidget *widget);
 
 
 /* Only to be used by sub-classes of StWidget */
+void          st_widget_style_changed        (StWidget  *widget);
+StThemeNode  *st_widget_get_theme_node       (StWidget  *widget);
+
 ClutterActor *st_widget_get_background_image (StWidget  *actor);
 ClutterActor *st_widget_get_border_image     (StWidget  *actor);
 void          st_widget_get_padding          (StWidget  *widget,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 35ba1c7..ee86ec5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -16,5 +16,6 @@ run-test.sh: run-test.sh.in
 	$(AM_V_GEN) sed \
 	    -e "s|@GJS_JS_DIR[ ]|$(GJS_JS_DIR)|" \
 	    -e "s|@GJS_JS_NATIVE_DIR[ ]|$(GJS_JS_NATIVE_DIR)|" \
+	    -e "s|@MUTTER_LIB_DIR[ ]|$(MUTTER_LIB_DIR)|" \
 	    -e "s|@srcdir[ ]|$(srcdir)|" \
 	    $< > $@ && chmod a+x $@
diff --git a/tests/interactive/css-fonts.js b/tests/interactive/css-fonts.js
new file mode 100644
index 0000000..2731776
--- /dev/null
+++ b/tests/interactive/css-fonts.js
@@ -0,0 +1,39 @@
+/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
+
+const Clutter = imports.gi.Clutter;
+const St = imports.gi.St;
+
+const UI = imports.testcommon.ui;
+
+UI.init();
+let stage = Clutter.Stage.get_default();
+
+let b = new St.BoxLayout({ vertical: true,
+                           width: stage.width,
+                           height: stage.height });
+stage.add_actor(b);
+
+let t;
+
+t = new St.Label({ "text": "Bold", style_class: "bold" });
+b.add(t);
+t = new St.Label({ "text": "Monospace", style_class: "monospace" });
+b.add(t);
+t = new St.Label({ "text": "Italic", style_class: "italic" });
+b.add(t);
+t = new St.Label({ "text": "Bold Italic", style_class: "bold italic" });
+b.add(t);
+t = new St.Label({ "text": "Big Italic", style_class: "big italic" });
+b.add(t);
+t = new St.Label({ "text": "Big Bold", style_class: "big bold" });
+b.add(t);
+
+let b2 = new St.BoxLayout({ vertical: true, style_class: "monospace" });
+b.add(b2);
+t = new St.Label({ "text": "Big Monospace", style_class: "big" });
+b2.add(t);
+t = new St.Label({ "text": "Italic Monospace", style_class: "italic" });
+b2.add(t);
+
+stage.show();
+Clutter.main();
diff --git a/tests/interactive/scrolling.js b/tests/interactive/scrolling.js
new file mode 100644
index 0000000..15f985c
--- /dev/null
+++ b/tests/interactive/scrolling.js
@@ -0,0 +1,28 @@
+/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
+
+const Clutter = imports.gi.Clutter;
+const St = imports.gi.St;
+
+const UI = imports.testcommon.ui;
+
+UI.init();
+let stage = Clutter.Stage.get_default();
+
+let v = new St.ScrollView({});
+stage.add_actor(v);
+let b = new St.BoxLayout({ vertical: true,
+                           width: stage.width,
+                           height: stage.height });
+v.add_actor(b);
+
+let cc_a = "a".charCodeAt(0);
+let s = "";
+for (let i = 0; i < 26 * 3; i++) {
+    s += String.fromCharCode(cc_a + i % 26);
+
+    let t = new St.Label({ "text": s});
+    b.add(t);
+}
+
+stage.show();
+Clutter.main();
diff --git a/tests/run-test.sh.in b/tests/run-test.sh.in
index ce1ce3e..4436187 100644
--- a/tests/run-test.sh.in
+++ b/tests/run-test.sh.in
@@ -26,7 +26,7 @@ builddir=`cd $builddir && pwd`
 srcdir=$builddir/@srcdir@
 srcdir=`cd $srcdir && pwd`
 
-GI_TYPELIB_PATH="$builddir/../src"
+GI_TYPELIB_PATH="@MUTTER_LIB_DIR@/mutter:$builddir/../src"
 GJS_DEBUG_OUTPUT=stderr
 $verbose || GJS_DEBUG_TOPICS="JS ERROR;JS LOG"
 GNOME_SHELL_TESTSDIR="$srcdir/"
diff --git a/tests/testcommon/test.css b/tests/testcommon/test.css
index 0e1b3ac..6ce3d5d 100644
--- a/tests/testcommon/test.css
+++ b/tests/testcommon/test.css
@@ -1,13 +1,33 @@
 @import "../../data/theme/gnome-shell.css";
 
-*.red {
+stage {
+    font: 16pt serif;
+}
+
+.red {
     background-color: red;
 }
 
-*.green {
+.green {
     background-color: green;
 }
 
-*.blue {
+.blue {
     background-color: blue;
 }
+
+.bold {
+    font-weight: bold;
+}
+
+.italic {
+    font-style: italic;
+}
+
+.big {
+    font-size: 150%;
+}
+
+.monospace {
+    font-family: monospace;
+}
diff --git a/tests/testcommon/ui.js b/tests/testcommon/ui.js
index 219bf47..7110c65 100644
--- a/tests/testcommon/ui.js
+++ b/tests/testcommon/ui.js
@@ -3,6 +3,7 @@
 const Clutter = imports.gi.Clutter;
 const GLib = imports.gi.GLib;
 const St = imports.gi.St;
+const Shell = imports.gi.Shell;
 
 const Environment = imports.ui.environment;
 
@@ -10,7 +11,9 @@ function init() {
     Clutter.init(null, null);
     Environment.init();
 
-    let style = St.Style.get_default();
+    let stage = Clutter.Stage.get_default();
+    let context = St.ThemeContext.get_for_stage (stage);
     let stylesheetPath = GLib.getenv("GNOME_SHELL_TESTSDIR") + "/testcommon/test.css";
-    style.load_from_file(stylesheetPath);
+    let theme = new St.Theme ({ application_stylesheet: stylesheetPath });
+    context.set_theme (theme);
 }



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