コード例 #1
0
void AccessibilityUIElement::titleUIElementCallback(const CppArgumentList&, CppVariant* result)
{
    WebAccessibilityObject obj = accessibilityObject().titleUIElement();
    if (obj.isNull()) {
        result->setNull();
        return;
    }

    result->set(*(m_factory->getOrCreate(obj)->getAsCppVariant()));
}
コード例 #2
0
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;
}
コード例 #3
0
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;
}
コード例 #4
0
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()));
}
コード例 #5
0
string getOrientation(const WebAccessibilityObject& object)
{
    if (object.isVertical())
        return "AXOrientation: AXVerticalOrientation";

    return "AXOrientation: AXHorizontalOrientation";
}
コード例 #6
0
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;
}
コード例 #7
0
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++;
}
コード例 #8
0
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");
    }
}
コード例 #9
0
string getTitle(const WebAccessibilityObject& object)
{
    string title = object.title().utf8();
    return title.insert(0, "AXTitle: ");
}
コード例 #10
0
string getRole(const WebAccessibilityObject& object)
{
    return roleToString(object.roleValue());
}
コード例 #11
0
string getDescription(const WebAccessibilityObject& object)
{
    string description = object.accessibilityDescription().utf8();
    return description.insert(0, "AXDescription: ");
}
コード例 #12
0
string getValueDescription(const WebAccessibilityObject& object)
{
    string valueDescription = object.valueDescription().utf8();
    return valueDescription.insert(0, "AXValueDescription: ");
}
コード例 #13
0
string getStringValue(const WebAccessibilityObject& object)
{
    string value = object.stringValue().utf8();
    return value.insert(0, "AXValue: ");
}
コード例 #14
0
string getHelpText(const WebAccessibilityObject& object)
{
    string helpText = object.helpText().utf8();
    return helpText.insert(0, "AXHelp: ");
}