NS_IMETHODIMP
xpcAccessibleHyperText::GetCharacterAtOffset(int32_t aOffset,
                                             char16_t* aCharacter)
{
  NS_ENSURE_ARG_POINTER(aCharacter);
  *aCharacter = L'\0';

  HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
  if (text->IsDefunct())
    return NS_ERROR_FAILURE;

  *aCharacter = text->CharAt(aOffset);
  return NS_OK;
}
예제 #2
0
static gunichar
getCharacterAtOffsetCB(AtkText* aText, gint aOffset)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
  if (accWrap) {
    HyperTextAccessible* text = accWrap->AsHyperText();
    if (!text || !text->IsTextRole()) {
      return 0;
    }

    // char16_t is unsigned short in Mozilla, gnuichar is guint32 in glib.
    return static_cast<gunichar>(text->CharAt(aOffset));
  }

  if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
    return static_cast<gunichar>(proxy->CharAt(aOffset));
  }

  return 0;
}