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 Editor::replaceSelectionWithFragment(DocumentFragment* fragment,
                                          bool selectReplacement,
                                          bool smartReplace,
                                          bool matchStyle,
                                          InputEvent::InputType inputType) {
  DCHECK(!frame().document()->needsLayoutTreeUpdate());
  if (frame()
          .selection()
          .computeVisibleSelectionInDOMTreeDeprecated()
          .isNone() ||
      !frame()
           .selection()
           .computeVisibleSelectionInDOMTreeDeprecated()
           .isContentEditable() ||
      !fragment)
    return;

  ReplaceSelectionCommand::CommandOptions options =
      ReplaceSelectionCommand::PreventNesting |
      ReplaceSelectionCommand::SanitizeFragment;
  if (selectReplacement)
    options |= ReplaceSelectionCommand::SelectReplacement;
  if (smartReplace)
    options |= ReplaceSelectionCommand::SmartReplace;
  if (matchStyle)
    options |= ReplaceSelectionCommand::MatchStyle;
  DCHECK(frame().document());
  ReplaceSelectionCommand::create(*frame().document(), fragment, options,
                                  inputType)
      ->apply();
  revealSelectionAfterEditingOperation();
}

void Editor::replaceSelectionWithFragment(DocumentFragment* fragment,
                                          bool selectReplacement,
                                          bool smartReplace,
                                          bool matchStyle,
                                          InputEvent::InputType inputType) {
  DCHECK(!frame().document()->needsLayoutTreeUpdate());
  if (frame()
          .selection()
          .computeVisibleSelectionInDOMTreeDeprecated()
          .isNone() ||
      !frame()
           .selection()
           .computeVisibleSelectionInDOMTreeDeprecated()
           .isContentEditable() ||
      !fragment)
    return;

  ReplaceSelectionCommand::CommandOptions options =
      ReplaceSelectionCommand::PreventNesting |
      ReplaceSelectionCommand::SanitizeFragment;
  if (selectReplacement)
    options |= ReplaceSelectionCommand::SelectReplacement;
  if (smartReplace)
    options |= ReplaceSelectionCommand::SmartReplace;
  if (matchStyle)
    options |= ReplaceSelectionCommand::MatchStyle;
  DCHECK(frame().document());
  ReplaceSelectionCommand::create(*frame().document(), fragment, options,
                                  inputType)
      ->apply();
  revealSelectionAfterEditingOperation();
}
