[PATCH] Automatic assignment of accesskeys

Lubos Lunak l.lunak at suse.cz
Fri Apr 8 16:06:23 BST 2005


On Friday 08 of April 2005 16:47, Tobias Anton wrote:
> Am Freitag, 8. April 2005 15:09 schrieb Lubos Lunak:
> >  What do you think of it?
>
> Great patch, i'd only change the following:
>
> +            if( element->getAttribute( ATTR_ACCESSKEY ).length() == 1 )
> +                continue; // has accesskey set, ignore
>
> check for length() > 0 instead

 That length() == 1 is used in the already existing accesskeys code (although 
that may be also from me), so that would need to be changed. But what should 
the code actually do when it's e.g. length() == 2? The spec says it should be 
a single character anyway, so I think it's fine that way.

> +                    url =
> khtml::parseURL(element->getAttribute(ATTR_HREF)).string();
> +                    if( url.isEmpty()) // doesn't have href [...]
> +                        continue;
>
> no need to parseURL, stripWhitespace().length() > 0 should suffice.

 Hmm, right. I simply copied reading of the href from 
HTMLAnchorElementImpl::defaultEventHandler() without thinking much about it.

> Otherwise, the function
> 	DOM::NodeImpl::isSelectable()
> might be useful to determine - in a generic way - whether an accesskey
> makes sense. This way, you could cope with selectable elements whose ID you
> don't know (may happen e.g. when rendering XML or perhaps in case of
> advanced CSS usage).

 So the default case in the first "switch( element->id())" should be changed 
from "ignore = true" to "ignore = !element->isSelectable()" ? I'm not quite 
sure I understand what you mean, you shouldn't try to scare me with talking 
about rendering XML or advanced CSS usage :).

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/




More information about the kfm-devel mailing list