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

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

Issue 2579253002: [EditCommandSource] Pass source to |CompositEditCommand| and |TypingCommand| (3/3) (Closed)
Patch Set: Created 4 years 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 89642542a7670f507f78d03e5534342b46135ff5..e564b7c0d884b6ea903d2627b38ece6a15b724e2 100644
--- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -364,14 +364,14 @@ static bool executeApplyParagraphStyle(LocalFrame& frame,
}
static bool executeInsertFragment(LocalFrame& frame,
- EditCommandSource,
+ EditCommandSource source,
DocumentFragment* fragment) {
DCHECK(frame.document());
return ReplaceSelectionCommand::create(
*frame.document(), fragment,
ReplaceSelectionCommand::PreventNesting,
InputEvent::InputType::None)
- ->apply();
+ ->apply(source);
}
static bool executeInsertElement(LocalFrame& frame,
@@ -541,12 +541,12 @@ static bool executeCopy(LocalFrame& frame,
static bool executeCreateLink(LocalFrame& frame,
Event*,
- EditCommandSource,
+ EditCommandSource source,
const String& value) {
if (value.isEmpty())
return false;
DCHECK(frame.document());
- return CreateLinkCommand::create(*frame.document(), value)->apply();
+ return CreateLinkCommand::create(*frame.document(), value)->apply(source);
}
static bool executeCut(LocalFrame& frame,
@@ -593,9 +593,10 @@ static bool executeDelete(LocalFrame& frame,
// time, siding with IE, not Firefox).
DCHECK(frame.document());
TypingCommand::deleteKeyPressed(
- *frame.document(), frame.selection().granularity() == WordGranularity
- ? TypingCommand::SmartDelete
- : 0);
+ *frame.document(), source,
+ frame.selection().granularity() == WordGranularity
+ ? TypingCommand::SmartDelete
+ : 0);
return true;
}
NOTREACHED();
@@ -755,7 +756,7 @@ static bool executeForeColor(LocalFrame& frame,
static bool executeFormatBlock(LocalFrame& frame,
Event*,
- EditCommandSource,
+ EditCommandSource source,
const String& value) {
String tagName = value.lower();
if (tagName[0] == '<' && tagName[tagName.length() - 1] == '>')
@@ -770,7 +771,7 @@ static bool executeFormatBlock(LocalFrame& frame,
DCHECK(frame.document());
FormatBlockCommand* command =
FormatBlockCommand::create(*frame.document(), qualifiedTagName);
- command->apply();
+ command->apply(source);
return command->didApply();
}
@@ -790,7 +791,8 @@ static bool executeForwardDelete(LocalFrame& frame,
// only needed for backward compatibility with ourselves, and for
// consistency with Delete.
DCHECK(frame.document());
- TypingCommand::forwardDeleteKeyPressed(*frame.document(), &editingState);
+ TypingCommand::forwardDeleteKeyPressed(*frame.document(), source,
+ &editingState);
if (editingState.isAborted())
return false;
return true;
@@ -809,12 +811,12 @@ static bool executeIgnoreSpelling(LocalFrame& frame,
static bool executeIndent(LocalFrame& frame,
Event*,
- EditCommandSource,
+ EditCommandSource source,
const String&) {
DCHECK(frame.document());
return IndentOutdentCommand::create(*frame.document(),
IndentOutdentCommand::Indent)
- ->apply();
+ ->apply(source);
}
static bool executeInsertBacktab(LocalFrame& frame,
@@ -874,7 +876,7 @@ static bool executeInsertLineBreak(LocalFrame& frame,
// is only needed for backward compatibility with ourselves, and for
// consistency with other commands.
DCHECK(frame.document());
- return TypingCommand::insertLineBreak(*frame.document());
+ return TypingCommand::insertLineBreak(*frame.document(), source);
}
NOTREACHED();
return false;
@@ -895,29 +897,29 @@ static bool executeInsertNewline(LocalFrame& frame,
static bool executeInsertNewlineInQuotedContent(LocalFrame& frame,
Event*,
- EditCommandSource,
+ EditCommandSource source,
const String&) {
DCHECK(frame.document());
return TypingCommand::insertParagraphSeparatorInQuotedContent(
- *frame.document());
+ *frame.document(), source);
}
static bool executeInsertOrderedList(LocalFrame& frame,
Event*,
- EditCommandSource,
+ EditCommandSource source,
const String&) {
DCHECK(frame.document());
return InsertListCommand::create(*frame.document(),
InsertListCommand::OrderedList)
- ->apply();
+ ->apply(source);
}
static bool executeInsertParagraph(LocalFrame& frame,
Event*,
- EditCommandSource,
+ EditCommandSource source,
const String&) {
DCHECK(frame.document());
- return TypingCommand::insertParagraphSeparator(*frame.document());
+ return TypingCommand::insertParagraphSeparator(*frame.document(), source);
}
static bool executeInsertTab(LocalFrame& frame,
@@ -933,21 +935,21 @@ static bool executeInsertTab(LocalFrame& frame,
static bool executeInsertText(LocalFrame& frame,
Event*,
- EditCommandSource,
+ EditCommandSource source,
const String& value) {
DCHECK(frame.document());
- TypingCommand::insertText(*frame.document(), value, 0);
+ TypingCommand::insertText(*frame.document(), source, value, 0);
return true;
}
static bool executeInsertUnorderedList(LocalFrame& frame,
Event*,
- EditCommandSource,
+ EditCommandSource source,
const String&) {
DCHECK(frame.document());
return InsertListCommand::create(*frame.document(),
InsertListCommand::UnorderedList)
- ->apply();
+ ->apply(source);
}
static bool executeJustifyCenter(LocalFrame& frame,
@@ -1468,12 +1470,12 @@ static bool executeMoveToRightEndOfLineAndModifySelection(LocalFrame& frame,
static bool executeOutdent(LocalFrame& frame,
Event*,
- EditCommandSource,
+ EditCommandSource source,
const String&) {
DCHECK(frame.document());
return IndentOutdentCommand::create(*frame.document(),
IndentOutdentCommand::Outdent)
- ->apply();
+ ->apply(source);
}
static bool executeToggleOverwrite(LocalFrame& frame,
@@ -1773,10 +1775,10 @@ static bool executeUndo(LocalFrame& frame,
static bool executeUnlink(LocalFrame& frame,
Event*,
- EditCommandSource,
+ EditCommandSource source,
const String&) {
DCHECK(frame.document());
- return UnlinkCommand::create(*frame.document())->apply();
+ return UnlinkCommand::create(*frame.document())->apply(source);
}
static bool executeUnscript(LocalFrame& frame,

Powered by Google App Engine
This is Rietveld 408576698