Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp

Issue 2627103003: [EditCommandSource] Pass source through |CompositeEditCommand| ctor instead of |apply(source)| (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
index e564b7c0d884b6ea903d2627b38ece6a15b724e2..b1145992f0e2f329283785b59e4b350f157901a4 100644
--- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -255,9 +255,10 @@ static bool applyCommandToFrame(LocalFrame& frame,
case EditCommandSource::kDOM:
frame.editor().applyStyle(source, style, inputType);
return true;
+ default:
+ NOTREACHED();
+ return false;
}
- NOTREACHED();
- return false;
}
static bool executeApplyStyle(LocalFrame& frame,
@@ -358,9 +359,10 @@ static bool executeApplyParagraphStyle(LocalFrame& frame,
case EditCommandSource::kDOM:
frame.editor().applyParagraphStyle(source, style, inputType);
return true;
+ default:
+ NOTREACHED();
+ return false;
}
- NOTREACHED();
- return false;
}
static bool executeInsertFragment(LocalFrame& frame,
@@ -368,10 +370,10 @@ static bool executeInsertFragment(LocalFrame& frame,
DocumentFragment* fragment) {
DCHECK(frame.document());
return ReplaceSelectionCommand::create(
- *frame.document(), fragment,
+ *frame.document(), source, fragment,
ReplaceSelectionCommand::PreventNesting,
InputEvent::InputType::None)
- ->apply(source);
+ ->apply();
}
static bool executeInsertElement(LocalFrame& frame,
@@ -546,7 +548,7 @@ static bool executeCreateLink(LocalFrame& frame,
if (value.isEmpty())
return false;
DCHECK(frame.document());
- return CreateLinkCommand::create(*frame.document(), value)->apply(source);
+ return CreateLinkCommand::create(*frame.document(), source, value)->apply();
}
static bool executeCut(LocalFrame& frame,
@@ -598,9 +600,10 @@ static bool executeDelete(LocalFrame& frame,
? TypingCommand::SmartDelete
: 0);
return true;
+ default:
+ NOTREACHED();
+ return false;
}
- NOTREACHED();
- return false;
}
static bool executeDeleteBackward(LocalFrame& frame,
@@ -770,8 +773,8 @@ static bool executeFormatBlock(LocalFrame& frame,
DCHECK(frame.document());
FormatBlockCommand* command =
- FormatBlockCommand::create(*frame.document(), qualifiedTagName);
- command->apply(source);
+ FormatBlockCommand::create(*frame.document(), source, qualifiedTagName);
+ command->apply();
return command->didApply();
}
@@ -796,9 +799,10 @@ static bool executeForwardDelete(LocalFrame& frame,
if (editingState.isAborted())
return false;
return true;
+ default:
+ NOTREACHED();
+ return false;
}
- NOTREACHED();
- return false;
}
static bool executeIgnoreSpelling(LocalFrame& frame,
@@ -814,9 +818,9 @@ static bool executeIndent(LocalFrame& frame,
EditCommandSource source,
const String&) {
DCHECK(frame.document());
- return IndentOutdentCommand::create(*frame.document(),
+ return IndentOutdentCommand::create(*frame.document(), source,
IndentOutdentCommand::Indent)
- ->apply(source);
+ ->apply();
}
static bool executeInsertBacktab(LocalFrame& frame,
@@ -877,9 +881,10 @@ static bool executeInsertLineBreak(LocalFrame& frame,
// consistency with other commands.
DCHECK(frame.document());
return TypingCommand::insertLineBreak(*frame.document(), source);
+ default:
+ NOTREACHED();
+ return false;
}
- NOTREACHED();
- return false;
}
static bool executeInsertNewline(LocalFrame& frame,
@@ -909,9 +914,9 @@ static bool executeInsertOrderedList(LocalFrame& frame,
EditCommandSource source,
const String&) {
DCHECK(frame.document());
- return InsertListCommand::create(*frame.document(),
+ return InsertListCommand::create(*frame.document(), source,
InsertListCommand::OrderedList)
- ->apply(source);
+ ->apply();
}
static bool executeInsertParagraph(LocalFrame& frame,
@@ -947,9 +952,9 @@ static bool executeInsertUnorderedList(LocalFrame& frame,
EditCommandSource source,
const String&) {
DCHECK(frame.document());
- return InsertListCommand::create(*frame.document(),
+ return InsertListCommand::create(*frame.document(), source,
InsertListCommand::UnorderedList)
- ->apply(source);
+ ->apply();
}
static bool executeJustifyCenter(LocalFrame& frame,
@@ -1473,9 +1478,9 @@ static bool executeOutdent(LocalFrame& frame,
EditCommandSource source,
const String&) {
DCHECK(frame.document());
- return IndentOutdentCommand::create(*frame.document(),
+ return IndentOutdentCommand::create(*frame.document(), source,
IndentOutdentCommand::Outdent)
- ->apply(source);
+ ->apply();
}
static bool executeToggleOverwrite(LocalFrame& frame,
@@ -1778,7 +1783,7 @@ static bool executeUnlink(LocalFrame& frame,
EditCommandSource source,
const String&) {
DCHECK(frame.document());
- return UnlinkCommand::create(*frame.document())->apply(source);
+ return UnlinkCommand::create(*frame.document(), source)->apply();
}
static bool executeUnscript(LocalFrame& frame,
@@ -1898,9 +1903,10 @@ static bool enabledDelete(LocalFrame& frame,
// "Delete" from DOM is like delete/backspace keypress, affects selected
// range if non-empty, otherwise removes a character
return enabledInEditableText(frame, event, source);
+ default:
+ NOTREACHED();
+ return false;
}
- NOTREACHED();
- return false;
}
static bool enabledInRichlyEditableText(LocalFrame& frame,
@@ -2682,9 +2688,10 @@ bool Editor::Command::isSupported() const {
return true;
case EditCommandSource::kDOM:
return m_command->isSupportedFromDOM(m_frame.get());
+ default:
+ NOTREACHED();
+ return false;
}
- NOTREACHED();
- return false;
}
bool Editor::Command::isEnabled(Event* triggeringEvent) const {

Powered by Google App Engine
This is Rietveld 408576698