• dmazzoni@google.com's avatar
    AX: labelForElement is slow when there are a lot of DOM elements · ef9d3350
    dmazzoni@google.com authored
    https://bugs.webkit.org/show_bug.cgi?id=97825
    
    Reviewed by Ryosuke Niwa.
    
    Source/WebCore:
    
    Adds a DocumentOrderedMap to TreeScope that allows accessibility to
    quickly map from an id to the label for that id. This speeds up
    AccessibilityNode::labelForElement, which was a bottleneck in Chromium
    when accessibility was on.
    
    Tests: accessibility/title-ui-element-correctness.html
           perf/accessibility-title-ui-element.html
    
    * accessibility/AccessibilityNodeObject.cpp:
    (WebCore::AccessibilityNodeObject::labelForElement):
    * dom/DocumentOrderedMap.cpp:
    (WebCore::keyMatchesLabelForAttribute):
    (WebCore):
    (WebCore::DocumentOrderedMap::get):
    (WebCore::DocumentOrderedMap::getElementByLabelForAttribute):
    * dom/DocumentOrderedMap.h:
    (DocumentOrderedMap):
    * dom/Element.cpp:
    (WebCore::Element::insertedInto):
    (WebCore::Element::removedFrom):
    (WebCore::Element::updateLabel):
    (WebCore):
    (WebCore::Element::willModifyAttribute):
    * dom/Element.h:
    (Element):
    * dom/TreeScope.cpp:
    (WebCore::TreeScope::TreeScope):
    (WebCore::TreeScope::destroyTreeScopeData):
    (WebCore::TreeScope::addLabel):
    (WebCore):
    (WebCore::TreeScope::removeLabel):
    (WebCore::TreeScope::labelElementForId):
    * dom/TreeScope.h:
    (WebCore):
    (TreeScope):
    (WebCore::TreeScope::shouldCacheLabelsByForAttribute):
    
    Tools:
    
    Implement titleUIElement in the chromium port of DRT, and
    fix getAccessibleElementById so that it ensures the backing store
    is up-to-date.
    
    * DumpRenderTree/chromium/TestRunner/AccessibilityControllerChromium.cpp:
    (AccessibilityController::getAccessibleElementById):
    * DumpRenderTree/chromium/TestRunner/AccessibilityUIElementChromium.cpp:
    (AccessibilityUIElement::titleUIElementCallback):
    
    LayoutTests:
    
    Adds two new tests for titleUIElement that run on both Mac and
    Chromium. One tests correctness, the other tests speed.
    
    Fixes one test so that it passes on Chromium.
    Enables other tests that now pass on Chromium.
    
    * accessibility/secure-textfield-title-ui.html:
    * accessibility/title-ui-element-correctness-expected.txt: Added.
    * accessibility/title-ui-element-correctness.html: Added.
    * perf/accessibility-title-ui-element-expected.txt: Added.
    * perf/accessibility-title-ui-element.html: Added.
    * platform/chromium/TestExpectations:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131871 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    ef9d3350
accessibility-title-ui-element-expected.txt 93 Bytes