[webkit-dev] image maps to be focused via tab

browserwk browserwk at gmail.com
Fri Nov 14 00:24:04 PST 2008


Darin Adler 写道:
> On Nov 6, 2008, at 5:28 PM, browser webkit wrote:
>
>> In msie/firefox, image map can be TAB focused with outline rendered,
>> but not under webkit based browser.
>>
>> So, i start to modify code for test. I found have a mapMouseEvent()
>> function in HTMLMapElement.cpp, then if i want to implement the TAB
>> focus in image map, is it necessary to implement a
>> defaultkeyboardevent() function and other things ?
>
> No, you would not add a new function to handle the keyboard event. The
> tab key is implemented for the entire document, not in each node that
> participates in tab navigation.
>
> The code that handles navigation with the tab key is in the
> FocusController class.
>
> FocusController::advanceFocus
>
> There are also the following key related functions in the Document class.
>
> Document::nextFocusableNode
> Document::previousFocusableNode
> Document::setFocusedNode
>
> However, to make image map focusing these functions would have to be
> changed. To identify an image map element you need to have both the
> image node and the area node inside the map. Because the same image
> map can be used with multiple image nodes.
>
> So we'd have to change things so we can track a particular img/area
> pair, and then also update the code to understand where these fit in
> to the "next focused node" loop and to draw the focus properly.
>
> It's a moderately difficult project.
>
> -- Darin
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
Thanks Darin

Follow u suggesion, i did some work, but not solved.
Before list, i assume html page have only one <img> and <map>(also one
<area>) tag, but also they are bounded.

In order to focus navigate via tab, i did follow things.
1 to identify <img>,<area> tag
I can get the <img> or <area> node from
Document::nextFocusableNode
Document::previousFocusableNode.

2 get absolutely position
Also, i had got the position of the <img> and each <area> node with
nonstandard way, in any way.
If i use areaNode->renderer(), i will got NULL.
I didn't know the reason.If u can, tell me more.

3 to focus <area> node
In this step, i fail to focus the <area> node, moreover didn't see the
focus ring.
And i found the <area> node never pass through the isKeyboardFocusable()
function.
So, some questions
<1> I want to know the factor that a node need be focusable, just like
<area> node.
<2> Can i render the focus ring, when i got the <area> node and it's
absolutely postion ?

thanks again


More information about the webkit-dev mailing list