Hello,

I'm working on libCSS just now, implementing support for some of the 'page' 
properties (page-break-before, page-break-after etc).  I've noticed what I 
think is a bug in css_computed_style_compose, and I wanted to run it past the 
experts before trying to fix it, in case I've got the wrong end of the stick.

The symptoms are that properties that should by default /not/ inherit are 
inheriting.

The cause, I think, is in css_computed_style_compose. It happens when 'child' 
and 'result' point to the same object, and parent has 'page' group properties 
set (I think this will apply equally to the current 'uncommon' group), but the 
child does not.  In the loop, when we get to the first set property in a group, 
it is composed (because the group in parent is not NULL), which causes the 
group to be allocated in the result object (the setters allocate the group if 
it doesn't already exist), and memset to 0.  This meant that, because 'child' 
and 'result' are the same, all the other properties in 'child' are now set to 0 
(by the memset when the group is set up).  0 is  'inherit'.  Properties that 
/should/ have a non-inherit initial value are now set to inherit erroneously.

The solution is either to call initial_... for all the properties in the group 
when it's set up (in the "ENSURE_PAGE" macro, or equivalent), or maybe to 
change the docs to state that child and result may NOT be the same object.

Does this sound like a plausible diagnosis?

Thanks,
Jamie.


Reply via email to