AtkStateSet *
refStateSetCB(AtkObject *aAtkObj)
{
  AtkStateSet *state_set = nullptr;
  state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj);

  AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
  if (accWrap)
    TranslateStates(accWrap->State(), state_set);
  else if (ProxyAccessible* proxy = GetProxy(aAtkObj))
    TranslateStates(proxy->State(), state_set);
  else
    TranslateStates(states::DEFUNCT, state_set);

  return state_set;
}
AtkStateSet *
refStateSetCB(AtkObject *aAtkObj)
{
    AtkStateSet *state_set = nsnull;
    state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj);

    AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
    if (!accWrap) {
        TranslateStates(states::DEFUNCT, state_set);
        return state_set;
    }

    // Map states
    TranslateStates(accWrap->State(), state_set);

    return state_set;
}
STDMETHODIMP
ia2AccessibleComponent::get_locationInParent(long* aX, long* aY)
{
  A11Y_TRYBLOCK_BEGIN

  *aX = 0;
  *aY = 0;

  AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
  if (acc->IsDefunct())
    return CO_E_OBJNOTCONNECTED;

  // If the object is not on any screen the returned position is (0,0).
  uint64_t state = acc->State();
  if (state & states::INVISIBLE)
    return S_OK;

  int32_t x = 0, y = 0, width = 0, height = 0;
  nsresult rv = acc->GetBounds(&x, &y, &width, &height);
  if (NS_FAILED(rv))
    return GetHRESULT(rv);

  Accessible* parentAcc = acc->Parent();

  // The coordinates of the returned position are relative to this object's
  // parent or relative to the screen on which this object is rendered if it
  // has no parent.
  if (!parentAcc) {
    *aX = x;
    *aY = y;
    return S_OK;
  }

  // The coordinates of the bounding box are given relative to the parent's
  // coordinate system.
  int32_t parentx = 0, parenty = 0;
  rv = acc->GetBounds(&parentx, &parenty, &width, &height);
  if (NS_FAILED(rv))
    return GetHRESULT(rv);

  *aX = x - parentx;
  *aY = y - parenty;
  return S_OK;

  A11Y_TRYBLOCK_END
}
Exemple #4
0
STDMETHODIMP
ia2Accessible::get_states(AccessibleStates* aStates) {
  if (!aStates) return E_INVALIDARG;
  *aStates = 0;

  // XXX: bug 344674 should come with better approach that we have here.

  AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
  if (acc->IsDefunct()) {
    *aStates = IA2_STATE_DEFUNCT;
    return S_OK;
  }

  uint64_t state;
  MOZ_ASSERT(!acc->IsProxy());
  state = acc->State();

  if (state & states::INVALID) *aStates |= IA2_STATE_INVALID_ENTRY;
  if (state & states::REQUIRED) *aStates |= IA2_STATE_REQUIRED;

  // The following IA2 states are not supported by Gecko
  // IA2_STATE_ARMED
  // IA2_STATE_MANAGES_DESCENDANTS
  // IA2_STATE_ICONIFIED
  // IA2_STATE_INVALID // This is not a state, it is the absence of a state

  if (state & states::ACTIVE) *aStates |= IA2_STATE_ACTIVE;
  if (state & states::DEFUNCT) *aStates |= IA2_STATE_DEFUNCT;
  if (state & states::EDITABLE) *aStates |= IA2_STATE_EDITABLE;
  if (state & states::HORIZONTAL) *aStates |= IA2_STATE_HORIZONTAL;
  if (state & states::MODAL) *aStates |= IA2_STATE_MODAL;
  if (state & states::MULTI_LINE) *aStates |= IA2_STATE_MULTI_LINE;
  if (state & states::OPAQUE1) *aStates |= IA2_STATE_OPAQUE;
  if (state & states::SELECTABLE_TEXT) *aStates |= IA2_STATE_SELECTABLE_TEXT;
  if (state & states::SINGLE_LINE) *aStates |= IA2_STATE_SINGLE_LINE;
  if (state & states::STALE) *aStates |= IA2_STATE_STALE;
  if (state & states::SUPPORTS_AUTOCOMPLETION)
    *aStates |= IA2_STATE_SUPPORTS_AUTOCOMPLETION;
  if (state & states::TRANSIENT) *aStates |= IA2_STATE_TRANSIENT;
  if (state & states::VERTICAL) *aStates |= IA2_STATE_VERTICAL;
  if (state & states::CHECKED) *aStates |= IA2_STATE_CHECKABLE;
  if (state & states::PINNED) *aStates |= IA2_STATE_PINNED;

  return S_OK;
}
Exemple #5
0
void DocAccessibleWrap::CacheFocusPath(AccessibleWrap* aAccessible) {
  mFocusPath.Clear();
  if (IPCAccessibilityActive()) {
    DocAccessibleChild* ipcDoc = IPCDoc();
    nsTArray<BatchData> cacheData;
    for (AccessibleWrap* acc = aAccessible; acc && acc != this->Parent();
         acc = static_cast<AccessibleWrap*>(acc->Parent())) {
      auto uid = acc->IsDoc() && acc->AsDoc()->IPCDoc()
                     ? 0
                     : reinterpret_cast<uint64_t>(acc->UniqueID());
      nsAutoString name;
      acc->Name(name);
      nsAutoString textValue;
      acc->Value(textValue);
      nsAutoString nodeID;
      acc->WrapperDOMNodeID(nodeID);
      nsCOMPtr<nsIPersistentProperties> props = acc->Attributes();
      nsTArray<Attribute> attributes;
      nsAccUtils::PersistentPropertiesToArray(props, &attributes);
      cacheData.AppendElement(BatchData(
          acc->Document()->IPCDoc(), uid, acc->State(), acc->Bounds(),
          acc->ActionCount(), name, textValue, nodeID, acc->CurValue(),
          acc->MinValue(), acc->MaxValue(), acc->Step(), attributes));
      mFocusPath.Put(acc->UniqueID(), acc);
    }

    ipcDoc->SendBatch(eBatch_FocusPath, cacheData);
  } else if (SessionAccessibility* sessionAcc =
                 SessionAccessibility::GetInstanceFor(this)) {
    nsTArray<AccessibleWrap*> accessibles;
    for (AccessibleWrap* acc = aAccessible; acc && acc != this->Parent();
         acc = static_cast<AccessibleWrap*>(acc->Parent())) {
      accessibles.AppendElement(acc);
    }

    sessionAcc->ReplaceFocusPathCache(accessibles);
  }
}