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


C++ ProxyAccessible类代码示例

本文整理汇总了C++中ProxyAccessible的典型用法代码示例。如果您正苦于以下问题:C++ ProxyAccessible类的具体用法?C++ ProxyAccessible怎么用?C++ ProxyAccessible使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: NS_ENSURE_ARG_POINTER

NS_IMETHODIMP
xpcAccessible::GetRelationByType(uint32_t aType,
                                 nsIAccessibleRelation** aRelation)
{
  NS_ENSURE_ARG_POINTER(aRelation);
  *aRelation = nullptr;

  NS_ENSURE_ARG(aType <= static_cast<uint32_t>(RelationType::LAST));

  if (IntlGeneric().IsNull())
    return NS_ERROR_FAILURE;

  if (IntlGeneric().IsAccessible()) {
    Relation rel = Intl()->RelationByType(static_cast<RelationType>(aType));
    NS_ADDREF(*aRelation = new nsAccessibleRelation(aType, &rel));
    return NS_OK;
  }

  ProxyAccessible* proxy = IntlGeneric().AsProxy();
  nsTArray<ProxyAccessible*> targets =
    proxy->RelationByType(static_cast<RelationType>(aType));
  NS_ADDREF(*aRelation = new nsAccessibleRelation(aType, &targets));

  return NS_OK;
}
开发者ID:heiher,项目名称:gecko-dev,代码行数:25,代码来源:xpcAccessible.cpp

示例2: NS_ENSURE_ARG_POINTER

NS_IMETHODIMP
xpcAccessible::GetAttributes(nsIPersistentProperties** aAttributes)
{
  NS_ENSURE_ARG_POINTER(aAttributes);
  *aAttributes = nullptr;

  if (IntlGeneric().IsNull()) {
    return NS_ERROR_FAILURE;
  }

  if (Accessible* acc = Intl()) {
    nsCOMPtr<nsIPersistentProperties> attributes = acc->Attributes();
    attributes.swap(*aAttributes);
    return NS_OK;
  }

  ProxyAccessible* proxy = IntlGeneric().AsProxy();
  AutoTArray<Attribute, 10> attrs;
  proxy->Attributes(&attrs);

  nsCOMPtr<nsIPersistentProperties> props =
    do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
  uint32_t attrCount = attrs.Length();
  nsAutoString unused;
  for (uint32_t i = 0; i < attrCount; i++) {
    props->SetStringProperty(attrs[i].Name(), attrs[i].Value(), unused);
  }

  props.forget(aAttributes);
  return NS_OK;
}
开发者ID:SergiosLen,项目名称:browser-f,代码行数:31,代码来源:xpcAccessible.cpp

示例3: getAttributesCB

AtkAttributeSet *
getAttributesCB(AtkObject *aAtkObj)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
  if (accWrap)
    return GetAttributeSet(accWrap);

  ProxyAccessible* proxy = GetProxy(aAtkObj);
  if (!proxy)
    return nullptr;

  nsAutoTArray<Attribute, 10> attrs;
  proxy->Attributes(&attrs);
  if (attrs.IsEmpty())
    return nullptr;

  AtkAttributeSet* objAttributeSet = nullptr;
  for (uint32_t i = 0; i < attrs.Length(); i++) {
    AtkAttribute *objAttr = (AtkAttribute *)g_malloc(sizeof(AtkAttribute));
    objAttr->name = g_strdup(attrs[i].Name().get());
    objAttr->value = g_strdup(NS_ConvertUTF16toUTF8(attrs[i].Value()).get());
    objAttributeSet = g_slist_prepend(objAttributeSet, objAttr);
  }

  return objAttributeSet;
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:26,代码来源:AccessibleWrap.cpp

示例4: IPC_FAIL

ipc::IPCResult
DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
                                 uint64_t aParentID, bool aCreating)
{
  // We do not use GetAccessible here because we want to be sure to not get the
  // document it self.
  ProxyEntry* e = mAccessibles.GetEntry(aParentID);
  if (!e) {
    return IPC_FAIL(this, "binding to nonexistant proxy!");
  }

  ProxyAccessible* outerDoc = e->mProxy;
  MOZ_ASSERT(outerDoc);

  // OuterDocAccessibles are expected to only have a document as a child.
  // However for compatibility we tolerate replacing one document with another
  // here.
  if (outerDoc->ChildrenCount() > 1 ||
      (outerDoc->ChildrenCount() == 1 && !outerDoc->ChildAt(0)->IsDoc())) {
    return IPC_FAIL(this, "binding to proxy that can't be a outerDoc!");
  }

  aChildDoc->SetParent(outerDoc);
  outerDoc->SetChildDoc(aChildDoc);
  mChildDocs.AppendElement(aChildDoc->mActorID);
  aChildDoc->mParentDoc = mActorID;

  if (aCreating) {
    ProxyCreated(aChildDoc, Interfaces::DOCUMENT | Interfaces::HYPERTEXT);
  }

  return IPC_OK();
}
开发者ID:jorendorff,项目名称:gecko-dev,代码行数:33,代码来源:DocAccessibleParent.cpp

示例5: MOZ_DIAGNOSTIC_ASSERT

bool
DocAccessibleParent::RecvHideEvent(const uint64_t& aRootID)
{
  if (mShutdown)
    return true;

  MOZ_DIAGNOSTIC_ASSERT(CheckDocTree());

  // We shouldn't actually need this because mAccessibles shouldn't have an
  // entry for the document itself, but it doesn't hurt to be explicit.
  if (!aRootID) {
    NS_ERROR("trying to hide entire document?");
    return false;
  }

  ProxyEntry* rootEntry = mAccessibles.GetEntry(aRootID);
  if (!rootEntry) {
    NS_ERROR("invalid root being removed!");
    return true;
  }

  ProxyAccessible* root = rootEntry->mProxy;
  if (!root) {
    NS_ERROR("invalid root being removed!");
    return true;
  }

  ProxyAccessible* parent = root->Parent();
  parent->RemoveChild(root);
  root->Shutdown();

  MOZ_DIAGNOSTIC_ASSERT(CheckDocTree());

  return true;
}
开发者ID:Chabma,项目名称:gecko-dev,代码行数:35,代码来源:DocAccessibleParent.cpp

示例6: ProxyCreated

bool
DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
                                 uint64_t aParentID, bool aCreating)
{
  // We do not use GetAccessible here because we want to be sure to not get the
  // document it self.
  ProxyEntry* e = mAccessibles.GetEntry(aParentID);
  if (!e)
    return false;

  ProxyAccessible* outerDoc = e->mProxy;
  MOZ_ASSERT(outerDoc);

  // OuterDocAccessibles are expected to only have a document as a child.
  // However for compatibility we tolerate replacing one document with another
  // here.
  if (outerDoc->ChildrenCount() > 1 ||
      (outerDoc->ChildrenCount() == 1 && !outerDoc->ChildAt(0)->IsDoc())) {
    return false;
  }

  aChildDoc->mParent = outerDoc;
  outerDoc->SetChildDoc(aChildDoc);
  mChildDocs.AppendElement(aChildDoc);
  aChildDoc->mParentDoc = this;

  if (aCreating) {
    ProxyCreated(aChildDoc, Interfaces::DOCUMENT | Interfaces::HYPERTEXT);
  }

  return true;
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:32,代码来源:DocAccessibleParent.cpp

示例7: getRoleCB

AtkRole
getRoleCB(AtkObject *aAtkObj)
{
  if (aAtkObj->role != ATK_ROLE_INVALID)
    return aAtkObj->role;

  AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
  a11y::role role;
  if (!accWrap) {
    ProxyAccessible* proxy = GetProxy(aAtkObj);
    if (!proxy)
      return ATK_ROLE_INVALID;

    role = proxy->Role();
  } else {
#ifdef DEBUG
    NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
                 "Does not support Text interface when it should");
#endif

    role = accWrap->Role();
  }

#define ROLE(geckoRole, stringRole, atkRole, macRole, \
             msaaRole, ia2Role, nameRule) \
  case roles::geckoRole: \
    aAtkObj->role = atkRole; \
    break;

  switch (role) {
#include "RoleMap.h"
    default:
      MOZ_CRASH("Unknown role.");
  };

#undef ROLE

  if (aAtkObj->role == ATK_ROLE_LIST_BOX && !IsAtkVersionAtLeast(2, 1))
    aAtkObj->role = ATK_ROLE_LIST;
  else if (aAtkObj->role == ATK_ROLE_TABLE_ROW && !IsAtkVersionAtLeast(2, 1))
    aAtkObj->role = ATK_ROLE_LIST_ITEM;
  else if (aAtkObj->role == ATK_ROLE_MATH && !IsAtkVersionAtLeast(2, 12))
    aAtkObj->role = ATK_ROLE_PANEL;
  else if (aAtkObj->role == ATK_ROLE_STATIC && !IsAtkVersionAtLeast(2, 16))
    aAtkObj->role = ATK_ROLE_TEXT;
  else if ((aAtkObj->role == ATK_ROLE_MATH_FRACTION ||
            aAtkObj->role == ATK_ROLE_MATH_ROOT) && !IsAtkVersionAtLeast(2, 16))
    aAtkObj->role = ATK_ROLE_UNKNOWN;

  return aAtkObj->role;
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:51,代码来源:AccessibleWrap.cpp

示例8: IntlGeneric

NS_IMETHODIMP
xpcAccessible::GetId(nsAString& aID)
{
  ProxyAccessible* proxy = IntlGeneric().AsProxy();
  if (!proxy) {
    return NS_ERROR_FAILURE;
  }

  nsString id;
  proxy->DOMNodeID(id);
  aID.Assign(id);

  return NS_OK;
}
开发者ID:heiher,项目名称:gecko-dev,代码行数:14,代码来源:xpcAccessible.cpp

示例9: NS_ERROR

uint32_t
DocAccessibleParent::AddSubtree(ProxyAccessible* aParent,
                                const nsTArray<a11y::AccessibleData>& aNewTree,
                                uint32_t aIdx, uint32_t aIdxInParent)
{
  if (aNewTree.Length() <= aIdx) {
    NS_ERROR("bad index in serialized tree!");
    return 0;
  }

  const AccessibleData& newChild = aNewTree[aIdx];
  if (newChild.Role() > roles::LAST_ROLE) {
    NS_ERROR("invalid role");
    return 0;
  }

  if (mAccessibles.Contains(newChild.ID())) {
    NS_ERROR("ID already in use");
    return 0;
  }

  auto role = static_cast<a11y::role>(newChild.Role());

  ProxyAccessible* newProxy =
    new ProxyAccessible(newChild.ID(), aParent, this, role,
                        newChild.Interfaces());

  aParent->AddChildAt(aIdxInParent, newProxy);
  mAccessibles.PutEntry(newChild.ID())->mProxy = newProxy;
  ProxyCreated(newProxy, newChild.Interfaces());

#if defined(XP_WIN)
  WrapperFor(newProxy)->SetID(newChild.MsaaID());
#endif

  uint32_t accessibles = 1;
  uint32_t kids = newChild.ChildrenCount();
  for (uint32_t i = 0; i < kids; i++) {
    uint32_t consumed = AddSubtree(newProxy, aNewTree, aIdx + accessibles, i);
    if (!consumed)
      return 0;

    accessibles += consumed;
  }

  MOZ_ASSERT(newProxy->ChildrenCount() == kids);

  return accessibles;
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:49,代码来源:DocAccessibleParent.cpp

示例10: ProxyCreated

bool
DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
                                 uint64_t aParentID)
{
  ProxyAccessible* outerDoc = mAccessibles.GetEntry(aParentID)->mProxy;
  if (!outerDoc)
    return false;

  aChildDoc->mParent = outerDoc;
  outerDoc->SetChildDoc(aChildDoc);
  mChildDocs.AppendElement(aChildDoc);
  aChildDoc->mParentDoc = this;
  ProxyCreated(aChildDoc, 0);
  return true;
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:15,代码来源:DocAccessibleParent.cpp

示例11: setCurrentValueCB

static gboolean
setCurrentValueCB(AtkValue *obj, const GValue *value)
{
  ProxyAccessible* proxy = nullptr;
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(obj));
  if (!accWrap) {
    proxy = GetProxy(ATK_OBJECT(obj));
    if (!proxy) {
      return FALSE;
    }
  }

  double accValue =g_value_get_double(value);
  return accWrap ? accWrap->SetCurValue(accValue) : proxy->SetCurValue(accValue);
}
开发者ID:70599,项目名称:Waterfox,代码行数:15,代码来源:nsMaiInterfaceValue.cpp

示例12: Proxy

bool
ProxyAccessibleWrap::WrapperRangeInfo(double* aCurVal,
                                      double* aMinVal,
                                      double* aMaxVal,
                                      double* aStep)
{
  if (HasNumericValue()) {
    ProxyAccessible* proxy = Proxy();
    *aCurVal = proxy->CurValue();
    *aMinVal = proxy->MinValue();
    *aMaxVal = proxy->MaxValue();
    *aStep = proxy->Step();
    return true;
  }

  return false;
}
开发者ID:nils-ohlmeier,项目名称:gecko-dev,代码行数:17,代码来源:ProxyAccessibleWrap.cpp

示例13: getDocumentAttributeValueCB

const gchar *
getDocumentAttributeValueCB(AtkDocument *aDocument,
                            const gchar *aAttrName)
{
  ProxyAccessible* proxy = nullptr;
  DocAccessible* document = nullptr;
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
  if (accWrap) {
    if (!accWrap->IsDoc()) {
      return nullptr;
    }

    document = accWrap->AsDoc();
  } else {
    proxy = GetProxy(ATK_OBJECT(aDocument));
    if (!proxy) {
      return nullptr;
    }
  }

  nsAutoString attrValue;
  if (!strcasecmp(aAttrName, kDocTypeName)) {
    if (document) {
      document->DocType(attrValue);
    } else {
      proxy->DocType(attrValue);
    }
  } else if (!strcasecmp(aAttrName, kDocUrlName)) {
    if (document) {
      document->URL(attrValue);
    } else {
      proxy->URL(attrValue);
    }
  } else if (!strcasecmp(aAttrName, kMimeTypeName)) {
    if (document) {
      document->MimeType(attrValue);
    } else {
      proxy->MimeType(attrValue);
    }
  } else {
    return nullptr;
  }

  return attrValue.IsEmpty() ? nullptr : AccessibleWrap::ReturnString(attrValue);
}
开发者ID:70599,项目名称:Waterfox,代码行数:45,代码来源:nsMaiInterfaceDocument.cpp

示例14: NS_ERROR

bool
DocAccessibleParent::RecvShowEvent(const ShowEventData& aData)
{
  if (mShutdown)
    return true;

  if (aData.NewTree().IsEmpty()) {
    NS_ERROR("no children being added");
    return false;
  }

  ProxyAccessible* parent = nullptr;
  if (aData.ID()) {
    ProxyEntry* e = mAccessibles.GetEntry(aData.ID());
    if (e)
      parent = e->mProxy;
  } else {
    parent = this;
  }

  // XXX This should really never happen, but sometimes we fail to fire the
  // required show events.
  if (!parent) {
    NS_ERROR("adding child to unknown accessible");
    return false;
  }

  uint32_t newChildIdx = aData.Idx();
  if (newChildIdx > parent->ChildrenCount()) {
    NS_ERROR("invalid index to add child at");
    return false;
  }

  uint32_t consumed = AddSubtree(parent, aData.NewTree(), 0, newChildIdx);
  MOZ_ASSERT(consumed == aData.NewTree().Length());
#ifdef DEBUG
  for (uint32_t i = 0; i < consumed; i++) {
    uint64_t id = aData.NewTree()[i].ID();
    MOZ_ASSERT(mAccessibles.GetEntry(id));
  }
#endif

  return consumed != 0;
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:44,代码来源:DocAccessibleParent.cpp

示例15: MOZ_DIAGNOSTIC_ASSERT

bool
DocAccessibleParent::RecvHideEvent(const uint64_t& aRootID,
                                   const bool& aFromUser)
{
  if (mShutdown)
    return true;

  MOZ_DIAGNOSTIC_ASSERT(CheckDocTree());

  // We shouldn't actually need this because mAccessibles shouldn't have an
  // entry for the document itself, but it doesn't hurt to be explicit.
  if (!aRootID) {
    NS_ERROR("trying to hide entire document?");
    return false;
  }

  ProxyEntry* rootEntry = mAccessibles.GetEntry(aRootID);
  if (!rootEntry) {
    NS_ERROR("invalid root being removed!");
    return true;
  }

  ProxyAccessible* root = rootEntry->mProxy;
  if (!root) {
    NS_ERROR("invalid root being removed!");
    return true;
  }

  ProxyAccessible* parent = root->Parent();
  ProxyShowHideEvent(root, parent, false, aFromUser);

  RefPtr<xpcAccHideEvent> event = nullptr;
  if (nsCoreUtils::AccEventObserversExist()) {
    uint32_t type = nsIAccessibleEvent::EVENT_HIDE;
    xpcAccessibleGeneric* xpcAcc = GetXPCAccessible(root);
    xpcAccessibleGeneric* xpcParent = GetXPCAccessible(parent);
    ProxyAccessible* next = root->NextSibling();
    xpcAccessibleGeneric* xpcNext = next ? GetXPCAccessible(next) : nullptr;
    ProxyAccessible* prev = root->PrevSibling();
    xpcAccessibleGeneric* xpcPrev = prev ? GetXPCAccessible(prev) : nullptr;
    xpcAccessibleDocument* doc = GetAccService()->GetXPCDocument(this);
    nsIDOMNode* node = nullptr;
    event = new xpcAccHideEvent(type, xpcAcc, doc, node, aFromUser, xpcParent,
                                xpcNext, xpcPrev);
  }

  parent->RemoveChild(root);
  root->Shutdown();

  MOZ_DIAGNOSTIC_ASSERT(CheckDocTree());

  if (event) {
    nsCoreUtils::DispatchAccEvent(Move(event));
  }

  return true;
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:57,代码来源:DocAccessibleParent.cpp


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