void AccessibilityUIElement::titleUIElementCallback(const CppArgumentList&, CppVariant* result) { WebAccessibilityObject obj = accessibilityObject().titleUIElement(); if (obj.isNull()) { result->setNull(); return; } result->set(*(m_factory->getOrCreate(obj)->getAsCppVariant())); }
string getRole(const WebAccessibilityObject& object) { string roleString = roleToString(object.roleValue()); // Special-case canvas with fallback content because Chromium wants to // treat this as essentially a separate role that it can map differently depending // on the platform. if (object.roleValue() == WebAccessibilityRoleCanvas && object.canvasHasFallbackContent()) roleString += "WithFallbackContent"; return roleString; }
void WebAccessibilityCacheImpl::initialize(WebView* view) { AXObjectCache::enableAccessibility(); WebAccessibilityObject root = view->accessibilityObject(); if (root.isNull()) return; RefPtr<AccessibilityObject> rootObject = toAccessibilityObject(root); // Insert root in hashmaps. m_objectMap.set(m_nextNewId, WeakHandle::create(rootObject.get())); m_idMap.set(rootObject.get(), m_nextNewId++); m_initialized = true; }
void AccessibilityUIElement::elementAtPointCallback(const CppArgumentList& arguments, CppVariant* result) { result->setNull(); if (arguments.size() != 2 || !arguments[0].isNumber() || !arguments[1].isNumber()) return; int x = arguments[0].toInt32(); int y = arguments[1].toInt32(); WebPoint point(x, y); WebAccessibilityObject obj = accessibilityObject().hitTest(point); if (obj.isNull()) return; result->set(*(m_factory->getOrCreate(obj)->getAsCppVariant())); }
string getOrientation(const WebAccessibilityObject& object) { if (object.isVertical()) return "AXOrientation: AXVerticalOrientation"; return "AXOrientation: AXHorizontalOrientation"; }
bool WebAccessibilityCacheImpl::isCached(const WebAccessibilityObject& object) { if (!object.isValid()) return false; RefPtr<AccessibilityObject> o = toAccessibilityObject(object); IdMap::iterator it = m_idMap.find(o.get()); if (it == m_idMap.end()) return false; return true; }
int WebAccessibilityCacheImpl::addOrGetId(const WebAccessibilityObject& object) { if (object.isNull()) return invalidObjectId; RefPtr<AccessibilityObject> o = toAccessibilityObject(object); IdMap::iterator it = m_idMap.find(o.get()); if (it != m_idMap.end()) return it->second; // Insert new accessibility object in hashmaps and return its newly // assigned accessibility object id. m_objectMap.set(m_nextNewId, WeakHandle::create(o.get())); m_idMap.set(o.get(), m_nextNewId); return m_nextNewId++; }
void WebViewHost::postAccessibilityNotification(const WebAccessibilityObject& obj, WebAccessibilityNotification notification) { if (notification == WebAccessibilityNotificationFocusedUIElementChanged) m_shell->accessibilityController()->setFocusedElement(obj); if (m_shell->accessibilityController()->shouldDumpAccessibilityNotifications()) { printf("AccessibilityNotification - "); switch (notification) { case WebAccessibilityNotificationActiveDescendantChanged: printf("ActiveDescendantChanged"); break; case WebAccessibilityNotificationCheckedStateChanged: printf("CheckedStateChanged"); break; case WebAccessibilityNotificationChildrenChanged: printf("ChildrenChanged"); break; case WebAccessibilityNotificationFocusedUIElementChanged: printf("FocusedUIElementChanged"); break; case WebAccessibilityNotificationLayoutComplete: printf("LayoutComplete"); break; case WebAccessibilityNotificationLoadComplete: printf("LoadComplete"); break; case WebAccessibilityNotificationSelectedChildrenChanged: printf("SelectedChildrenChanged"); break; case WebAccessibilityNotificationSelectedTextChanged: printf("SelectedTextChanged"); break; case WebAccessibilityNotificationValueChanged: printf("ValueChanged"); break; case WebAccessibilityNotificationScrolledToAnchor: printf("ScrolledToAnchor"); break; case WebAccessibilityNotificationLiveRegionChanged: printf("LiveRegionChanged"); break; case WebAccessibilityNotificationMenuListValueChanged: printf("MenuListValueChanged"); break; case WebAccessibilityNotificationRowCountChanged: printf("RowCountChanged"); break; case WebAccessibilityNotificationRowCollapsed: printf("RowCollapsed"); break; case WebAccessibilityNotificationRowExpanded: printf("RowExpanded"); break; default: break; } WebKit::WebNode node = obj.node(); if (!node.isNull() && node.isElementNode()) { WebKit::WebElement element = node.to<WebKit::WebElement>(); if (element.hasAttribute("id")) printf(" - id:%s", element.getAttribute("id").utf8().data()); } printf("\n"); } }
string getTitle(const WebAccessibilityObject& object) { string title = object.title().utf8(); return title.insert(0, "AXTitle: "); }
string getRole(const WebAccessibilityObject& object) { return roleToString(object.roleValue()); }
string getDescription(const WebAccessibilityObject& object) { string description = object.accessibilityDescription().utf8(); return description.insert(0, "AXDescription: "); }
string getValueDescription(const WebAccessibilityObject& object) { string valueDescription = object.valueDescription().utf8(); return valueDescription.insert(0, "AXValueDescription: "); }
string getStringValue(const WebAccessibilityObject& object) { string value = object.stringValue().utf8(); return value.insert(0, "AXValue: "); }
string getHelpText(const WebAccessibilityObject& object) { string helpText = object.helpText().utf8(); return helpText.insert(0, "AXHelp: "); }