gtk-css-engine r139 - in trunk: . libccss/ccss libccss/doc libccss/doc/tmpl src themes/gtk-css-test/gtk-2.0



Author: robsta
Date: Wed Oct  1 07:55:33 2008
New Revision: 139
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=139&view=rev

Log:
* libccss/ccss/ccss-gtk-style.c:
* libccss/ccss/ccss-node.c:
* libccss/ccss/ccss-node.h:
* libccss/ccss/ccss-style.c:
* libccss/ccss/ccss-style.h:
* libccss/ccss/exports.sym:
* libccss/doc/ccss-sections.txt:
* src/gce-style.c:
Finish support for `background-attachment: fixed'.



Modified:
   trunk/ChangeLog
   trunk/libccss/ccss/ccss-gtk-style.c
   trunk/libccss/ccss/ccss-node.c
   trunk/libccss/ccss/ccss-node.h
   trunk/libccss/ccss/ccss-style.c
   trunk/libccss/ccss/ccss-style.h
   trunk/libccss/ccss/exports.sym
   trunk/libccss/doc/ccss-sections.txt
   trunk/libccss/doc/tmpl/ccss-unused.sgml
   trunk/libccss/doc/tmpl/node.sgml
   trunk/src/gce-style.c
   trunk/themes/gtk-css-test/gtk-2.0/styles.css

Modified: trunk/libccss/ccss/ccss-gtk-style.c
==============================================================================
--- trunk/libccss/ccss/ccss-gtk-style.c	(original)
+++ trunk/libccss/ccss/ccss-gtk-style.c	Wed Oct  1 07:55:33 2008
@@ -50,6 +50,7 @@
 	ccss_border_join_t top_right;
 	ccss_border_join_t right_bottom;
 	ccss_border_join_t bottom_left;
+	int32_t l, t, w, h;
 
 	CCSS_BORDER_JOIN_ASSIGN (left_top, self->left_top);
 	CCSS_BORDER_JOIN_ASSIGN (top_right, self->top_right);
@@ -101,6 +102,20 @@
 			 &self->bottom, &bottom_left,
 			 cr, x, y, width, height);
 
+	/* FIXME: background size is calculated against allocation
+	 * when using `fixed'. */
+	if (CCSS_BACKGROUND_FIXED == self->bg_attachment->attachment) {
+		l = self->viewport_x;
+		t = self->viewport_y;
+		w = self->viewport_width;
+		h = self->viewport_height;
+	} else {
+		l = x;
+		t = y;
+		w = width;
+		h = height;
+	}
+
 	ccss_background_fill (self->bg_attachment, self->bg_color,
 			     self->bg_image, self->bg_position, self->bg_repeat,
 			     self->bg_size, cr, x, y, width, height);

Modified: trunk/libccss/ccss/ccss-node.c
==============================================================================
--- trunk/libccss/ccss/ccss-node.c	(original)
+++ trunk/libccss/ccss/ccss-node.c	Wed Oct  1 07:55:33 2008
@@ -71,9 +71,11 @@
 }
 
 static bool
-get_origin (ccss_node_t	*self,
-	    int		*x,
-	    int		*y)
+get_viewport (ccss_node_t	*self,
+	      uint32_t		*x,
+	      uint32_t		*y,
+	      uint32_t		*width,
+	      uint32_t		*height)
 {
 	return false;
 }
@@ -93,7 +95,7 @@
 	.get_class		= get_class,
 	.get_pseudo_class	= get_pseudo_class,
 	.get_attribute		= get_attribute,
-	.get_origin		= get_origin,
+	.get_viewport		= get_viewport,
 	.release		= release
 };
 

Modified: trunk/libccss/ccss/ccss-node.h
==============================================================================
--- trunk/libccss/ccss/ccss-node.h	(original)
+++ trunk/libccss/ccss/ccss-node.h	Wed Oct  1 07:55:33 2008
@@ -21,6 +21,7 @@
 #define CCSS_NODE_H
 
 #include <stdbool.h>
+#include <stdint.h>
 #include <glib.h>
 #include <ccss/ccss-features.h>
 
@@ -132,14 +133,16 @@
 					    char const		*name);
 
 /**
- * ccss_node_get_origin_f:
+ * ccss_node_get_viewport_f:
  * @self:	a #ccss_node_t.
  * @x:		horizontal position.
  * @y:		vertical position.
  * 
  * Hook function to determine the position of a node in the viewport.
  **/
-typedef bool (*ccss_node_get_origin_f) (ccss_node_t const *self, int *x, int *y);
+typedef bool (*ccss_node_get_viewport_f) (ccss_node_t const *self, 
+					  uint32_t *x, uint32_t *y,
+					  uint32_t *width, uint32_t *height);
 
 /** 
  * ccss_node_release_f:
@@ -158,6 +161,7 @@
  * @get_class:		a #ccss_node_get_class_f.
  * @get_pseudo_class:	a #ccss_node_get_pseudo_class_f.
  * @get_attribute:	a #ccss_node_get_attribute_f.
+ * @get_viewport	a #ccss_node_get_viewport_f.
  * @release:		a #ccss_node_release_f.
  *
  * Dispatch table a CCSS consumer has to fill so the selection engine can 
@@ -174,7 +178,7 @@
 	ccss_node_get_class_f		get_class;
 	ccss_node_get_pseudo_class_f	get_pseudo_class;
 	ccss_node_get_attribute_f	get_attribute;
-	ccss_node_get_origin_f	get_origin;
+	ccss_node_get_viewport_f	get_viewport;
 	ccss_node_release_f		release;
 };
 

Modified: trunk/libccss/ccss/ccss-style.c
==============================================================================
--- trunk/libccss/ccss/ccss-style.c	(original)
+++ trunk/libccss/ccss/ccss-style.c	Wed Oct  1 07:55:33 2008
@@ -236,8 +236,9 @@
 			 &self->bottom, &self->bottom_left,
 			 cr, x, y, width, height);
 
+	/* FIXME: background size is calculated against allocation
+	 * when using `fixed'. */
 	if (CCSS_BACKGROUND_FIXED == self->bg_attachment->attachment) {
-printf ("%s() %d %d %d %d\n", __FUNCTION__, x, y, self->viewport_x, self->viewport_y);
 		l = self->viewport_x;
 		t = self->viewport_y;
 		w = self->viewport_width;
@@ -334,11 +335,11 @@
 }
 
 void
-ccss_style_set_viewport_extents (ccss_style_t	*self,
-				 int32_t	 x,
-				 int32_t	 y,
-				 int32_t	 width,
-				 int32_t	 height)
+ccss_style_set_viewport (ccss_style_t	*self,
+			 int32_t	 x,
+			 int32_t	 y,
+			 int32_t	 width,
+			 int32_t	 height)
 {
 	self->viewport_x = x;
 	self->viewport_y = y;

Modified: trunk/libccss/ccss/ccss-style.h
==============================================================================
--- trunk/libccss/ccss/ccss-style.h	(original)
+++ trunk/libccss/ccss/ccss-style.h	Wed Oct  1 07:55:33 2008
@@ -89,7 +89,8 @@
 bool ccss_style_get_border_color (ccss_style_t const *self,
 				 double *red, double *green, double *blue);
 
-void ccss_style_set_viewport_extents (ccss_style_t *self, int32_t x, int32_t y, int32_t width, int32_t height);
+void ccss_style_set_viewport (ccss_style_t *self, int32_t x, int32_t y,
+			      int32_t width, int32_t height);
 
 #ifdef CCSS_DEBUG
 void ccss_style_dump (ccss_style_t const *self);

Modified: trunk/libccss/ccss/exports.sym
==============================================================================
--- trunk/libccss/ccss/exports.sym	(original)
+++ trunk/libccss/ccss/exports.sym	Wed Oct  1 07:55:33 2008
@@ -8,7 +8,7 @@
 ccss_style_get_color
 ccss_style_get_background_color
 ccss_style_get_border_color
-ccss_style_set_viewport_extents
+ccss_style_set_viewport
 ccss_stylesheet_new_from_buffer
 ccss_stylesheet_new_from_file
 ccss_stylesheet_free

Modified: trunk/libccss/doc/ccss-sections.txt
==============================================================================
--- trunk/libccss/doc/ccss-sections.txt	(original)
+++ trunk/libccss/doc/ccss-sections.txt	Wed Oct  1 07:55:33 2008
@@ -17,7 +17,7 @@
 ccss_node_get_class_f
 ccss_node_get_pseudo_class_f
 ccss_node_get_attribute_f
-ccss_node_get_origin_f
+ccss_node_get_viewport_f
 ccss_node_release_f
 ccss_node_init
 </SECTION>

Modified: trunk/libccss/doc/tmpl/ccss-unused.sgml
==============================================================================
--- trunk/libccss/doc/tmpl/ccss-unused.sgml	(original)
+++ trunk/libccss/doc/tmpl/ccss-unused.sgml	Wed Oct  1 07:55:33 2008
@@ -1,3 +1,13 @@
+<!-- ##### USER_FUNCTION ccss_node_get_origin_f ##### -->
+<para>
+
+</para>
+
+ self: 
+ x: 
+ y: 
+ Returns: 
+
 <!-- ##### USER_FUNCTION ccss_node_get_position_f ##### -->
 <para>
 

Modified: trunk/libccss/doc/tmpl/node.sgml
==============================================================================
--- trunk/libccss/doc/tmpl/node.sgml	(original)
+++ trunk/libccss/doc/tmpl/node.sgml	Wed Oct  1 07:55:33 2008
@@ -108,7 +108,7 @@
 @Returns: 
 
 
-<!-- ##### USER_FUNCTION ccss_node_get_origin_f ##### -->
+<!-- ##### USER_FUNCTION ccss_node_get_viewport_f ##### -->
 <para>
 
 </para>
@@ -116,6 +116,8 @@
 @self: 
 @x: 
 @y: 
+ width: 
+ height: 
 @Returns: 
 
 

Modified: trunk/src/gce-style.c
==============================================================================
--- trunk/src/gce-style.c	(original)
+++ trunk/src/gce-style.c	Wed Oct  1 07:55:33 2008
@@ -80,7 +80,6 @@
 	ccss_selector_group_t	*group;
 	ccss_style_t		 style;
 	cairo_t			*cr;
-	gint			 l, t, w, h;
 
 	group = setup (node, base);
 	if (group) {
@@ -103,9 +102,9 @@
 		ccss_selector_group_apply (group, &style);
 
 		/* Hackishly support "background-attachment: fixed". */
-		gdk_window_get_position (window, &l, &t);
-		gdk_drawable_get_size (GDK_DRAWABLE (window), &w, &h);
-		ccss_style_set_viewport_extents (&style, l, t, w, h);
+		ccss_style_set_viewport (&style,
+			widget->allocation.x, widget->allocation.y,
+			widget->allocation.width, widget->allocation.height);
 
 		if (fill) {
 			ccss_style_draw_rectangle (&style, cr, x, y, width, height);
@@ -136,7 +135,6 @@
 	ccss_selector_group_t	*group;
 	ccss_style_t		 style;
 	cairo_t			*cr;
-	gint			 l, t, w, h;
 
 	group = setup (node, base);
 	if (group) {
@@ -159,9 +157,9 @@
 		ccss_selector_group_apply (group, &style);
 
 		/* Hackishly support "background-attachment: fixed". */
-		gdk_window_get_position (window, &l, &t);
-		gdk_drawable_get_size (GDK_DRAWABLE (window), &w, &h);
-		ccss_style_set_viewport_extents (&style, l, t, w, h);
+		ccss_style_set_viewport (&style,
+			widget->allocation.x, widget->allocation.y,
+			widget->allocation.width, widget->allocation.height);
 
 		ccss_style_draw_gap (&style, cr, x, y, width, height, gap_side, gap_start, gap_width);
 
@@ -185,7 +183,6 @@
 	ccss_selector_group_t	*group;
 	ccss_style_t		 style;
 	cairo_t			*cr;
-	gint			 l, t, w, h;
 
 	group = setup (node, base);
 	if (group) {
@@ -200,9 +197,9 @@
 		ccss_selector_group_apply (group, &style);
 
 		/* Hackishly support "background-attachment: fixed". */
-		gdk_window_get_position (window, &l, &t);
-		gdk_drawable_get_size (GDK_DRAWABLE (window), &w, &h);
-		ccss_style_set_viewport_extents (&style, l, t, w, h);
+		ccss_style_set_viewport (&style,
+			widget->allocation.x, widget->allocation.y,
+			widget->allocation.width, widget->allocation.height);
 
 		ccss_style_draw_line (&style, cr, x1, x2, y1, y2);
 

Modified: trunk/themes/gtk-css-test/gtk-2.0/styles.css
==============================================================================
--- trunk/themes/gtk-css-test/gtk-2.0/styles.css	(original)
+++ trunk/themes/gtk-css-test/gtk-2.0/styles.css	Wed Oct  1 07:55:33 2008
@@ -86,6 +86,12 @@
 	border: 1px solid black;
 }
 
+GtkHScale > slider {
+	background-image: url(slider-test-h.png);
+	background-attachment: fixed;
+	border: 1px solid black;
+}
+
 extension {
 	border: 1px solid black;
 }



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