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


C++ Accessible::Parent方法代码示例

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


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

示例1: FocusedAccessible

FocusManager::FocusDisposition
FocusManager::IsInOrContainsFocus(const Accessible* aAccessible) const
{
    Accessible* focus = FocusedAccessible();
    if (!focus)
        return eNone;

    // If focused.
    if (focus == aAccessible)
        return eFocused;

    // If contains the focus.
    Accessible* child = focus->Parent();
    while (child) {
        if (child == aAccessible)
            return eContainsFocus;

        child = child->Parent();
    }

    // If contained by focus.
    child = aAccessible->Parent();
    while (child) {
        if (child == focus)
            return eContainedByFocus;

        child = child->Parent();
    }

    return eNone;
}
开发者ID:Ajunboys,项目名称:mozilla-os2,代码行数:31,代码来源:FocusManager.cpp

示例2: AccEvent

bool
EventQueue::PushEvent(AccEvent* aEvent)
{
  NS_ASSERTION((aEvent->mAccessible && aEvent->mAccessible->IsApplication()) ||
               aEvent->GetDocAccessible() == mDocument,
               "Queued event belongs to another document!");

  if (!mEvents.AppendElement(aEvent))
    return false;

  // Filter events.
  CoalesceEvents();

  // Fire name change event on parent given that this event hasn't been
  // coalesced, the parent's name was calculated from its subtree, and the
  // subtree was changed.
  Accessible* target = aEvent->mAccessible;
  if (aEvent->mEventRule != AccEvent::eDoNotEmit &&
      target->HasNameDependentParent() &&
      (aEvent->mEventType == nsIAccessibleEvent::EVENT_NAME_CHANGE ||
       aEvent->mEventType == nsIAccessibleEvent::EVENT_TEXT_REMOVED ||
       aEvent->mEventType == nsIAccessibleEvent::EVENT_TEXT_INSERTED ||
       aEvent->mEventType == nsIAccessibleEvent::EVENT_SHOW ||
       aEvent->mEventType == nsIAccessibleEvent::EVENT_HIDE)) {
    // Only continue traversing up the tree if it's possible that the parent
    // accessible's name can depend on this accessible's name.
    Accessible* parent = target->Parent();
    while (parent &&
           nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeIfReqRule)) {
      // Test possible name dependent parent.
      if (nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeRule)) {
        nsAutoString name;
        ENameValueFlag nameFlag = parent->Name(name);
        // If name is obtained from subtree, fire name change event.
        if (nameFlag == eNameFromSubtree) {
          RefPtr<AccEvent> nameChangeEvent =
            new AccEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, parent);
          PushEvent(nameChangeEvent);
        }
        break;
      }
      parent = parent->Parent();
    }
  }

  // Associate text change with hide event if it wasn't stolen from hiding
  // siblings during coalescence.
  AccMutationEvent* showOrHideEvent = downcast_accEvent(aEvent);
  if (showOrHideEvent && !showOrHideEvent->mTextChangeEvent)
    CreateTextChangeEventFor(showOrHideEvent);

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

示例3: Document

Accessible*
XULMenupopupAccessible::ContainerWidget() const
{
  DocAccessible* document = Document();

  nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame());
  while (menuPopupFrame) {
    Accessible* menuPopup =
      document->GetAccessible(menuPopupFrame->GetContent());
    if (!menuPopup) // shouldn't be a real case
      return nullptr;

    nsMenuFrame* menuFrame = do_QueryFrame(menuPopupFrame->GetParent());
    if (!menuFrame) // context menu or popups
      return nullptr;

    nsMenuParent* menuParent = menuFrame->GetMenuParent();
    if (!menuParent) // menulist or menubutton
      return menuPopup->Parent();

    if (menuParent->IsMenuBar()) { // menubar menu
      nsMenuBarFrame* menuBarFrame = static_cast<nsMenuBarFrame*>(menuParent);
      return document->GetAccessible(menuBarFrame->GetContent());
    }

    // different kind of popups like panel or tooltip
    if (!menuParent->IsMenu())
      return nullptr;

    menuPopupFrame = static_cast<nsMenuPopupFrame*>(menuParent);
  }

  MOZ_ASSERT_UNREACHABLE("Shouldn't be a real case.");
  return nullptr;
}
开发者ID:escapewindow,项目名称:gecko-dev,代码行数:35,代码来源:XULMenuAccessible.cpp

示例4:

Accessible*
nsAccessiblePivot::AdjustStartPosition(Accessible* aAccessible,
                                       RuleCache& aCache,
                                       uint16_t* aFilterResult,
                                       nsresult* aResult)
{
  Accessible* matched = aAccessible;
  *aResult = aCache.ApplyFilter(aAccessible, aFilterResult);

  if (aAccessible != mRoot && aAccessible != mModalRoot) {
    for (Accessible* temp = aAccessible->Parent();
         temp && temp != mRoot && temp != mModalRoot; temp = temp->Parent()) {
      uint16_t filtered = nsIAccessibleTraversalRule::FILTER_IGNORE;
      *aResult = aCache.ApplyFilter(temp, &filtered);
      NS_ENSURE_SUCCESS(*aResult, nullptr);
      if (filtered & nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE) {
        *aFilterResult = filtered;
        matched = temp;
      }
    }
  }

  if (aAccessible == mPosition && mStartOffset != -1 && mEndOffset != -1) {
    HyperTextAccessible* text = aAccessible->AsHyperText();
    if (text) {
      matched = text->GetChildAtOffset(mStartOffset);
    }
  }

  return matched;
}
开发者ID:JerryShih,项目名称:gecko-dev,代码行数:31,代码来源:nsAccessiblePivot.cpp

示例5: Next

Accessible* HTMLLabelIterator::Next() {
  // Get either <label for="[id]"> element which explicitly points to given
  // element, or <label> ancestor which implicitly point to it.
  Accessible* label = nullptr;
  while ((label = mRelIter.Next())) {
    if (IsLabel(label)) {
      return label;
    }
  }

  // Ignore ancestor label on not widget accessible.
  if (mLabelFilter == eSkipAncestorLabel || !mAcc->IsWidget()) return nullptr;

  // Go up tree to get a name of ancestor label if there is one (an ancestor
  // <label> implicitly points to us). Don't go up farther than form or
  // document.
  Accessible* walkUp = mAcc->Parent();
  while (walkUp && !walkUp->IsDoc()) {
    nsIContent* walkUpEl = walkUp->GetContent();
    if (IsLabel(walkUp) &&
        !walkUpEl->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::_for)) {
      mLabelFilter = eSkipAncestorLabel;  // prevent infinite loop
      return walkUp;
    }

    if (walkUpEl->IsHTMLElement(nsGkAtoms::form)) break;

    walkUp = walkUp->Parent();
  }

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

示例6: AccEvent

bool
EventQueue::PushNameChange(Accessible* aTarget)
{
  // Fire name change event on parent given that this event hasn't been
  // coalesced, the parent's name was calculated from its subtree, and the
  // subtree was changed.
  if (aTarget->HasNameDependentParent()) {
    // Only continue traversing up the tree if it's possible that the parent
    // accessible's name can depend on this accessible's name.
    Accessible* parent = aTarget->Parent();
    while (parent &&
           nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeIfReqRule)) {
      // Test possible name dependent parent.
      if (nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeRule)) {
        nsAutoString name;
        ENameValueFlag nameFlag = parent->Name(name);
        // If name is obtained from subtree, fire name change event.
        if (nameFlag == eNameFromSubtree) {
          RefPtr<AccEvent> nameChangeEvent =
            new AccEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, parent);
          return PushEvent(nameChangeEvent);
        }
        break;
      }
      parent = parent->Parent();
    }
  }
  return false;
}
开发者ID:Fischer-L,项目名称:gecko-b2g,代码行数:29,代码来源:EventQueue.cpp

示例7: SelectionMgr

STDMETHODIMP
ia2Accessible::get_accessibleWithCaret(IUnknown** aAccessible,
                                       long* aCaretOffset)
{
  if (!aAccessible || !aCaretOffset)
    return E_INVALIDARG;

  *aAccessible = nullptr;
  *aCaretOffset = -1;

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

  int32_t caretOffset = -1;
  Accessible* accWithCaret = SelectionMgr()->AccessibleWithCaret(&caretOffset);
  if (!accWithCaret || acc->Document() != accWithCaret->Document())
    return S_FALSE;

  Accessible* child = accWithCaret;
  while (!child->IsDoc() && child != acc)
    child = child->Parent();

  if (child != acc)
    return S_FALSE;

  *aAccessible =  static_cast<IAccessible2*>(
    static_cast<AccessibleWrap*>(accWithCaret));
  (*aAccessible)->AddRef();
  *aCaretOffset = caretOffset;
  return S_OK;
}
开发者ID:escapewindow,项目名称:gecko-dev,代码行数:32,代码来源:ia2Accessible.cpp

示例8: while

void
LinkableAccessible::BindToParent(Accessible* aParent,
                                 uint32_t aIndexInParent)
{
    AccessibleWrap::BindToParent(aParent, aIndexInParent);

    // Cache action content.
    mActionAcc = nullptr;
    mIsLink = false;
    mIsOnclick = false;

    if (nsCoreUtils::HasClickListener(mContent)) {
        mIsOnclick = true;
        return;
    }

    // XXX: The logic looks broken since the click listener may be registered
    // on non accessible node in parent chain but this node is skipped when tree
    // is traversed.
    Accessible* walkUpAcc = this;
    while ((walkUpAcc = walkUpAcc->Parent()) && !walkUpAcc->IsDoc()) {
        if (walkUpAcc->LinkState() & states::LINKED) {
            mIsLink = true;
            mActionAcc = walkUpAcc;
            return;
        }

        if (nsCoreUtils::HasClickListener(walkUpAcc->GetContent())) {
            mActionAcc = walkUpAcc;
            mIsOnclick = true;
            return;
        }
    }
}
开发者ID:dadaa,项目名称:gecko-dev,代码行数:34,代码来源:BaseAccessibles.cpp

示例9: Parent

NS_IMETHODIMP
ARIAGridCellAccessible::GetRowIndex(int32_t* aRowIndex)
{
  NS_ENSURE_ARG_POINTER(aRowIndex);
  *aRowIndex = -1;

  if (IsDefunct())
    return NS_ERROR_FAILURE;

  Accessible* row = Parent();
  if (!row)
    return NS_OK;

  Accessible* table = row->Parent();
  if (!table)
    return NS_OK;

  *aRowIndex = 0;

  int32_t indexInTable = row->IndexInParent();
  for (int32_t idx = 0; idx < indexInTable; idx++) {
    row = table->GetChildAt(idx);
    if (row->Role() == roles::ROW)
      (*aRowIndex)++;
  }

  return NS_OK;
}
开发者ID:Ajunboys,项目名称:mozilla-os2,代码行数:28,代码来源:ARIAGridAccessible.cpp

示例10: cache

Accessible*
nsAccessiblePivot::SearchBackward(Accessible* aAccessible,
                                  nsIAccessibleTraversalRule* aRule,
                                  bool aSearchCurrent,
                                  nsresult* aResult)
{
  *aResult = NS_OK;

  // Initial position could be unset, in that case return null.
  if (!aAccessible)
    return nullptr;

  RuleCache cache(aRule);
  uint16_t filtered = nsIAccessibleTraversalRule::FILTER_IGNORE;
  Accessible* accessible = AdjustStartPosition(aAccessible, cache,
                                               &filtered, aResult);
  NS_ENSURE_SUCCESS(*aResult, nullptr);

  if (aSearchCurrent && (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)) {
    return accessible;
  }

  Accessible* root = GetActiveRoot();
  while (accessible != root) {
    Accessible* parent = accessible->Parent();
    int32_t idxInParent = accessible->IndexInParent();
    while (idxInParent > 0) {
      if (!(accessible = parent->GetChildAt(--idxInParent)))
        continue;

      *aResult = cache.ApplyFilter(accessible, &filtered);
      NS_ENSURE_SUCCESS(*aResult, nullptr);

      Accessible* lastChild = nullptr;
      while (!(filtered & nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE) &&
             (lastChild = accessible->LastChild())) {
        parent = accessible;
        accessible = lastChild;
        idxInParent = accessible->IndexInParent();
        *aResult = cache.ApplyFilter(accessible, &filtered);
        NS_ENSURE_SUCCESS(*aResult, nullptr);
      }

      if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)
        return accessible;
    }

    if (!(accessible = parent))
      break;

    *aResult = cache.ApplyFilter(accessible, &filtered);
    NS_ENSURE_SUCCESS(*aResult, nullptr);

    if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)
      return accessible;
  }

  return nullptr;
}
开发者ID:jsyeo,项目名称:mozilla-central,代码行数:59,代码来源:nsAccessiblePivot.cpp

示例11: Parent

Accessible*
HTMLSelectOptionAccessible::ContainerWidget() const
{
  Accessible* parent = Parent();
  if (parent && parent->IsHTMLOptGroup())
    parent = parent->Parent();

  return parent && parent->IsListControl() ? parent : nullptr;
}
开发者ID:InternalError503,项目名称:cyberfox,代码行数:9,代码来源:HTMLSelectAccessible.cpp

示例12: FocusMgr

Accessible*
ApplicationAccessible::FocusedChild()
{
  Accessible* focus = FocusMgr()->FocusedAccessible();
  if (focus && focus->Parent() == this)
    return focus;

  return nullptr;
}
开发者ID:ak352,项目名称:mozilla-central,代码行数:9,代码来源:ApplicationAccessible.cpp

示例13: Reset

bool
TreeWalker::Seek(nsIContent* aChildNode)
{
  MOZ_ASSERT(aChildNode, "Child cannot be null");

  Reset();

  if (mAnchorNode == aChildNode) {
    return true;
  }

  nsIContent* childNode = nullptr;
  nsINode* parentNode = aChildNode;
  do {
    childNode = parentNode->AsContent();
    parentNode = childNode->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR) &&
      (mChildFilter & nsIContent::eAllButXBL) ?
      childNode->GetParentNode() : childNode->GetFlattenedTreeParent();

    if (!parentNode || !parentNode->IsElement()) {
      return false;
    }

    // If ARIA owned child.
    Accessible* child = mDoc->GetAccessible(childNode);
    if (child && child->IsRelocated()) {
      MOZ_ASSERT(!(mFlags & eScoped),
        "Walker should not be scoped when seeking into relocated children");
      if (child->Parent() != mContext) {
        return false;
      }

      Accessible* ownedChild = nullptr;
      while ((ownedChild = mDoc->ARIAOwnedAt(mContext, mARIAOwnsIdx++)) &&
             ownedChild != child);

      MOZ_ASSERT(ownedChild, "A child has to be in ARIA owned elements");
      mPhase = eAtARIAOwns;
      return true;
    }

    // Look in DOM.
    dom::AllChildrenIterator* iter = PrependState(parentNode->AsElement(), true);
    if (!iter->Seek(childNode)) {
      return false;
    }

    if (parentNode == mAnchorNode) {
      mPhase = eAtDOM;
      return true;
    }
  } while (true);

  return false;
}
开发者ID:kinetiknz,项目名称:gecko-dev,代码行数:55,代码来源:TreeWalker.cpp

示例14: while

TableAccessible*
HTMLTableCellAccessible::Table() const
{
  Accessible* parent = const_cast<HTMLTableCellAccessible*>(this);
  while ((parent = parent->Parent())) {
    if (parent->IsTable())
      return parent->AsTable();
  }

  return nullptr;
}
开发者ID:kinetiknz,项目名称:gecko-dev,代码行数:11,代码来源:HTMLTableAccessible.cpp

示例15: Parent

Accessible*
XULColorPickerTileAccessible::ContainerWidget() const
{
  Accessible* parent = Parent();
  if (parent) {
    Accessible* grandParent = parent->Parent();
    if (grandParent && grandParent->IsMenuButton())
      return grandParent;
  }
  return nullptr;
}
开发者ID:0b10011,项目名称:mozilla-central,代码行数:11,代码来源:XULColorPickerAccessible.cpp


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