Make TypingCommand::insertText() to take SelectionInDOMTree instead of VisibleSelection

This patch makes |TypingCommand::insertText()| to take |SelectionInDOMTree|
instead of |VisibleSelection| to reduce usage of |VisibleSelection| for
improving code health.

BUG=657237
TEST=n/a

Review-Url: https://codereview.chromium.org/2733183002
Cr-Commit-Position: refs/heads/master@{#455368}
void TypingCommand::insertTextRunWithoutNewlines(const String& text,
                                                 bool selectInsertedText,
                                                 EditingState* editingState) {
  CompositeEditCommand* command;
  if (isIncrementalInsertion()) {
    command = InsertIncrementalTextCommand::create(
        document(), text, selectInsertedText,
        m_compositionType == TextCompositionNone
            ? InsertIncrementalTextCommand::
                  RebalanceLeadingAndTrailingWhitespaces
            : InsertIncrementalTextCommand::RebalanceAllWhitespaces);
  } else {
    command = InsertTextCommand::create(
        document(), text, selectInsertedText,
        m_compositionType == TextCompositionNone
            ? InsertTextCommand::RebalanceLeadingAndTrailingWhitespaces
            : InsertTextCommand::RebalanceAllWhitespaces);
  }

  applyCommandToComposite(command, endingSelection(), editingState);
  if (editingState->isAborted())
    return;

  typingAddedToOpenCommand(InsertText);
}

void TypingCommand::insertTextRunWithoutNewlines(const String& text,
                                                 bool selectInsertedText,
                                                 EditingState* editingState) {
  CompositeEditCommand* command;
  if (isIncrementalInsertion()) {
    command = InsertIncrementalTextCommand::create(
        document(), text, selectInsertedText,
        m_compositionType == TextCompositionNone
            ? InsertIncrementalTextCommand::
                  RebalanceLeadingAndTrailingWhitespaces
            : InsertIncrementalTextCommand::RebalanceAllWhitespaces);
  } else {
    command = InsertTextCommand::create(
        document(), text, selectInsertedText,
        m_compositionType == TextCompositionNone
            ? InsertTextCommand::RebalanceLeadingAndTrailingWhitespaces
            : InsertTextCommand::RebalanceAllWhitespaces);
  }

  applyCommandToComposite(command, endingSelection(), editingState);
  if (editingState->isAborted())
    return;

  typingAddedToOpenCommand(InsertText);
}
