NS_IMETHODIMP
xpcAccessibleHyperText::GetDefaultTextAttributes(nsIPersistentProperties** aAttributes)
{
  NS_ENSURE_ARG_POINTER(aAttributes);
  *aAttributes = nullptr;

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

  nsCOMPtr<nsIPersistentProperties> attrs = text->DefaultTextAttributes();
  attrs.swap(*aAttributes);
  return NS_OK;
}
Ejemplo n.º 2
0
static AtkAttributeSet*
getDefaultAttributesCB(AtkText *aText)
{
  AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
  if (accWrap) {
    HyperTextAccessible* text = accWrap->AsHyperText();
    if (!text || !text->IsTextRole()) {
      return nullptr;
    }

    nsCOMPtr<nsIPersistentProperties> attributes = text->DefaultTextAttributes();
    return ConvertToAtkTextAttributeSet(attributes);
  }

  ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText));
  if (!proxy) {
    return nullptr;
  }

  nsAutoTArray<Attribute, 10> attrs;
  proxy->DefaultTextAttributes(&attrs);
  return ConvertToAtkTextAttributeSet(attrs);
}