[Webkit-unassigned] [Bug 20013] Windows AX huerusitics are poor

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 31 15:09:29 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=20013





------- Comment #45 from eric at webkit.org  2008-07-31 15:09 PDT -------
(From update of attachment 22470)
I just realized there is another problem with this patch:

The "create*Hash" functions are "wrong" because they end up causing the lookup
to be against the "prefix:localName" pair.  Two elements can have matching
qualified names, even if their prefixes are different.  All you care about is
that their namespaceURIs and localNames match.

+static HashSet<String, CaseFoldingHash>*
createTextFormattingElementNamesHash() 
+{
+    static HashSet<String, CaseFoldingHash> elementHashSet;
+    if (elementHashSet.isEmpty()) {

For example, this snippet of xhtml:

<foobar:p xmlns:foobar="http://www.w3.org/1999/xhtml" />

That is a "p" tag, and should be treated just like <p> in an HTML document or
just like <xhtml:p> (if in some other document "xhtml" is bound to the xhtml
namespace).

The current code would do a lookup comparing "p" against "foobar:p" and fail. 
That's not what you want. :)

A better way to do this lookup would probably be to just inline the hashtable
back into the isTextFormattingElement function and do the namespaceURI
comparison right before the hash-lookup. Like this:

bool AccessibilityRenderObject::isTextFormattingElement() const
{
    if (!m_renderer || !m_renderer->element())
           return false;

    Element* element = m_renderer->element();
    if (element->namespaceURI() != HTMLNames::htmlNamespaceURI)
        return false;

    static HashSet<String, CaseFoldingHash> formattingElements;
    if (formattingElements.isEmpty()) {
        formattingElements.add(bTag.localName());
        formattingElements.add(bdoTag.localName());
        ...
    }

    return formattingElements.contains(element->localName());
}

I suggest inlining the hash setup back into the isTextFormattingElement
function, because the hash can't really stand alone w/o the namespace lookup.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list