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


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

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


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

示例1: if

bool
TextRange::Crop(Accessible* aContainer)
{
  uint32_t boundaryPos = 0, containerPos = 0;
  AutoTArray<Accessible*, 30> boundaryParents, containerParents;

  // Crop the start boundary.
  Accessible* container = nullptr;
  Accessible* boundary = mStartContainer->GetChildAtOffset(mStartOffset);
  if (boundary != aContainer) {
    CommonParent(boundary, aContainer, &boundaryParents, &boundaryPos,
                 &containerParents, &containerPos);

    if (boundaryPos == 0) {
      if (containerPos != 0) {
        // The container is contained by the start boundary, reduce the range to
        // the point starting at the container.
        aContainer->ToTextPoint(mStartContainer.StartAssignment(), &mStartOffset);
        static_cast<Accessible*>(mStartContainer)->AddRef();
      }
      else {
        // The start boundary and the container are siblings.
        container = aContainer;
      }
    }
    else if (containerPos != 0) {
      // The container does not contain the start boundary.
      boundary = boundaryParents[boundaryPos];
      container = containerParents[containerPos];
    }

    if (container) {
      // If the range start is after the container, then make the range invalid.
      if (boundary->IndexInParent() > container->IndexInParent()) {
        return !!(mRoot = nullptr);
      }

      // If the range starts before the container, then reduce the range to
      // the point starting at the container.
      if (boundary->IndexInParent() < container->IndexInParent()) {
        container->ToTextPoint(mStartContainer.StartAssignment(), &mStartOffset);
        mStartContainer.get()->AddRef();
      }
    }

    boundaryParents.SetLengthAndRetainStorage(0);
    containerParents.SetLengthAndRetainStorage(0);
  }

  boundary = mEndContainer->GetChildAtOffset(mEndOffset);
  if (boundary == aContainer) {
    return true;
  }

  // Crop the end boundary.
  container = nullptr;
  CommonParent(boundary, aContainer, &boundaryParents, &boundaryPos,
               &containerParents, &containerPos);

  if (boundaryPos == 0) {
    if (containerPos != 0) {
      aContainer->ToTextPoint(mEndContainer.StartAssignment(), &mEndOffset, false);
      static_cast<Accessible*>(mEndContainer)->AddRef();
    }
    else {
      container = aContainer;
    }
  }
  else if (containerPos != 0) {
    boundary = boundaryParents[boundaryPos];
    container = containerParents[containerPos];
  }

  if (!container) {
    return true;
  }

  if (boundary->IndexInParent() < container->IndexInParent()) {
    return !!(mRoot = nullptr);
  }

  if (boundary->IndexInParent() > container->IndexInParent()) {
    container->ToTextPoint(mEndContainer.StartAssignment(), &mEndOffset, false);
    static_cast<Accessible*>(mEndContainer)->AddRef();
  }

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


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