Re: [libcroco-list] Inheritance & Initial value
- From: Benjamin Dauvergne <feanor tol-eressea org>
- To: libcroco-list gnome org
- Subject: Re: [libcroco-list] Inheritance & Initial value
- Date: Tue, 23 Mar 2004 18:37:23 +0100
Dodji Seketeli wrote:
Yes, CRStyle fields of scalar types (like enums) should be assigned to
the value INHERIT (or something like that) when the matching property is
set to the 'inherit' value in the input css.
Fields of CRStyle of Composite types, like CRRgb, or CRNum etc ... could
have a "boolean is_inherited" field (or something like that) and that
boolean should be set to TRUE when the matching property is set to the
'inherit' value in the input css.
I came to the same conclusions.
I think their should be two functions:
cr_root_style_set_props_to_defaults, where all props are set to their
'initial value' and cr_style_set_props_to_defaults where props that are
of the inherited type are set to INHERIT, and other props are set to
their initial value.
Well, I am not sure to understand you correctly here, so let me write
what I think should be done.
When the CRStyle is instanciated using cr_style_new (), you don't know
if the style is to be associated to the root xml element or not.
However, that CRStyle needs to be initialized to something. In
It's where i diverge, i thought that it should be initialized by the
the code that is using it and which know if the CrStyle is going to be at
the root of the tree.
cr_style_new (), we (should) call cr_style_set_props_to_default () to
initialize all the properties to :
- either an initial value, if they can have one
- or to the value "inherited" for those values that are to be inherited.
I agree here.
Another problem is where should be done the propagating of inherited
properties from the parent style to their children? Some is done in
cr-style.c when the 'inherit' value is read from the stylesheet, some
other is done directly in sewfox. So should-it be staticaly propagated
somewhere in libcroco ? dynamicaly in sewfox ?
Yes, true. Today, inheritance handly is messy and buggy.
The computing of the style "computed values" being done in the layout
engine (in function layout_box (), the call to
speficied_2_computed_value ().), I would suggest to call a function that
that resolves the inheritance right after the call to the
specified_2_computed_value () function.
A cr_style_propagate_from_parent(CrStyle *a_style) would do it.
I still think i will implement a cr_style_init_as_root_style(CrStyle
*a_style)
that could be called in create_box_tree_real() if parent_style is null.
@+
[
Date Prev][Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]