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) { ...@@ -204,18 +204,16 @@ void TypingCommand::DeleteSelection(Document& document, Options options) {
} }
void TypingCommand::DeleteSelectionIfRange(const VisibleSelection& selection, void TypingCommand::DeleteSelectionIfRange(const VisibleSelection& selection,
EditingState* editing_state, EditingState* editing_state) {
bool smart_delete,
bool merge_blocks_after_delete,
bool expand_for_special_elements,
bool sanitize_markup) {
if (!selection.IsRange()) if (!selection.IsRange())
return; return;
ApplyCommandToComposite( const bool kMergeBlocksAfterDelete = true;
DeleteSelectionCommand::Create( const bool kExpandForSpecialElements = true;
selection, smart_delete, merge_blocks_after_delete, const bool kSanitizeMarkup = true;
expand_for_special_elements, sanitize_markup), ApplyCommandToComposite(DeleteSelectionCommand::Create(
editing_state); selection, smart_delete_, kMergeBlocksAfterDelete,
kExpandForSpecialElements, kSanitizeMarkup),
editing_state);
} }
void TypingCommand::DeleteKeyPressed(Document& document, void TypingCommand::DeleteKeyPressed(Document& document,
...@@ -925,7 +923,7 @@ void TypingCommand::DeleteKeyPressedInternal( ...@@ -925,7 +923,7 @@ void TypingCommand::DeleteKeyPressedInternal(
if (frame->GetEditor().Behavior().ShouldUndoOfDeleteSelectText() && if (frame->GetEditor().Behavior().ShouldUndoOfDeleteSelectText() &&
opened_by_backward_delete_) opened_by_backward_delete_)
SetStartingSelection(selection_after_undo); SetStartingSelection(selection_after_undo);
DeleteSelectionIfRange(selection_to_delete, editing_state, smart_delete_); DeleteSelectionIfRange(selection_to_delete, editing_state);
if (editing_state->IsAborted()) if (editing_state->IsAborted())
return; return;
SetSmartDelete(false); SetSmartDelete(false);
...@@ -1065,7 +1063,7 @@ void TypingCommand::ForwardDeleteKeyPressedInternal( ...@@ -1065,7 +1063,7 @@ void TypingCommand::ForwardDeleteKeyPressedInternal(
// Make undo select what was deleted on Mac alone // Make undo select what was deleted on Mac alone
if (frame->GetEditor().Behavior().ShouldUndoOfDeleteSelectText()) if (frame->GetEditor().Behavior().ShouldUndoOfDeleteSelectText())
SetStartingSelection(selection_after_undo); SetStartingSelection(selection_after_undo);
DeleteSelectionIfRange(selection_to_delete, editing_state, smart_delete_); DeleteSelectionIfRange(selection_to_delete, editing_state);
if (editing_state->IsAborted()) if (editing_state->IsAborted())
return; return;
SetSmartDelete(false); SetSmartDelete(false);
......
...@@ -164,12 +164,7 @@ class CORE_EXPORT TypingCommand final : public CompositeEditCommand { ...@@ -164,12 +164,7 @@ class CORE_EXPORT TypingCommand final : public CompositeEditCommand {
bool kill_ring, bool kill_ring,
EditingState*); EditingState*);
void DeleteSelectionIfRange(const VisibleSelection&, void DeleteSelectionIfRange(const VisibleSelection&, EditingState*);
EditingState*,
bool smart_delete = false,
bool merge_blocks_after_delete = true,
bool expand_for_special_elements = true,
bool sanitize_markup = true);
void ForwardDeleteKeyPressedInternal( void ForwardDeleteKeyPressedInternal(
const VisibleSelection& selection_to_delete, 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