Commit 4cd9cd8f authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Simplify TypingCommand::DeleteSelectionIfRange() parameters

This patch simplifies parameters of |TypingCommand::DeleteSelectionIfRange()|
because all call sites pass same arguments to reduce source code size for
improving code health.

This patch is a preparation of the patch[1].

[1] http://crrev.com/c/crrev.com/c/925125 Introduce DeleteSelectionOptions
for DeleteSelectionCommand construction

Change-Id: I77228da041f77e9864a25542082ea9827fb3b631
Reviewed-on: https://chromium-review.googlesource.com/923614
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537696}
parent 8cc52515
......@@ -204,18 +204,16 @@ void TypingCommand::DeleteSelection(Document& document, Options options) {
}
void TypingCommand::DeleteSelectionIfRange(const VisibleSelection& selection,
EditingState* editing_state,
bool smart_delete,
bool merge_blocks_after_delete,
bool expand_for_special_elements,
bool sanitize_markup) {
EditingState* editing_state) {
if (!selection.IsRange())
return;
ApplyCommandToComposite(
DeleteSelectionCommand::Create(
selection, smart_delete, merge_blocks_after_delete,
expand_for_special_elements, sanitize_markup),
editing_state);
const bool kMergeBlocksAfterDelete = true;
const bool kExpandForSpecialElements = true;
const bool kSanitizeMarkup = true;
ApplyCommandToComposite(DeleteSelectionCommand::Create(
selection, smart_delete_, kMergeBlocksAfterDelete,
kExpandForSpecialElements, kSanitizeMarkup),
editing_state);
}
void TypingCommand::DeleteKeyPressed(Document& document,
......@@ -925,7 +923,7 @@ void TypingCommand::DeleteKeyPressedInternal(
if (frame->GetEditor().Behavior().ShouldUndoOfDeleteSelectText() &&
opened_by_backward_delete_)
SetStartingSelection(selection_after_undo);
DeleteSelectionIfRange(selection_to_delete, editing_state, smart_delete_);
DeleteSelectionIfRange(selection_to_delete, editing_state);
if (editing_state->IsAborted())
return;
SetSmartDelete(false);
......@@ -1065,7 +1063,7 @@ void TypingCommand::ForwardDeleteKeyPressedInternal(
// Make undo select what was deleted on Mac alone
if (frame->GetEditor().Behavior().ShouldUndoOfDeleteSelectText())
SetStartingSelection(selection_after_undo);
DeleteSelectionIfRange(selection_to_delete, editing_state, smart_delete_);
DeleteSelectionIfRange(selection_to_delete, editing_state);
if (editing_state->IsAborted())
return;
SetSmartDelete(false);
......
......@@ -164,12 +164,7 @@ class CORE_EXPORT TypingCommand final : public CompositeEditCommand {
bool kill_ring,
EditingState*);
void DeleteSelectionIfRange(const VisibleSelection&,
EditingState*,
bool smart_delete = false,
bool merge_blocks_after_delete = true,
bool expand_for_special_elements = true,
bool sanitize_markup = true);
void DeleteSelectionIfRange(const VisibleSelection&, EditingState*);
void ForwardDeleteKeyPressedInternal(
const VisibleSelection& selection_to_delete,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment