It seems like you are reading my mind because i'm porting that same function now :) First try failed, though, i'll keep trying.<br><br>Thanks,<br><br><div class="gmail_quote">2010/6/9 Antonio Gomes (:tonikitoo) <span dir="ltr"><<a href="mailto:tonikitoo@gmail.com">tonikitoo@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Note you need to call both setActive and setFocused of FocusController<br>
for it to work for you.<br>
<br>
In gtk:<br>
<br>
static void webkit_web_view_grab_focus(GtkWidget* widget)<br>
{<br>
...<br>
FocusController* focusController = core(webView)->focusController();<br>
focusController->setActive(true);<br>
if (focusController->focusedFrame())<br>
focusController->setFocused(true);<br>
else<br>
focusController->setFocusedFrame(core(webView)->mainFrame());<br>
<div><div></div><div class="h5">}<br>
<br>
On Wed, Jun 9, 2010 at 8:24 AM, Alex Vazquez <<a href="mailto:alexvazquezfente@gmail.com">alexvazquezfente@gmail.com</a>> wrote:<br>
> Right, the problem is the frame not being focused. That's why changing the<br>
> condition to just e->document()->frame()->selection()->isFocused didn't work<br>
> either.<br>
><br>
> In the webkit/GTK port, it is focused, so we are trying to find the<br>
> difference regarding to that in both ports. Maybe some GTK platform check<br>
> ...<br>
><br>
> Any further idea is greatly appreciated and i'll post back for reference if<br>
> we find the fix.<br>
><br>
> Thanks and kind regards,<br>
><br>
> 2010/6/8 David Hyatt <<a href="mailto:hyatt@apple.com">hyatt@apple.com</a>><br>
>><br>
>> isFocusedAndActive is asking if your frame is the focused frame and if the<br>
>> window that contains your frame is also active. I would guess that you are<br>
>> not setting the state of your frames/windows correctly. If your window is<br>
>> considered inactive or if your frame is not considered focused, then :focus<br>
>> is not going to be honored.<br>
>> dave<br>
>> (<a href="mailto:hyatt@apple.com">hyatt@apple.com</a>)<br>
>> On Jun 8, 2010, at 3:33 AM, Alex Vazquez wrote:<br>
>><br>
>> Hello list,<br>
>><br>
>> We're running a customized build of WebKit (actually a DirectFB port) and<br>
>> we are experiencing problems with the css :focus pseudo-class. We use webkit<br>
>> as GUI renderer and, when changing the focused element through JavaScript<br>
>> (using the focus function), the style associated to the :focus pseudo-class<br>
>> is not applied. The attached page is our reduced testcase, it should show<br>
>> two links, the first of them focused but it shows two unfocused links:<br>
>><br>
>> <html><br>
>><br>
>> <head><br>
>><br>
>> <style type="text/css"><br>
>><br>
>> body {<br>
>> color: #f00;<br>
>> background-color:#ddd;<br>
>> font-size:26px;<br>
>> }<br>
>><br>
>> div {<br>
>> float: left;<br>
>> padding: 50px;<br>
>> }<br>
>><br>
>> a, span {<br>
>> float:left;<br>
>> display:block;<br>
>> clear:both;<br>
>> }<br>
>><br>
>> a:focus {<br>
>> color:#f0f;<br>
>> }<br>
>><br>
>> </style><br>
>><br>
>> <script type="text/javascript"><br>
>><br>
>> function init() {<br>
>> document.getElementById("uno").focus();<br>
>> }<br>
>><br>
>> </script><br>
>><br>
>> </head><br>
>><br>
>> <body onload="init();"><br>
>> <div><br>
>><br>
>> <a id="uno" href="<a href="http://www.webkit.org/" target="_blank">http://www.webkit.org/</a>">WebKit</a><br>
>> <a id="dos" href="<a href="http://nightly.webkit.org" target="_blank">http://nightly.webkit.org</a>">Nightly<br>
>> Builds</a><br>
>><br>
>> </div><br>
>> </body><br>
>><br>
>> </html><br>
>><br>
>><br>
>> The version with this problem is based on r58260 revision while a<br>
>> previously one (with nearly the same adapted patches) based in r40084 worked<br>
>> fine. We build webkit for an embedded MIPS processor and for x86 too. Both<br>
>> versions show the undesired behaviour.<br>
>><br>
>> Investigating through the WebKit code, we've found that applying the<br>
>> following patch fixes the problem:<br>
>><br>
>> --- a/WebCore/css/CSSStyleSelector.cpp 2010-06-04 13:35:19.000000000<br>
>> +0000<br>
>> +++ b/WebCore/css/CSSStyleSelector.cpp 2010-06-04 13:35:35.000000000<br>
>> +0000<br>
>> @@ -2428,7 +2428,7 @@<br>
>> break;<br>
>> }<br>
>> case CSSSelector::PseudoFocus:<br>
>> - if (e && e->focused() &&<br>
>> e->document()->frame()->selection()->isFocusedAndActive())<br>
>> + if (e && e->focused())<br>
>> return true;<br>
>> break;<br>
>> case CSSSelector::PseudoHover: {<br>
>><br>
>> That line was there since r40084 and it worked so we have some questions<br>
>> about the patch:<br>
>><br>
>> * Does it have any problem that we have overlooked?<br>
>><br>
>> * Can someone with knowledge on the css component explain why the active<br>
>> state of the selection is checked in that line? We also try to change that<br>
>> check by e->document()->frame()->selection()->isFocused() but it didn't fix<br>
>> it.<br>
>><br>
>> Kind regards,<br>
>><br>
>> --<br>
>> Alejandro Vazquez Fente<br>
>><br>
>> <focus_index.html><css_style_selector_focus.patch>_______________________________________________<br>
>> webkit-dev mailing list<br>
>> <a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br>
>> <a href="http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev" target="_blank">http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev</a><br>
>><br>
><br>
><br>
><br>
> --<br>
> Alejandro Vazquez Fente<br>
><br>
> _______________________________________________<br>
> webkit-dev mailing list<br>
> <a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br>
> <a href="http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev" target="_blank">http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev</a><br>
><br>
><br>
<br>
<br>
<br>
--<br>
</div></div><font color="#888888">--Antonio Gomes<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Alejandro Vazquez Fente<br>