AXObject* AXObjectCacheImpl::focusedUIElementForPage(const Page* page) { if (!page->settings().accessibilityEnabled()) return 0; // Cross-process accessibility is not yet implemented. if (!page->focusController().focusedOrMainFrame()->isLocalFrame()) return 0; // get the focused node in the page Document* focusedDocument = toLocalFrame(page->focusController().focusedOrMainFrame())->document(); Node* focusedNode = focusedDocument->focusedElement(); if (!focusedNode) focusedNode = focusedDocument; if (isHTMLAreaElement(*focusedNode)) return focusedImageMapUIElement(toHTMLAreaElement(focusedNode)); AXObject* obj = toAXObjectCacheImpl(focusedNode->document().axObjectCache())->getOrCreate(focusedNode); if (!obj) return 0; if (obj->shouldFocusActiveDescendant()) { if (AXObject* descendant = obj->activeDescendant()) obj = descendant; } // the HTML element, for example, is focusable but has an AX object that is ignored if (obj->accessibilityIsIgnored()) obj = obj->parentObjectUnignored(); return obj; }
AXObject* AXObjectCache::focusedUIElementForPage(const Page* page) { if (!gAccessibilityEnabled) return 0; // get the focused node in the page Document* focusedDocument = page->focusController().focusedOrMainFrame()->document(); Node* focusedNode = focusedDocument->focusedElement(); if (!focusedNode) focusedNode = focusedDocument; if (focusedNode->hasTagName(areaTag)) return focusedImageMapUIElement(toHTMLAreaElement(focusedNode)); AXObject* obj = focusedNode->document().axObjectCache()->getOrCreate(focusedNode); if (!obj) return 0; if (obj->shouldFocusActiveDescendant()) { if (AXObject* descendant = obj->activeDescendant()) obj = descendant; } // the HTML element, for example, is focusable but has an AX object that is ignored if (obj->accessibilityIsIgnored()) obj = obj->parentObjectUnignored(); return obj; }
AXObject* AXObjectCacheImpl::focusedObject() { if (!accessibilityEnabled()) return 0; // We don't have to return anything if the focused frame is not local; // the remote frame will have its own AXObjectCacheImpl and the focused // object will be sorted out by the browser process. Page* page = m_document->page(); if (!page->focusController().focusedFrame()) return 0; // Get the focused node in the page. Document* focusedDocument = page->focusController().focusedFrame()->document(); Node* focusedNode = focusedDocument->focusedElement(); if (!focusedNode) focusedNode = focusedDocument; // If it's an image map, get the focused link within the image map. if (isHTMLAreaElement(focusedNode)) return focusedImageMapUIElement(toHTMLAreaElement(focusedNode)); // See if there's a page popup, for example a calendar picker. Element* adjustedFocusedElement = focusedDocument->adjustedFocusedElement(); if (isHTMLInputElement(adjustedFocusedElement)) { if (AXObject* axPopup = toHTMLInputElement(adjustedFocusedElement)->popupRootAXObject()) { if (Element* focusedElementInPopup = axPopup->document()->focusedElement()) focusedNode = focusedElementInPopup; } } AXObject* obj = getOrCreate(focusedNode); if (!obj) return 0; if (obj->shouldFocusActiveDescendant()) { if (AXObject* descendant = obj->activeDescendant()) obj = descendant; } // the HTML element, for example, is focusable but has an AX object that is ignored if (obj->accessibilityIsIgnored()) obj = obj->parentObjectUnignored(); return obj; }