libcroco-hackers
[Top][All Lists]
Advanced

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

[Libcroco-hackers] re: How to set correct value for inherit and other r


From: Dodji Seketeli
Subject: [Libcroco-hackers] re: How to set correct value for inherit and other relative enums ?
Date: Tue, 10 Jun 2003 19:15:33 +0200 (MEST)
User-agent: IMP/PHP IMAP webmail program 2.2.42

First, let me tel you that I have set a new mailing list on
gnome: address@hidden

All the libcroco discussion will take place there form now on.
You are warmely invited to subscribe to go to
http://mail.gnome.org/mailman/listinfo/libcroco-list to subscribe
to the licroco-list .
This list should work far better than the savannah one.


Now, your the response to your mail:


I think you are missing the point a bit man.
Or maybe I am missing the point myself.

You just want to fill the style structure of a widget from a 
css stylesheet right ?

So do you think you need to support all the css features ?
Especially the inherit one ?
Who cares about that in the widget world ?

Anyway, I will answer your mail eventhough I think you
are taking the wrong path.

> $ grep INHERIT *.h
> cr-fonts.h:         *INHERITED_FONT_SIZE,
> cr-fonts.h:        INHERITED_FONT_SIZE
> cr-fonts.h:        FONT_SIZE_ADJUST_INHERIT
> cr-fonts.h:        FONT_STYLE_INHERIT
> cr-fonts.h:        FONT_VARIANT_INHERIT
> cr-fonts.h:        FONT_WEIGHT_INHERIT,
> cr-fonts.h:        FONT_STRETCH_INHERIT
> cr-style.h:        DISPLAY_INHERIT
> cr-style.h:        POSITION_INHERIT,
> cr-style.h:        FLOAT_INHERIT
> 
> And cr-style.c just set value from parent_style once,
> against DISPLAY_INHERIT and POSITION_INHERIT, for exmaple.
> 
> But it's not the simple problem.
> There can be multiple hierarchy of relative values.
> e.g. normal -> inherit -> wider for CRFontStretch.
> It's hard for me to code such a solution.
> 
> CRFontStretch, for example, has no information about parent.

Man, CRFontStretch aims only to be the type of a  member of the
CRStyle structure. No one should use it but CRStyle.
CRStyle has a parent pointer that chains a given style structure
to the style structure of the parent box. 
It is enough to handle inheritance, and I do it already for a couple of
properties.

Asuming you just want to fill a widget->style structure
from a stylesheet, why the hell do you want to use CRStyle and
the types defined in cr-fonts.h ?
What don't you just walk through the stylesheet and populate
widget->style directly ?
CRStyle is there to support the style of the box model layout 
defined in the css2 spec. widget->style is there to support the style of GTK.
These two things (box model and GTK) are different.

So please, STOP USING CRStyle and font.h
You don't need anything from the seleng.

Walk the stylesheet tree and fill widget->style structure directly.
You have a problem with the 'inherit' property value ? just forbid it's use in 
the stylesheets that are going to be used for widget->style, period.
If you really want to use it, then I give you this advice: if a property
has a foo has a 'inherit' value (foo: inherit) just do 
widget->style.foo = widget->parent->style.foo .
This is the real meaning of inherit. Don't bother trying to do more.

This is a simple problem, just handle it in a simply manner.

Dodji.


homepage: http://www.seketeli.org/dodji
gnome xml editor: http://www.freespiders.org/projects/gmlview
gnome css2 parsing toolkit: http://savannah.nongnu.org/projects/libcroco




reply via email to

[Prev in Thread] Current Thread [Next in Thread]