void AccessibilityUIElement::parentElementCallback(const CppArgumentList&, CppVariant* result)
{
    AccessibilityUIElement* parent = m_factory->getOrCreate(accessibilityObject().parentObject());
    if (!parent) {
        result->setNull();
        return;
    }

    result->set(*(parent->getAsCppVariant()));
}
Beispiel #2
0
void AccessibilityController::accessibleElementByIdGetterCallback(const CppArgumentList& arguments, CppVariant* result)
{
    result->setNull();

    if (arguments.size() < 1 || !arguments[0].isString())
        return;

    std::string id = arguments[0].toString();
    AccessibilityUIElement* foundElement = getAccessibleElementById(id);
    if (!foundElement)
        return;

    result->set(*(foundElement->getAsCppVariant()));
}
Beispiel #3
0
void AccessibilityUIElement::childAtIndexCallback(const CppArgumentList& arguments, CppVariant* result)
{
    if (!arguments.size() || !arguments[0].isNumber()) {
        result->setNull();
        return;
    }

    AccessibilityUIElement* child = getChildAtIndex(arguments[0].toInt32());
    if (!child) {
        result->setNull();
        return;
    }

    result->set(*(child->getAsCppVariant()));
}
Beispiel #4
0
void AccessibilityController::notificationReceived(const WebKit::WebAccessibilityObject& target, const char* notificationName)
{
    // Call notification listeners on the element.
    AccessibilityUIElement* element = m_elements.getOrCreate(target);
    element->notificationReceived(notificationName);

    // Call global notification listeners.
    size_t callbackCount = m_notificationCallbacks.size();
    for (size_t i = 0; i < callbackCount; i++) {
        CppVariant arguments[2];
        arguments[0].set(*element->getAsCppVariant());
        arguments[1].set(notificationName);
        CppVariant invokeResult;
        m_notificationCallbacks[i].invokeDefault(arguments, 2, invokeResult);
    }
}