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



Author: robsta
Date: Tue Sep 30 17:13:36 2008
New Revision: 138
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=138&view=rev

Log:
* TODO: remember information about animations.

* libccss/ccss/ccss-node.c:
* libccss/ccss/ccss-node.h:
* libccss/ccss/ccss-selector.c:
* libccss/ccss/ccss-style.c:
* libccss/ccss/ccss-style.h:
* libccss/ccss/exports.sym:
* libccss/doc/ccss-sections.txt:
* libccss/doc/tmpl/ccss-unused.sgml:
* libccss/doc/tmpl/node.sgml:
* src/gce-style.c:
Work on fixed backgrounds, unfinished.



Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/libccss/ccss/ccss-node.c
   trunk/libccss/ccss/ccss-node.h
   trunk/libccss/ccss/ccss-selector.c
   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/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Tue Sep 30 17:13:36 2008
@@ -59,6 +59,7 @@
   [Link](http://mail.gnome.org/archives/usability/2008-August/msg00037.html).
 * Animated images APNG, MNG, animated GIF, whatever gdk-pixbuf supports.
 * Support system gtk system colors.
+* [CSS Transitions](http://webkit.org/specs/CSSVisualEffects/CSSTransitions.html)
 
 0.4 "Correctness"
 -----------------
@@ -135,4 +136,4 @@
 * [Mockscape](http://www.flickr.com/photos/andyfitz/2706976226/).
 * [Garrett](http://ux.suse.de/~garrett/public/hackweek/oneclick/mockups/oneclick-mockup-trust%20and%20install.png).
 * [cypohirogen](http://cypohirogen.deviantart.com/art/Mail-Scrollbar-for-Leopard-79257200).
-
+* [Jimmac](http://jimmac.musichall.cz/guimockups.php?mockup=xgl)

Modified: trunk/libccss/ccss/ccss-node.c
==============================================================================
--- trunk/libccss/ccss/ccss-node.c	(original)
+++ trunk/libccss/ccss/ccss-node.c	Tue Sep 30 17:13:36 2008
@@ -70,6 +70,14 @@
 	return NULL;
 }
 
+static bool
+get_origin (ccss_node_t	*self,
+	    int		*x,
+	    int		*y)
+{
+	return false;
+}
+
 static void
 release (ccss_node_t *self)
 {
@@ -85,6 +93,7 @@
 	.get_class		= get_class,
 	.get_pseudo_class	= get_pseudo_class,
 	.get_attribute		= get_attribute,
+	.get_origin		= get_origin,
 	.release		= release
 };
 

Modified: trunk/libccss/ccss/ccss-node.h
==============================================================================
--- trunk/libccss/ccss/ccss-node.h	(original)
+++ trunk/libccss/ccss/ccss-node.h	Tue Sep 30 17:13:36 2008
@@ -131,6 +131,16 @@
 typedef char * (*ccss_node_get_attribute_f) (ccss_node_t const	*self,
 					    char const		*name);
 
+/**
+ * ccss_node_get_origin_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);
+
 /** 
  * ccss_node_release_f:
  * @self: a #ccss_node_t.
@@ -164,6 +174,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_release_f		release;
 };
 

Modified: trunk/libccss/ccss/ccss-selector.c
==============================================================================
--- trunk/libccss/ccss/ccss-selector.c	(original)
+++ trunk/libccss/ccss/ccss-selector.c	Tue Sep 30 17:13:36 2008
@@ -875,6 +875,15 @@
 
 	/* merge */
 	if (self->block && style) {
+
+		/* Update dynamic block variables. 
+		 * FIXME: find some good place/way to to this. */
+		if (CCSS_BACKGROUND_FIXED == self->block->background.bg_attachment.attachment) {
+printf ("%s() query\n", __FUNCTION__);
+			/* TODO: set viewport */
+
+		}
+
 		ccss_selector_apply (self, style);
 	}
 
@@ -904,6 +913,8 @@
 	case CCSS_PROPERTY_SPEC_SET:
 		/* use */
 		style->bg_attachment = &self->block->background.bg_attachment;
+if (CCSS_BACKGROUND_FIXED == self->block->background.bg_attachment.attachment)
+	printf ("foo\n");
 		break;
 	}
 

Modified: trunk/libccss/ccss/ccss-style.c
==============================================================================
--- trunk/libccss/ccss/ccss-style.c	(original)
+++ trunk/libccss/ccss/ccss-style.c	Tue Sep 30 17:13:36 2008
@@ -107,7 +107,12 @@
 		.radius = 0,
 		.spec = CCSS_PROPERTY_SPEC_SET
 	},
-	.color = &_color
+	.color = &_color,
+
+	.viewport_x = 0,
+	.viewport_y = 0,
+	.viewport_width = 0,
+	.viewport_height = 0
 };
 
 /**
@@ -223,15 +228,30 @@
 			  int32_t		 width,
 			  int32_t		 height)
 {
+	int32_t l, t, w, h;
+
 	ccss_border_path (&self->left, &self->left_top, 
 			 &self->top, &self->top_right,
 			 &self->right, &self->right_bottom,
 			 &self->bottom, &self->bottom_left,
 			 cr, x, y, width, height);
 
+	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;
+		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);
+			     self->bg_size, cr, l, t, w, h);
 
 	cairo_new_path (cr);
 
@@ -313,6 +333,20 @@
 	return true;
 }
 
+void
+ccss_style_set_viewport_extents (ccss_style_t	*self,
+				 int32_t	 x,
+				 int32_t	 y,
+				 int32_t	 width,
+				 int32_t	 height)
+{
+	self->viewport_x = x;
+	self->viewport_y = y;
+	self->viewport_width = width;
+	self->viewport_height = height;
+}
+
+
 #ifdef CCSS_DEBUG
 
 /**

Modified: trunk/libccss/ccss/ccss-style.h
==============================================================================
--- trunk/libccss/ccss/ccss-style.h	(original)
+++ trunk/libccss/ccss/ccss-style.h	Tue Sep 30 17:13:36 2008
@@ -56,8 +56,16 @@
 	ccss_border_stroke_t			 bottom;
 	ccss_border_join_t			 bottom_left;
 	ccss_color_t const			*color;
+
+	int32_t					 viewport_x;
+	int32_t					 viewport_y;
+	int32_t					 viewport_width;
+	int32_t					 viewport_height;
 } ccss_style_t;
 
+
+
+
 void ccss_style_init (ccss_style_t *self);
 
 void ccss_style_draw_line (ccss_style_t const *self, cairo_t *cr, 
@@ -81,6 +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);
+
 #ifdef CCSS_DEBUG
 void ccss_style_dump (ccss_style_t const *self);
 #endif

Modified: trunk/libccss/ccss/exports.sym
==============================================================================
--- trunk/libccss/ccss/exports.sym	(original)
+++ trunk/libccss/ccss/exports.sym	Tue Sep 30 17:13:36 2008
@@ -8,6 +8,7 @@
 ccss_style_get_color
 ccss_style_get_background_color
 ccss_style_get_border_color
+ccss_style_set_viewport_extents
 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	Tue Sep 30 17:13:36 2008
@@ -17,6 +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_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	Tue Sep 30 17:13:36 2008
@@ -0,0 +1,10 @@
+<!-- ##### USER_FUNCTION ccss_node_get_position_f ##### -->
+<para>
+
+</para>
+
+ self: 
+ x: 
+ y: 
+ Returns: 
+

Modified: trunk/libccss/doc/tmpl/node.sgml
==============================================================================
--- trunk/libccss/doc/tmpl/node.sgml	(original)
+++ trunk/libccss/doc/tmpl/node.sgml	Tue Sep 30 17:13:36 2008
@@ -108,6 +108,17 @@
 @Returns: 
 
 
+<!-- ##### USER_FUNCTION ccss_node_get_origin_f ##### -->
+<para>
+
+</para>
+
+ self: 
+ x: 
+ y: 
+ Returns: 
+
+
 <!-- ##### USER_FUNCTION ccss_node_release_f ##### -->
 <para>
 

Modified: trunk/src/gce-style.c
==============================================================================
--- trunk/src/gce-style.c	(original)
+++ trunk/src/gce-style.c	Tue Sep 30 17:13:36 2008
@@ -80,6 +80,7 @@
 	ccss_selector_group_t	*group;
 	ccss_style_t		 style;
 	cairo_t			*cr;
+	gint			 l, t, w, h;
 
 	group = setup (node, base);
 	if (group) {
@@ -100,6 +101,12 @@
 		}
 
 		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);
+
 		if (fill) {
 			ccss_style_draw_rectangle (&style, cr, x, y, width, height);
 		} else {
@@ -129,6 +136,7 @@
 	ccss_selector_group_t	*group;
 	ccss_style_t		 style;
 	cairo_t			*cr;
+	gint			 l, t, w, h;
 
 	group = setup (node, base);
 	if (group) {
@@ -149,6 +157,12 @@
 		}
 
 		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_draw_gap (&style, cr, x, y, width, height, gap_side, gap_start, gap_width);
 
 		cairo_destroy (cr);
@@ -171,6 +185,7 @@
 	ccss_selector_group_t	*group;
 	ccss_style_t		 style;
 	cairo_t			*cr;
+	gint			 l, t, w, h;
 
 	group = setup (node, base);
 	if (group) {
@@ -183,6 +198,12 @@
 		}
 
 		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_draw_line (&style, cr, x1, x2, y1, y2);
 
 		cairo_destroy (cr);

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	Tue Sep 30 17:13:36 2008
@@ -15,7 +15,7 @@
 
 arrow[orientation=down] {
 	background-color: yellow;
-	background-image: url(foo.svg);
+	background-image: url(arrow-down.png);
 }
 
 arrow[orientation=left] {
@@ -80,6 +80,12 @@
 	border: 1px solid black;
 }
 
+GtkVScale > slider {
+	background-image: url(slider-test.png);
+	background-attachment: fixed;
+	border: 1px solid black;
+}
+
 extension {
 	border: 1px solid black;
 }
@@ -125,3 +131,4 @@
 GtkButton:normal {
 	background-color: darkkhaki;
 }
+



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