get selectionIndex_() {
    var adjustedIndex = this.index_;

    if (!this.node)
      return -1;

    if (this.node.state[StateType.EDITABLE]) {
      if (!this.node.state[StateType.RICHLY_EDITABLE])
        return this.index_;
      return this.index_ == cursors.NODE_INDEX ?
          (this.node.indexInParent || 0) :
          this.index_;
    } else if (
        this.node.role == RoleType.INLINE_TEXT_BOX &&
        // Selections under a line break are broken.
        this.node.parent && this.node.parent.role != RoleType.LINE_BREAK) {
      if (adjustedIndex == cursors.NODE_INDEX)
        adjustedIndex = 0;

      var sibling = this.node.previousSibling;
      while (sibling) {
        adjustedIndex += sibling.name.length;
        sibling = sibling.previousSibling;
      }
    } else if (
        this.index_ == cursors.NODE_INDEX ||
        this.node.nameFrom != chrome.automation.NameFromType.CONTENTS) {
      // A node offset or unselectable character offset.

      // The selected node could have been adjusted upwards in the tree.
      var childOfSelection = this.node;
      do {
        adjustedIndex = childOfSelection.indexInParent || 0;
        childOfSelection = childOfSelection.parent;
      } while (childOfSelection && childOfSelection != this.selectionNode_);
    }
    // A character offset into content is the remaining case. It requires no
    // adjustment.

    return adjustedIndex;
  }
/**
   * An index appropriate for making selections.  If this cursor has a
   * cursors.NODE_INDEX index, the selection index is a node offset e.g. the
   * index in parent. If not, the index is a character offset.
   * @return {number}
   * @private
   */
An index appropriate for making selections.  If this cursor has a
cursors.NODE_INDEX index, the selection index is a node offset e.g. the
index in parent. If not, the index is a character offset.
@return {number}
@private
An index appropriate for making selections . If this cursor has a cursors . NODE_INDEX index the selection index is a node offset e . g . the index in parent . If not the index is a character offset . @return { number } @private
get selectionIndex_() {
    var adjustedIndex = this.index_;
    if (!this.node)
      return -1;
    if (this.node.state[StateType.EDITABLE]) {
      if (!this.node.state[StateType.RICHLY_EDITABLE])
        return this.index_;
      return this.index_ == cursors.NODE_INDEX ?
          (this.node.indexInParent || 0) :
          this.index_;
    } else if (
        this.node.role == RoleType.INLINE_TEXT_BOX &&
        this.node.parent && this.node.parent.role != RoleType.LINE_BREAK) {
      if (adjustedIndex == cursors.NODE_INDEX)
        adjustedIndex = 0;
      var sibling = this.node.previousSibling;
      while (sibling) {
        adjustedIndex += sibling.name.length;
        sibling = sibling.previousSibling;
      }
    } else if (
        this.index_ == cursors.NODE_INDEX ||
        this.node.nameFrom != chrome.automation.NameFromType.CONTENTS) {
      var childOfSelection = this.node;
      do {
        adjustedIndex = childOfSelection.indexInParent || 0;
        childOfSelection = childOfSelection.parent;
      } while (childOfSelection && childOfSelection != this.selectionNode_);
    }
    return adjustedIndex;
  }
get selectionIndex_ ( ) { var adjustedIndex = this . index_ ; if ( ! this . node ) return - 1 ; if ( this . node . state [ StateType . EDITABLE ] ) { if ( ! this . node . state [ StateType . RICHLY_EDITABLE ] ) return this . index_ ; return this . index_ == cursors . NODE_INDEX ? ( this . node . indexInParent || 0 ) : this . index_ ; } else if ( this . node . role == RoleType . INLINE_TEXT_BOX && this . node . parent && this . node . parent . role != RoleType . LINE_BREAK ) { if ( adjustedIndex == cursors . NODE_INDEX ) adjustedIndex = 0 ; var sibling = this . node . previousSibling ; while ( sibling ) { adjustedIndex += sibling . name . length ; sibling = sibling . previousSibling ; } } else if ( this . index_ == cursors . NODE_INDEX || this . node . nameFrom != chrome . automation . NameFromType . CONTENTS ) { var childOfSelection = this . node ; do { adjustedIndex = childOfSelection . indexInParent || 0 ; childOfSelection = childOfSelection . parent ; } while ( childOfSelection && childOfSelection != this . selectionNode_ ) ; } return adjustedIndex ; }
An index appropriate for making selections.
An index appropriate for making selections .
// Selections under a line break are broken. // A node offset or unselectable character offset. // The selected node could have been adjusted upwards in the tree. // A character offset into content is the remaining case. It requires no // adjustment.