isFocusedAndActive is asking if your frame is the focused frame and if the window that contains your frame is also active. I would guess that you are not setting the state of your frames/windows correctly. If your window is considered inactive or if your frame is not considered focused, then :focus is not going to be honored.
dave ([email protected]) On Jun 8, 2010, at 3:33 AM, Alex Vazquez wrote: > Hello list, > > We're running a customized build of WebKit (actually a DirectFB port) and we > are experiencing problems with the css :focus pseudo-class. We use webkit as > GUI renderer and, when changing the focused element through JavaScript (using > the focus function), the style associated to the :focus pseudo-class is not > applied. The attached page is our reduced testcase, it should show two links, > the first of them focused but it shows two unfocused links: > > <html> > > <head> > > <style type="text/css"> > > body { > color: #f00; > background-color:#ddd; > font-size:26px; > } > > div { > float: left; > padding: 50px; > } > > a, span { > float:left; > display:block; > clear:both; > } > > a:focus { > color:#f0f; > } > > </style> > > <script type="text/javascript"> > > function init() { > document.getElementById("uno").focus(); > } > > </script> > > </head> > > <body onload="init();"> > <div> > > <a id="uno" href="http://www.webkit.org/">WebKit</a> > <a id="dos" href="http://nightly.webkit.org">Nightly Builds</a> > > </div> > </body> > > </html> > > > The version with this problem is based on r58260 revision while a previously > one (with nearly the same adapted patches) based in r40084 worked fine. We > build webkit for an embedded MIPS processor and for x86 too. Both versions > show the undesired behaviour. > > Investigating through the WebKit code, we've found that applying the > following patch fixes the problem: > > --- a/WebCore/css/CSSStyleSelector.cpp 2010-06-04 13:35:19.000000000 +0000 > +++ b/WebCore/css/CSSStyleSelector.cpp 2010-06-04 13:35:35.000000000 +0000 > @@ -2428,7 +2428,7 @@ > break; > } > case CSSSelector::PseudoFocus: > - if (e && e->focused() && > e->document()->frame()->selection()->isFocusedAndActive()) > + if (e && e->focused()) > return true; > break; > case CSSSelector::PseudoHover: { > > That line was there since r40084 and it worked so we have some questions > about the patch: > > * Does it have any problem that we have overlooked? > > * Can someone with knowledge on the css component explain why the active > state of the selection is checked in that line? We also try to change that > check by e->document()->frame()->selection()->isFocused() but it didn't fix > it. > > Kind regards, > > -- > Alejandro Vazquez Fente > <focus_index.html><css_style_selector_focus.patch>_______________________________________________ > webkit-dev mailing list > [email protected] > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
_______________________________________________ webkit-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

