HyperTextAccessible*
DocAccessibleChild::IdToHyperTextAccessible(const uint64_t& aID)
{
  Accessible* acc = IdToAccessible(aID);
  MOZ_ASSERT(!acc || acc->IsHyperText());
  return acc ? acc->AsHyperText() : nullptr;
}
Exemplo n.º 2
0
HyperTextAccessible*
nsAccessiblePivot::SearchForText(Accessible* aAccessible, bool aBackward)
{
  Accessible* root = GetActiveRoot();
  Accessible* accessible = aAccessible;
  while (true) {
    Accessible* child = nullptr;

    while ((child = (aBackward ? accessible->LastChild() :
                                 accessible->FirstChild()))) {
      accessible = child;
      if (child->IsHyperText())
        return child->AsHyperText();
    }

    Accessible* sibling = nullptr;
    Accessible* temp = accessible;
    do {
      if (temp == root)
        break;

      if (temp != aAccessible && temp->IsHyperText())
        return temp->AsHyperText();

      sibling = aBackward ? temp->PrevSibling() : temp->NextSibling();

      if (sibling)
        break;
    } while ((temp = temp->Parent()));

    if (!sibling)
      break;

    accessible = sibling;
    if (accessible->IsHyperText())
      return accessible->AsHyperText();
  }

  return nullptr;
}
Exemplo n.º 3
0
nsresult
HyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
{
  uint32_t eventType = aEvent->GetEventType();

  if (eventType == nsIAccessibleEvent::EVENT_TEXT_REMOVED ||
      eventType == nsIAccessibleEvent::EVENT_TEXT_INSERTED) {
    Accessible* accessible = aEvent->GetAccessible();
    if (accessible && accessible->IsHyperText()) {
      AccTextChangeEvent* event = downcast_accEvent(aEvent);
        HyperTextAccessibleWrap* text =
          static_cast<HyperTextAccessibleWrap*>(accessible->AsHyperText());
      ia2AccessibleText::UpdateTextChangeData(text, event->IsTextInserted(),
                                              event->ModifiedText(),
                                              event->GetStartOffset(),
                                              event->GetLength());
    }
  }

  return HyperTextAccessible::HandleAccEvent(aEvent);
}
Exemplo n.º 4
0
nsresult
HyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
{
    uint32_t eventType = aEvent->GetEventType();

    if (eventType == nsIAccessibleEvent::EVENT_TEXT_REMOVED ||
            eventType == nsIAccessibleEvent::EVENT_TEXT_INSERTED) {
        Accessible* accessible = aEvent->GetAccessible();
        if (accessible && accessible->IsHyperText()) {
            sLastTextChangeAcc = accessible;
            if (!sLastTextChangeString)
                sLastTextChangeString = new nsString();

            AccTextChangeEvent* event = downcast_accEvent(aEvent);
            event->GetModifiedText(*sLastTextChangeString);
            sLastTextChangeStart = event->GetStartOffset();
            sLastTextChangeEnd = sLastTextChangeStart + event->GetLength();
            sLastTextChangeWasInsert = event->IsTextInserted();
        }
    }

    return HyperTextAccessible::HandleAccEvent(aEvent);
}