Bug 132368

Summary: [regression] erratic/incorrect behaviour on :hover restyling
Product: [Applications] konqueror Reporter: Germain Garand <germain>
Component: khtmlAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: test case
Dynamically update inherited "non-inherited" properties

Description Germain Garand 2006-08-14 00:49:54 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

:hover triggers erratic behaviour in some situations.

Noticed on:
  http://xmoto.free.fr/index.php?page=all_highscores

Try hovering the big table:
Instead of changing the rows background-color, it's the cells' (and also the links' within) that change in a weird way. 

It seems to stem from r532332 (the big dynamic restyling changes).

Some notes:

- the erratic behaviour is apparently triggered by an :hover rule that is erroneously preceded by a space. It would be ignored in quirk mode, but page is strict. 

Nevertheless, the style content of said rule doesn't seem to justify the erratic behaviour that is observed.

- when removing the problematic space, erratic behaviour goes away, but correct style still isn't applied to rows.
Comment 1 Germain Garand 2006-08-14 00:53:54 UTC
Created attachment 17362 [details]
test case
Comment 2 Allan Sandfeld 2006-08-14 10:50:26 UTC
Returns 500 internal server error
Comment 3 Germain Garand 2006-08-14 14:28:25 UTC
page is available now
Comment 4 Allan Sandfeld 2006-09-26 22:42:07 UTC
This bug seems caused by inheriting non-inherited CSS properties. This is something our model doesn't currently handle. 

If it worked before but not now, it's because I made restyling more fine-grained, and it only worked by accident before.

I have an experimental patch that enables dynamically inheriting non-inherited properties. I will try it with this test case.
Comment 5 Allan Sandfeld 2006-09-26 22:56:33 UTC
Created attachment 17932 [details]
Dynamically update inherited "non-inherited" properties

This patch fixes the webpage :)
Comment 6 Germain Garand 2006-09-29 03:12:22 UTC
> dynamically inheriting non-inherited properties.
Could you explain that paradox in some more details?
The patch works absolutely fine but for the life of me, I can't make any sense out of what it does :)
Comment 7 Allan Sandfeld 2006-09-29 16:42:18 UTC
Okay okay. I just like writing it that way because it sounds so non-sensitical ;)

The point is CSS has inherited and non-inherited properties. When we restyle an element and a inherited attribute change we restyle all the children. (NodeImpl::diff and ElementImpl:recalcStyle)

Now non-inherited properties can be set to value "inherit". In this test-case the background-color is inherited. When the parent element change background-color we don't restyle the children because no inherited property was changed. 

This patch catches all cases value "inherit" on non-inherited properties and sets a flag so we restyle the element when a non-inherited property change in the parent.
Comment 8 Germain Garand 2006-10-01 00:58:17 UTC
ahh alright, that's all clear now. Maybe the method would need be even more verbose for the casual reader to understand?
e.g setInheritedNoninherited => setExplicitelyInheritingNoninherited

or something similar... oh well.
Comment 9 Germain Garand 2006-11-17 13:58:57 UTC
allan: do you still have this patch in mind?
Comment 10 Allan Sandfeld 2007-01-21 14:39:39 UTC
SVN commit 625864 by carewolf:

Handle dynamic inheritance when inherit value is used explictly on 
default non-inherited properties.
BUG:132368


 M  +12 -1     ChangeLog  
 M  +82 -47    css/cssstyleselector.cpp  
 M  +6 -2      rendering/render_style.h  
 M  +4 -3      xml/dom_elementimpl.cpp  
 M  +8 -0      xml/dom_nodeimpl.cpp  
 M  +2 -0      xml/dom_nodeimpl.h  
 M  +2 -1      xml/dom_textimpl.h