本文整理汇总了C++中AccessibilityObject类的典型用法代码示例。如果您正苦于以下问题:C++ AccessibilityObject类的具体用法?C++ AccessibilityObject怎么用?C++ AccessibilityObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AccessibilityObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replacedNodeNeedsCharacter
static bool replacedNodeNeedsCharacter(Node* replacedNode)
{
// we should always be given a rendered node and a replaced node, but be safe
// replaced nodes are either attachments (widgets) or images
if (!replacedNode || !replacedNode->renderer() || !replacedNode->renderer()->isReplaced() || replacedNode->isTextNode())
return false;
// create an AX object, but skip it if it is not supposed to be seen
AccessibilityObject* object = replacedNode->renderer()->document()->axObjectCache()->getOrCreate(replacedNode->renderer());
if (object->accessibilityIsIgnored())
return false;
return true;
}
示例2: webkit_accessible_get_role
static AtkRole webkit_accessible_get_role(AtkObject* object)
{
AccessibilityObject* AXObject = core(object);
if (!AXObject)
return ATK_ROLE_UNKNOWN;
// WebCore does not seem to have a role for list items
if (AXObject->isGroup()) {
AccessibilityObject* parent = AXObject->parentObjectUnignored();
if (parent && parent->isList())
return ATK_ROLE_LIST_ITEM;
}
// WebCore does not know about paragraph role, label role, or section role
if (AXObject->isAccessibilityRenderObject()) {
Node* node = static_cast<AccessibilityRenderObject*>(AXObject)->renderer()->node();
if (node) {
if (node->hasTagName(HTMLNames::pTag))
return ATK_ROLE_PARAGRAPH;
if (node->hasTagName(HTMLNames::labelTag))
return ATK_ROLE_LABEL;
if (node->hasTagName(HTMLNames::divTag))
return ATK_ROLE_SECTION;
}
}
// Note: Why doesn't WebCore have a password field for this
if (AXObject->isPasswordField())
return ATK_ROLE_PASSWORD_TEXT;
return atkRole(AXObject->roleValue());
}
示例3: webkit_accessible_text_get_text
static gchar* webkit_accessible_text_get_text(AtkText* text, gint startOffset, gint endOffset)
{
AccessibilityObject* coreObject = core(text);
String ret;
unsigned start = startOffset;
int length = endOffset - startOffset;
if (coreObject->isTextControl())
ret = coreObject->doAXStringForRange(PlainTextRange(start, length));
else
ret = coreObject->textUnderElement().substring(start, length);
return g_strdup(ret.utf8().data());
}
示例4: parentObject
String AccessibilityObject::language() const
{
AccessibilityObject* parent = parentObject();
// as a last resort, fall back to the content language specified in the meta tag
if (!parent) {
Document* doc = document();
if (doc)
return doc->contentLanguage();
return String();
}
return parent->language();
}
示例5: children
void AccessibilityObject::ariaTreeItemContent(AccessibilityChildrenVector& result)
{
// The ARIA tree item content are the item that are not other tree items or their containing groups.
AccessibilityChildrenVector axChildren = children();
unsigned count = axChildren.size();
for (unsigned k = 0; k < count; ++k) {
AccessibilityObject* obj = axChildren[k].get();
AccessibilityRole role = obj->roleValue();
if (role == TreeItemRole || role == GroupRole)
continue;
result.append(obj);
}
}
示例6: webkitAccessibleGetNChildren
static gint webkitAccessibleGetNChildren(AtkObject* object)
{
g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE(object), 0);
returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(object), 0);
AccessibilityObject* coreObject = core(object);
// Tables should be treated in a different way because rows should
// be bypassed when exposing the accessible hierarchy.
if (coreObject->isAccessibilityTable())
return getNChildrenForTable(coreObject);
return coreObject->children().size();
}
示例7: modifyAccessibilityValue
static void modifyAccessibilityValue(AtkObject* axObject, bool increment)
{
if (!axObject || !WEBKIT_IS_ACCESSIBLE(axObject))
return;
AccessibilityObject* coreObject = webkit_accessible_get_accessibility_object(WEBKIT_ACCESSIBLE(axObject));
if (!coreObject)
return;
if (increment)
coreObject->increment();
else
coreObject->decrement();
}
示例8: nodeTextChangePlatformNotification
void AXObjectCache::nodeTextChangePlatformNotification(AccessibilityObject* object, AXTextChange textChange, unsigned offset, const String& text)
{
if (!object || text.isEmpty())
return;
AccessibilityObject* parentObject = object->parentObjectUnignored();
if (!parentObject)
return;
AtkObject* wrapper = parentObject->wrapper();
if (!wrapper || !ATK_IS_TEXT(wrapper))
return;
Node* node = object->node();
if (!node)
return;
// Ensure document's layout is up-to-date before using TextIterator.
Document& document = node->document();
document.updateLayout();
// Select the right signal to be emitted
CString detail;
switch (textChange) {
case AXObjectCache::AXTextInserted:
detail = "text-insert";
break;
case AXObjectCache::AXTextDeleted:
detail = "text-remove";
break;
}
String textToEmit = text;
unsigned offsetToEmit = offset;
// If the object we're emitting the signal from represents a
// password field, we will emit the masked text.
if (parentObject->isPasswordField()) {
String maskedText = parentObject->passwordFieldValue();
textToEmit = maskedText.substring(offset, text.length());
} else {
// Consider previous text objects that might be present for
// the current accessibility object to ensure we emit the
// right offset (e.g. multiline text areas).
RefPtr<Range> range = Range::create(document, node->parentNode(), 0, node, 0);
offsetToEmit = offset + TextIterator::rangeLength(range.get());
}
g_signal_emit_by_name(wrapper, detail.data(), offsetToEmit, textToEmit.length(), textToEmit.utf8().data());
}
示例9: ASSERT
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);
}
示例10: webkitAccessibleTableCellGetTable
AtkObject* webkitAccessibleTableCellGetTable(AtkTableCell* cell)
{
g_return_val_if_fail(ATK_TABLE_CELL(cell), nullptr);
returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(cell), nullptr);
AccessibilityObject* axObject = core(cell);
if (!axObject || !axObject->isTableCell())
return nullptr;
AtkObject* table = atk_object_get_parent(axObject->wrapper());
if (!table || !ATK_IS_TABLE(table))
return nullptr;
return ATK_OBJECT(g_object_ref(table));
}
示例11: axObjectCache
void AccessibilityMenuListPopup::childrenChanged()
{
AXObjectCache* cache = axObjectCache();
for (size_t i = m_children.size(); i > 0 ; --i) {
AccessibilityObject* child = m_children[i - 1].get();
if (child->actionElement() && !child->actionElement()->inRenderedDocument()) {
child->detachFromParent();
cache->remove(child->axObjectID());
}
}
m_children.clear();
m_haveChildren = false;
addChildren();
}
示例12: children
void AccessibilityObject::ariaTreeItemDisclosedRows(AccessibilityChildrenVector& result)
{
AccessibilityChildrenVector axChildren = children();
unsigned count = axChildren.size();
for (unsigned k = 0; k < count; ++k) {
AccessibilityObject* obj = axChildren[k].get();
// Add tree items as the rows.
if (obj->roleValue() == TreeItemRole)
result.append(obj);
// If it's not a tree item, then descend into the group to find more tree items.
else
obj->ariaTreeRows(result);
}
}
示例13: webkitAccessibleHyperlinkActionDoAction
static gboolean webkitAccessibleHyperlinkActionDoAction(AtkAction* action, gint index)
{
g_return_val_if_fail(WEBKIT_IS_ACCESSIBLE_HYPERLINK(action), FALSE);
g_return_val_if_fail(WEBKIT_ACCESSIBLE_HYPERLINK(action)->priv->hyperlinkImpl, FALSE);
g_return_val_if_fail(!index, FALSE);
if (!ATK_IS_ACTION(WEBKIT_ACCESSIBLE_HYPERLINK(action)->priv->hyperlinkImpl))
return FALSE;
AccessibilityObject* coreObject = core(action);
if (!coreObject)
return FALSE;
return coreObject->performDefaultAction();
}
示例14: parentTable
AccessibilityTable* AccessibilityARIAGridRow::parentTable() const
{
// The parent table might not be the direct ancestor of the row unfortunately. ARIA states that role="grid" should
// only have "row" elements, but if not, we still should handle it gracefully by finding the right table.
for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
// The parent table for an ARIA grid row should be an ARIA table.
if (is<AccessibilityTable>(*parent)) {
AccessibilityTable& tableParent = downcast<AccessibilityTable>(*parent);
if (tableParent.isExposableThroughAccessibility() && tableParent.isAriaTable())
return &tableParent;
}
}
return nullptr;
}
示例15: webkitAccessibleSelectionIsChildSelected
static gboolean webkitAccessibleSelectionIsChildSelected(AtkSelection* selection, gint index)
{
g_return_val_if_fail(ATK_SELECTION(selection), FALSE);
returnValIfWebKitAccessibleIsInvalid(WEBKIT_ACCESSIBLE(selection), FALSE);
AccessibilityObject* coreSelection = core(selection);
if (!coreSelection)
return FALSE;
AccessibilityObject* option = optionFromList(selection, index);
if (option && (coreSelection->isListBox() || coreSelection->isMenuList()))
return option->isSelected();
return FALSE;
}