Bug 128710

Summary: dynamic pseudo-class :hover does not get applied
Product: [Applications] konqueror Reporter: rick <rickv>
Component: khtmlAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description rick 2006-06-05 22:19:19 UTC
Version:            (using KDE KDE 3.5.3)
Installed from:    Gentoo Packages
Compiler:          gcc 3.4.5 gcc --version: gcc (GCC) 3.4.5 (Gentoo 3.4.5, ssp-3.4.5-1.0, pie-8.7.9)
OS:                Linux

style described in :hover does not get applied.
see http://beta.hobi.com/test.html
The words 'psuedo link' should change color, along with the background of that text alone.

The entire css is:
span.test
{
	color:red;
	cursor:pointer;
	text-decoration:none;
}

span.test:hover
{
	background-color:black;
	color:yellow;
	text-decoration:underline;
}

the html is: <span class='test'>psuedo link</span>


if the style is changed to
span {...}
span:hover {...}
hover over text 'psuedo link' is as expected.
Comment 1 Allan Sandfeld 2006-06-06 12:12:13 UTC
You need to set doctype to transitional or strict. We only apply :hover to links in quirk mode.

 This is consistent with other browsers.
Comment 2 Allan Sandfeld 2006-06-06 12:15:52 UTC
Okay.. odd it works in Firefox..
Comment 3 Allan Sandfeld 2006-06-06 13:04:03 UTC
SVN commit 548707 by carewolf:

If :hover is part of a subselector it doesn't fall under 
the hoveractive-only quirk (REGRESSION)
BUG: 128710


 M  +4 -4      cssstyleselector.cpp  
 M  +1 -1      cssstyleselector.h  


--- branches/KDE/3.5/kdelibs/khtml/css/cssstyleselector.cpp #548706:548707
@@ -1021,7 +1021,7 @@
         //kdDebug() << "CSSOrderedRule::checkSelector" << endl;
         ElementImpl *elem = static_cast<ElementImpl *>(n);
 
-        if(!checkOneSelector(sel, elem, isAncestor)) return 0;
+        if(!checkOneSelector(sel, elem, isAncestor, true)) return 0;
         //kdDebug() << "CSSOrderedRule::checkSelector: passed" << endl;
         break;
     }
@@ -1054,7 +1054,7 @@
     return;
 }
 
-bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl *e, bool isAncestor)
+bool CSSStyleSelector::checkOneSelector(DOM::CSSSelector *sel, DOM::ElementImpl *e, bool isAncestor, bool isSubSelector)
 {
     if(!e)
         return false;
@@ -1433,7 +1433,7 @@
         case CSSSelector::PseudoHover: {
 	    // If we're in quirks mode, then *:active should only match focusable elements, and never
 	    // unfocusable anchors.
-	    if (strictParsing || (sel->tag != anyQName && e->id() != ID_A) || e->isFocusable()) {
+	    if (strictParsing || ((sel->tag != anyQName || isSubSelector) && e->id() != ID_A) || e->isFocusable()) {
                 doc->dynamicDomRestyler().addDependency(element, e, HoverDependency);
 
                 if (e->hovered())
@@ -1443,7 +1443,7 @@
         }
 	case CSSSelector::PseudoActive:
 	    // If we're in quirks mode, then *:active should only match focusable elements
-	    if (strictParsing || (sel->tag != anyQName && e->id() != ID_A) || e->isFocusable()) {
+	    if (strictParsing || ((sel->tag != anyQName || isSubSelector) && e->id() != ID_A) || e->isFocusable()) {
                 doc->dynamicDomRestyler().addDependency(element, e, ActiveDependency);
 
 		if (e->active())
--- branches/KDE/3.5/kdelibs/khtml/css/cssstyleselector.h #548706:548707
@@ -152,7 +152,7 @@
 	    with given relationships matches the given Element */
 	void checkSelector(int selector, DOM::ElementImpl *e);
 	/* checks if the selector matches the given Element */
-	bool checkOneSelector(DOM::CSSSelector *selector, DOM::ElementImpl *e, bool isAncestor);
+	bool checkOneSelector(DOM::CSSSelector *selector, DOM::ElementImpl *e, bool isAncestor, bool isSubSelector=false);
 
 #ifdef APPLE_CHANGES
 	/* This function fixes up the default font size if it detects that the