当前位置: 首页>>代码示例>>C++>>正文


C++ AXObjectCache::getOrCreate方法代码示例

本文整理汇总了C++中AXObjectCache::getOrCreate方法的典型用法代码示例。如果您正苦于以下问题:C++ AXObjectCache::getOrCreate方法的具体用法?C++ AXObjectCache::getOrCreate怎么用?C++ AXObjectCache::getOrCreate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AXObjectCache的用法示例。


在下文中一共展示了AXObjectCache::getOrCreate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: firstAccessibleObjectFromNode

AccessibilityObject* AccessibilityObject::firstAccessibleObjectFromNode(const Node* node)
{
    ASSERT(AXObjectCache::accessibilityEnabled());

    if (!node)
        return 0;

    Document* document = node->document();
    if (!document)
        return 0;

    AXObjectCache* cache = document->axObjectCache();

    AccessibilityObject* accessibleObject = cache->getOrCreate(node->renderer());
    while (accessibleObject && accessibleObject->accessibilityIsIgnored()) {
        node = node->traverseNextNode();

        while (node && !node->renderer())
            node = node->traverseNextSibling();

        if (!node)
            return 0;

        accessibleObject = cache->getOrCreate(node->renderer());
    }

    return accessibleObject;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:28,代码来源:AccessibilityObject.cpp

示例2: firstAccessibleObjectFromNode

AccessibilityObject* AccessibilityObject::firstAccessibleObjectFromNode(const Node* node)
{
    if (!node)
        return 0;

    Document* document = node->document();
    if (!document)
        return 0;

    AXObjectCache* cache = document->axObjectCache();

    AccessibilityObject* accessibleObject = cache->getOrCreate(node->renderer());
    while (accessibleObject && accessibleObject->accessibilityIsIgnored()) {
        node = NodeTraversal::next(node);

        while (node && !node->renderer())
            node = NodeTraversal::nextSkippingChildren(node);

        if (!node)
            return 0;

        accessibleObject = cache->getOrCreate(node->renderer());
    }

    return accessibleObject;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:26,代码来源:AccessibilityObject.cpp

示例3: scroll

bool Scrollbar::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier)
{
#if HAVE(ACCESSIBILITY)
    if (AXObjectCache::accessibilityEnabled()) {
        if (parent() && parent()->isFrameView()) {
            Document* document = static_cast<FrameView*>(parent())->frame()->document();
            AXObjectCache* cache = document->axObjectCache();
            AccessibilityScrollbar* axObject = static_cast<AccessibilityScrollbar*>(cache->getOrCreate(ScrollBarRole));
            axObject->setScrollbar(this);
            cache->postNotification(axObject, document, AXObjectCache::AXValueChanged, true);
        }
    }
#endif

    // Ignore perpendicular scrolls.
    if ((m_orientation == HorizontalScrollbar) ? (direction == ScrollUp || direction == ScrollDown) : (direction == ScrollLeft || direction == ScrollRight))
        return false;
    float step = 0;
    switch (granularity) {
    case ScrollByLine:     step = m_lineStep;  break;
    case ScrollByPage:     step = m_pageStep;  break;
    case ScrollByDocument: step = m_totalSize; break;
    case ScrollByPixel:    step = m_pixelStep; break;
    }
    if (direction == ScrollUp || direction == ScrollLeft)
        multiplier = -multiplier;
    if (client())
        return client()->scroll(m_orientation, granularity, step, multiplier);

    return setCurrentPos(max(min(m_currentPos + (step * multiplier), static_cast<float>(m_totalSize - m_visibleSize)), 0.0f), NotFromScrollAnimator);
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:31,代码来源:Scrollbar.cpp

示例4: addChildren

void AccessibilityARIAGrid::addChildren()
{
    ASSERT(!m_haveChildren); 
    
    if (!isAccessibilityTable()) {
        AccessibilityRenderObject::addChildren();
        return;
    }
    
    m_haveChildren = true;
    if (!m_renderer)
        return;
    
    AXObjectCache* axCache = m_renderer->document().axObjectCache();
    
    // add only rows that are labeled as aria rows
    HashSet<AccessibilityObject*> appendedRows;
    unsigned columnCount = 0;
    for (RefPtr<AccessibilityObject> child = firstChild(); child; child = child->nextSibling())
        addRowDescendant(child.get(), appendedRows, columnCount);
    
    // make the columns based on the number of columns in the first body
    for (unsigned i = 0; i < columnCount; ++i) {
        AccessibilityTableColumn* column = toAccessibilityTableColumn(axCache->getOrCreate(ColumnRole));
        column->setColumnIndex((int)i);
        column->setParent(this);
        m_columns.append(column);
        if (!column->accessibilityIsIgnored())
            m_children.append(column);
    }
    
    AccessibilityObject* headerContainerObject = headerContainer();
    if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored())
        m_children.append(headerContainerObject);
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:35,代码来源:AccessibilityARIAGrid.cpp

示例5: textMarkerDataForVisiblePosition

void AXObjectCache::textMarkerDataForVisiblePosition(TextMarkerData& textMarkerData, const VisiblePosition& visiblePos)
{
    // This memory must be bzero'd so instances of TextMarkerData can be tested for byte-equivalence.
    // This also allows callers to check for failure by looking at textMarkerData upon return.
    memset(&textMarkerData, 0, sizeof(TextMarkerData));
    
    if (visiblePos.isNull())
        return;
    
    Position deepPos = visiblePos.deepEquivalent();
    Node* domNode = deepPos.deprecatedNode();
    ASSERT(domNode);
    if (!domNode)
        return;
    
    if (domNode->isHTMLElement()) {
        HTMLInputElement* inputElement = domNode->toInputElement();
        if (inputElement && inputElement->isPasswordField())
            return;
    }
    
    // find or create an accessibility object for this node
    AXObjectCache* cache = domNode->document()->axObjectCache();
    RefPtr<AccessibilityObject> obj = cache->getOrCreate(domNode);
    
    textMarkerData.axID = obj.get()->axObjectID();
    textMarkerData.node = domNode;
    textMarkerData.offset = deepPos.deprecatedEditingOffset();
    textMarkerData.affinity = visiblePos.affinity();   
    
    cache->setNodeInUse(domNode);
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例6: notifyAccessibilityForSelectionChange

void FrameSelection::notifyAccessibilityForSelectionChange(const AXTextStateChangeIntent&)
{
    if (!AXObjectCache::accessibilityEnabled())
        return;

    if (!m_selection.start().isNotNull() || !m_selection.end().isNotNull())
        return;

    RenderObject* focusedNode = m_selection.end().containerNode()->renderer();
    AXObjectCache* cache = m_frame->document()->existingAXObjectCache();
    if (!cache)
        return;

    AccessibilityObject* accessibilityObject = cache->getOrCreate(focusedNode);
    if (!accessibilityObject)
        return;

    int offset;
    RefPtr<AccessibilityObject> object = objectFocusedAndCaretOffsetUnignored(accessibilityObject, offset);
    if (!object)
        return;

    emitTextSelectionChange(object.get(), m_selection, offset);
    maybeEmitTextFocusChange(WTFMove(object));
}
开发者ID:edcwconan,项目名称:webkit,代码行数:25,代码来源:FrameSelectionAtk.cpp

示例7: addChildren

void AccessibilityARIAGrid::addChildren()
{
    ASSERT(!m_haveChildren); 
    
    if (!isAccessibilityTable()) {
        AccessibilityRenderObject::addChildren();
        return;
    }
    
    m_haveChildren = true;
    if (!m_renderer)
        return;
    
    AXObjectCache* axCache = m_renderer->document().axObjectCache();
    
    // Add the children rows but be mindful in case there are footer sections in this table.
    HashSet<AccessibilityObject*> appendedRows;
    unsigned columnCount = 0;
    AccessibilityChildrenVector footerSections;
    for (RefPtr<AccessibilityObject> child = firstChild(); child; child = child->nextSibling()) {
        bool footerSection = false;
        if (RenderObject* childRenderer = child->renderer()) {
            if (childRenderer->isTableSection()) {
                if (RenderTableSection* childSection = toRenderTableSection(childRenderer)) {
                    if (childSection == childSection->table()->footer()) {
                        footerSections.append(child);
                        footerSection = true;
                    }
                }
            }
        }
        if (!footerSection)
            addRowDescendant(child.get(), appendedRows, columnCount);
    }
    
    for (const auto& footerSection : footerSections)
        addRowDescendant(footerSection.get(), appendedRows, columnCount);
    
    // make the columns based on the number of columns in the first body
    for (unsigned i = 0; i < columnCount; ++i) {
        AccessibilityTableColumn* column = toAccessibilityTableColumn(axCache->getOrCreate(ColumnRole));
        column->setColumnIndex((int)i);
        column->setParent(this);
        m_columns.append(column);
        if (!column->accessibilityIsIgnored())
            m_children.append(column);
    }
    
    AccessibilityObject* headerContainerObject = headerContainer();
    if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored())
        m_children.append(headerContainerObject);
}
开发者ID:CannedFish,项目名称:webkit,代码行数:52,代码来源:AccessibilityARIAGrid.cpp

示例8: addChildScrollbar

AccessibilityScrollbar* AccessibilityScrollView::addChildScrollbar(Scrollbar* scrollbar)
{
    if (!scrollbar)
        return nullptr;
    
    AXObjectCache* cache = axObjectCache();
    if (!cache)
        return nullptr;

    auto& scrollBarObject = downcast<AccessibilityScrollbar>(*cache->getOrCreate(scrollbar));
    scrollBarObject.setParent(this);
    m_children.append(&scrollBarObject);
    return &scrollBarObject;
}
开发者ID:biddyweb,项目名称:switch-oss,代码行数:14,代码来源:AccessibilityScrollView.cpp

示例9: addChildScrollbar

AccessibilityScrollbar* AccessibilityScrollView::addChildScrollbar(Scrollbar* scrollbar)
{
    if (!scrollbar)
        return nullptr;
    
    AXObjectCache* cache = axObjectCache();
    if (!cache)
        return nullptr;

    AccessibilityScrollbar* scrollBarObject = toAccessibilityScrollbar(cache->getOrCreate(scrollbar));
    scrollBarObject->setParent(this);
    m_children.append(scrollBarObject);
    return scrollBarObject;
}
开发者ID:chenbk85,项目名称:webkit2-wincairo,代码行数:14,代码来源:AccessibilityScrollView.cpp

示例10: addChildren

void AccessibilityARIAGrid::addChildren()
{
    ASSERT(!m_haveChildren); 
    
    if (!isAccessibilityTable()) {
        AccessibilityRenderObject::addChildren();
        return;
    }
    
    m_haveChildren = true;
    if (!m_renderer)
        return;
    
    AXObjectCache* axCache = m_renderer->document()->axObjectCache();
    
    // add only rows that are labeled as aria rows
    HashSet<AccessibilityObject*> appendedRows;
    unsigned columnCount = 0;
    for (RefPtr<AccessibilityObject> child = firstChild(); child; child = child->nextSibling()) {

        if (!addTableCellChild(child.get(), appendedRows, columnCount)) {
            
            // in case the render tree doesn't match the expected ARIA hierarchy, look at the children
            if (!child->hasChildren())
                child->addChildren();

            // The children of this non-row will contain all non-ignored elements (recursing to find them). 
            // This allows the table to dive arbitrarily deep to find the rows.
            AccessibilityChildrenVector children = child->children();
            size_t length = children.size();
            for (size_t i = 0; i < length; ++i)
                addTableCellChild(children[i].get(), appendedRows, columnCount);
        }
    }
    
    // make the columns based on the number of columns in the first body
    for (unsigned i = 0; i < columnCount; ++i) {
        AccessibilityTableColumn* column = static_cast<AccessibilityTableColumn*>(axCache->getOrCreate(ColumnRole));
        column->setColumnIndex((int)i);
        column->setParent(this);
        m_columns.append(column);
        if (!column->accessibilityIsIgnored())
            m_children.append(column);
    }
    
    AccessibilityObject* headerContainerObject = headerContainer();
    if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored())
        m_children.append(headerContainerObject);
}
开发者ID:fatman2021,项目名称:webkitgtk,代码行数:49,代码来源:AccessibilityARIAGrid.cpp

示例11: parentObject

AccessibilityObject* AccessibilityScrollView::parentObject() const
{
    if (!is<FrameView>(m_scrollView))
        return nullptr;

    AXObjectCache* cache = axObjectCache();
    if (!cache)
        return nullptr;

    HTMLFrameOwnerElement* owner = downcast<FrameView>(*m_scrollView).frame().ownerElement();
    if (owner && owner->renderer())
        return cache->getOrCreate(owner);

    return nullptr;
}
开发者ID:biddyweb,项目名称:switch-oss,代码行数:15,代码来源:AccessibilityScrollView.cpp

示例12: parentObject

AccessibilityObject* AccessibilityScrollView::parentObject() const
{
    if (!m_scrollView || !m_scrollView->isFrameView())
        return nullptr;

    AXObjectCache* cache = axObjectCache();
    if (!cache)
        return nullptr;

    HTMLFrameOwnerElement* owner = toFrameView(m_scrollView)->frame().ownerElement();
    if (owner && owner->renderer())
        return cache->getOrCreate(owner);

    return nullptr;
}
开发者ID:chenbk85,项目名称:webkit2-wincairo,代码行数:15,代码来源:AccessibilityScrollView.cpp

示例13: addChildren

void AccessibilityTable::addChildren()
{
    if (!isAccessibilityTable()) {
        AccessibilityRenderObject::addChildren();
        return;
    }
    
    ASSERT(!m_haveChildren); 
    
    m_haveChildren = true;
    if (!m_renderer || !m_renderer->isTable())
        return;
    
    RenderTable* table = toRenderTable(m_renderer);
    // Go through all the available sections to pull out the rows and add them as children.
    table->recalcSectionsIfNeeded();
    
    unsigned maxColumnCount = 0;
    RenderTableSection* footer = table->footer();
    
    for (RenderTableSection* tableSection = table->topSection(); tableSection; tableSection = table->sectionBelow(tableSection, SkipEmptySections)) {
        if (tableSection == footer)
            continue;
        addChildrenFromSection(tableSection, maxColumnCount);
    }
    
    // Process the footer last, in case it was ordered earlier in the DOM.
    if (footer)
        addChildrenFromSection(footer, maxColumnCount);
    
    AXObjectCache* axCache = m_renderer->document().axObjectCache();
    // make the columns based on the number of columns in the first body
    unsigned length = maxColumnCount;
    for (unsigned i = 0; i < length; ++i) {
        AccessibilityTableColumn* column = toAccessibilityTableColumn(axCache->getOrCreate(ColumnRole));
        column->setColumnIndex((int)i);
        column->setParent(this);
        m_columns.append(column);
        if (!column->accessibilityIsIgnored())
            m_children.append(column);
    }
    
    AccessibilityObject* headerContainerObject = headerContainer();
    if (headerContainerObject && !headerContainerObject->accessibilityIsIgnored())
        m_children.append(headerContainerObject);
}
开发者ID:CannedFish,项目名称:webkit,代码行数:46,代码来源:AccessibilityTable.cpp

示例14: addChildren

void AccessibilitySlider::addChildren()
{
    ASSERT(!m_haveChildren); 
    
    m_haveChildren = true;

    AXObjectCache* cache = m_renderer->document()->axObjectCache();

    AccessibilitySliderThumb* thumb = static_cast<AccessibilitySliderThumb*>(cache->getOrCreate(SliderThumbRole));
    thumb->setParent(this);

    // Before actually adding the value indicator to the hierarchy,
    // allow the platform to make a final decision about it.
    if (thumb->accessibilityIsIgnored())
        cache->remove(thumb->axObjectID());
    else
        m_children.append(thumb);
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例15: notifyAccessibilityStatus

static void notifyAccessibilityStatus(WebKitWebFrame* frame, WebKitLoadStatus loadStatus)
{
    if (loadStatus != WEBKIT_LOAD_PROVISIONAL
        && loadStatus != WEBKIT_LOAD_FAILED
        && loadStatus != WEBKIT_LOAD_FINISHED)
        return;

    WebKitWebFramePrivate* priv = frame->priv;
    if (!priv->coreFrame || !priv->coreFrame->document())
        return;

    RenderView* contentRenderer = priv->coreFrame->contentRenderer();
    if (!contentRenderer)
        return;

    AXObjectCache* axObjectCache = priv->coreFrame->document()->axObjectCache();
    if (!axObjectCache)
        return;

    AccessibilityObject* coreAxObject = axObjectCache->getOrCreate(contentRenderer);
    if (!coreAxObject)
        return;

    AtkObject* axObject = coreAxObject->wrapper();
    if (!axObject || !ATK_IS_DOCUMENT(axObject))
        return;

    switch (loadStatus) {
    case WEBKIT_LOAD_PROVISIONAL:
        g_signal_emit_by_name(axObject, "state-change", "busy", true);
        if (core(frame)->loader()->loadType() == FrameLoadTypeReload)
            g_signal_emit_by_name(axObject, "reload");
        break;
    case WEBKIT_LOAD_FAILED:
        g_signal_emit_by_name(axObject, "load-stopped");
        g_signal_emit_by_name(axObject, "state-change", "busy", false);
        break;
    case WEBKIT_LOAD_FINISHED:
        g_signal_emit_by_name(axObject, "load-complete");
        g_signal_emit_by_name(axObject, "state-change", "busy", false);
    default:
        break;
    }
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:44,代码来源:FrameLoaderClientGtk.cpp


注:本文中的AXObjectCache::getOrCreate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。