haikuwebkit/LayoutTests/accessibility/title-ui-element-correctnes...

24 lines
1.7 KiB
Plaintext
Raw Permalink Normal View History

AX: labelForElement is slow when there are a lot of DOM elements 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: Canonical link: https://commits.webkit.org/117807@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131871 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-10-19 08:01:06 +00:00
This tests that titleUIElement works correctly even when things change dynamically.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS axElement('control1').titleUIElement().isEqual(axElement('label1')) is true
PASS axElement('control2').titleUIElement().isEqual(axElement('label2')) is true
PASS hasTitleUIElement(axElement('control3')) is false
PASS document.getElementById('label3').setAttribute('for', 'control3'); axElement('control3').titleUIElement().isEqual(axElement('label3')) is true
PASS var label4Element = createLabelWithIdAndForAttribute('label4', 'control4'); hasTitleUIElement(axElement('control4')) is false
PASS document.getElementById('container').appendChild(label4Element); hasTitleUIElement(axElement('control4')) is true
PASS axElement('control4').titleUIElement().isEqual(axElement('label4')) is true
PASS label4Element.parentElement.removeChild(label4Element); hasTitleUIElement(axElement('control4')) is false
PASS hasTitleUIElement(axElement('control5')) is false
PASS reparentNodeIntoContainer(document.getElementById('control5'), document.getElementById('label5')); axElement('control5').titleUIElement() != null is true
PASS axElement('control5').titleUIElement().isEqual(axElement('label5')) is true
PASS axElement('control6').titleUIElement().isEqual(axElement('label6b')) is true
PASS newLabel6Element = createLabelWithIdAndForAttribute('label6a', 'control6'); document.body.insertBefore(newLabel6Element, document.body.firstChild); axElement('control6').titleUIElement().isEqual(axElement('label6a')) is true
PASS document.body.removeChild(newLabel6Element); axElement('control6').titleUIElement().isEqual(axElement('label6b')) is true
PASS successfullyParsed is true
TEST COMPLETE