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 d6da2ae288820118838a78fbc71df443319cd918..ec9bd2e5f635fbec1e31c770d06a4a5bdda4c77a 100644 |
--- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp |
+++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp |
@@ -249,10 +249,10 @@ static bool applyCommandToFrame(LocalFrame& frame, |
// good reason for that? |
switch (source) { |
case EditCommandSource::kMenuOrKeyBinding: |
- frame.editor().applyStyleToSelection(source, style, inputType); |
+ frame.editor().applyStyleToSelection(style, inputType); |
return true; |
case EditCommandSource::kDOM: |
- frame.editor().applyStyle(source, style, inputType); |
+ frame.editor().applyStyle(style, inputType); |
return true; |
} |
NOTREACHED(); |
@@ -352,10 +352,10 @@ static bool executeApplyParagraphStyle(LocalFrame& frame, |
// good reason for that? |
switch (source) { |
case EditCommandSource::kMenuOrKeyBinding: |
- frame.editor().applyParagraphStyleToSelection(source, style, inputType); |
+ frame.editor().applyParagraphStyleToSelection(style, inputType); |
return true; |
case EditCommandSource::kDOM: |
- frame.editor().applyParagraphStyle(source, style, inputType); |
+ frame.editor().applyParagraphStyle(style, inputType); |
return true; |
} |
NOTREACHED(); |
@@ -363,7 +363,6 @@ static bool executeApplyParagraphStyle(LocalFrame& frame, |
} |
static bool executeInsertFragment(LocalFrame& frame, |
- EditCommandSource, |
DocumentFragment* fragment) { |
DCHECK(frame.document()); |
return ReplaceSelectionCommand::create( |
@@ -373,16 +372,14 @@ static bool executeInsertFragment(LocalFrame& frame, |
->apply(); |
} |
-static bool executeInsertElement(LocalFrame& frame, |
- EditCommandSource source, |
- HTMLElement* content) { |
+static bool executeInsertElement(LocalFrame& frame, HTMLElement* content) { |
DCHECK(frame.document()); |
DocumentFragment* fragment = DocumentFragment::create(*frame.document()); |
DummyExceptionStateForTesting exceptionState; |
fragment->appendChild(content, exceptionState); |
if (exceptionState.hadException()) |
return false; |
- return executeInsertFragment(frame, source, fragment); |
+ return executeInsertFragment(frame, fragment); |
} |
static bool expandSelectionToGranularity(LocalFrame& frame, |
@@ -583,7 +580,7 @@ static bool executeDelete(LocalFrame& frame, |
switch (source) { |
case EditCommandSource::kMenuOrKeyBinding: { |
// Doesn't modify the text if the current selection isn't a range. |
- frame.editor().performDelete(source); |
+ frame.editor().performDelete(); |
return true; |
} |
case EditCommandSource::kDOM: |
@@ -604,9 +601,9 @@ static bool executeDelete(LocalFrame& frame, |
static bool executeDeleteBackward(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- frame.editor().deleteWithDirection(source, DeleteDirection::Backward, |
+ frame.editor().deleteWithDirection(DeleteDirection::Backward, |
CharacterGranularity, false, true); |
return true; |
} |
@@ -614,68 +611,68 @@ static bool executeDeleteBackward(LocalFrame& frame, |
static bool executeDeleteBackwardByDecomposingPreviousCharacter( |
LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
DLOG(ERROR) << "DeleteBackwardByDecomposingPreviousCharacter is not " |
"implemented, doing DeleteBackward instead"; |
- frame.editor().deleteWithDirection(source, DeleteDirection::Backward, |
+ frame.editor().deleteWithDirection(DeleteDirection::Backward, |
CharacterGranularity, false, true); |
return true; |
} |
static bool executeDeleteForward(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- frame.editor().deleteWithDirection(source, DeleteDirection::Forward, |
+ frame.editor().deleteWithDirection(DeleteDirection::Forward, |
CharacterGranularity, false, true); |
return true; |
} |
static bool executeDeleteToBeginningOfLine(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- frame.editor().deleteWithDirection(source, DeleteDirection::Backward, |
- LineBoundary, true, false); |
+ frame.editor().deleteWithDirection(DeleteDirection::Backward, LineBoundary, |
+ true, false); |
return true; |
} |
static bool executeDeleteToBeginningOfParagraph(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- frame.editor().deleteWithDirection(source, DeleteDirection::Backward, |
+ frame.editor().deleteWithDirection(DeleteDirection::Backward, |
ParagraphBoundary, true, false); |
return true; |
} |
static bool executeDeleteToEndOfLine(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
// Despite its name, this command should delete the newline at the end of a |
// paragraph if you are at the end of a paragraph (like |
// DeleteToEndOfParagraph). |
- frame.editor().deleteWithDirection(source, DeleteDirection::Forward, |
- LineBoundary, true, false); |
+ frame.editor().deleteWithDirection(DeleteDirection::Forward, LineBoundary, |
+ true, false); |
return true; |
} |
static bool executeDeleteToEndOfParagraph(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
// Despite its name, this command should delete the newline at the end of |
// a paragraph if you are at the end of a paragraph. |
- frame.editor().deleteWithDirection(source, DeleteDirection::Forward, |
+ frame.editor().deleteWithDirection(DeleteDirection::Forward, |
ParagraphBoundary, true, false); |
return true; |
} |
static bool executeDeleteToMark(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
const EphemeralRange mark = |
frame.editor().mark().toNormalizedEphemeralRange(); |
@@ -688,26 +685,26 @@ static bool executeDeleteToMark(LocalFrame& frame, |
if (!selected) |
return false; |
} |
- frame.editor().performDelete(source); |
+ frame.editor().performDelete(); |
frame.editor().setMark(frame.selection().selection()); |
return true; |
} |
static bool executeDeleteWordBackward(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- frame.editor().deleteWithDirection(source, DeleteDirection::Backward, |
- WordGranularity, true, false); |
+ frame.editor().deleteWithDirection(DeleteDirection::Backward, WordGranularity, |
+ true, false); |
return true; |
} |
static bool executeDeleteWordForward(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- frame.editor().deleteWithDirection(source, DeleteDirection::Forward, |
- WordGranularity, true, false); |
+ frame.editor().deleteWithDirection(DeleteDirection::Forward, WordGranularity, |
+ true, false); |
return true; |
} |
@@ -781,7 +778,7 @@ static bool executeForwardDelete(LocalFrame& frame, |
EditingState editingState; |
switch (source) { |
case EditCommandSource::kMenuOrKeyBinding: |
- frame.editor().deleteWithDirection(source, DeleteDirection::Forward, |
+ frame.editor().deleteWithDirection(DeleteDirection::Forward, |
CharacterGranularity, false, true); |
return true; |
case EditCommandSource::kDOM: |
@@ -819,10 +816,8 @@ static bool executeIndent(LocalFrame& frame, |
static bool executeInsertBacktab(LocalFrame& frame, |
Event* event, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- DCHECK_EQ(source, EditCommandSource::kMenuOrKeyBinding) |
- << "|TextInputEvent| should only be triggered from user action."; |
return targetFrame(frame, event) |
->eventHandler() |
.handleTextInputEvent("\t", event, TextEventInputBackTab); |
@@ -830,33 +825,33 @@ static bool executeInsertBacktab(LocalFrame& frame, |
static bool executeInsertHorizontalRule(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String& value) { |
DCHECK(frame.document()); |
HTMLHRElement* rule = HTMLHRElement::create(*frame.document()); |
if (!value.isEmpty()) |
rule->setIdAttribute(AtomicString(value)); |
- return executeInsertElement(frame, source, rule); |
+ return executeInsertElement(frame, rule); |
} |
static bool executeInsertHTML(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String& value) { |
DCHECK(frame.document()); |
return executeInsertFragment( |
- frame, source, createFragmentFromMarkup(*frame.document(), value, "")); |
+ frame, createFragmentFromMarkup(*frame.document(), value, "")); |
} |
static bool executeInsertImage(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String& value) { |
DCHECK(frame.document()); |
HTMLImageElement* image = HTMLImageElement::create(*frame.document()); |
if (!value.isEmpty()) |
image->setSrc(value); |
- return executeInsertElement(frame, source, image); |
+ return executeInsertElement(frame, image); |
} |
static bool executeInsertLineBreak(LocalFrame& frame, |
@@ -882,10 +877,8 @@ static bool executeInsertLineBreak(LocalFrame& frame, |
static bool executeInsertNewline(LocalFrame& frame, |
Event* event, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- DCHECK_EQ(source, EditCommandSource::kMenuOrKeyBinding) |
- << "|TextInputEvent| should only be triggered from user action."; |
LocalFrame* targetFrame = blink::targetFrame(frame, event); |
return targetFrame->eventHandler().handleTextInputEvent( |
"\n", event, targetFrame->editor().canEditRichly() |
@@ -922,10 +915,8 @@ static bool executeInsertParagraph(LocalFrame& frame, |
static bool executeInsertTab(LocalFrame& frame, |
Event* event, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- DCHECK_EQ(source, EditCommandSource::kMenuOrKeyBinding) |
- << "|TextInputEvent| should only be triggered from user action."; |
return targetFrame(frame, event) |
->eventHandler() |
.handleTextInputEvent("\t", event); |
@@ -988,38 +979,38 @@ static bool executeJustifyRight(LocalFrame& frame, |
static bool executeMakeTextWritingDirectionLeftToRight(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
MutableStylePropertySet* style = |
MutableStylePropertySet::create(HTMLQuirksMode); |
style->setProperty(CSSPropertyUnicodeBidi, CSSValueIsolate); |
style->setProperty(CSSPropertyDirection, CSSValueLtr); |
- frame.editor().applyStyle(source, style, |
+ frame.editor().applyStyle(style, |
InputEvent::InputType::FormatSetBlockTextDirection); |
return true; |
} |
static bool executeMakeTextWritingDirectionNatural(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
MutableStylePropertySet* style = |
MutableStylePropertySet::create(HTMLQuirksMode); |
style->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal); |
- frame.editor().applyStyle(source, style, |
+ frame.editor().applyStyle(style, |
InputEvent::InputType::FormatSetBlockTextDirection); |
return true; |
} |
static bool executeMakeTextWritingDirectionRightToLeft(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
MutableStylePropertySet* style = |
MutableStylePropertySet::create(HTMLQuirksMode); |
style->setProperty(CSSPropertyUnicodeBidi, CSSValueIsolate); |
style->setProperty(CSSPropertyDirection, CSSValueRtl); |
- frame.editor().applyStyle(source, style, |
+ frame.editor().applyStyle(style, |
InputEvent::InputType::FormatSetBlockTextDirection); |
return true; |
} |
@@ -1550,17 +1541,17 @@ static bool executePrint(LocalFrame& frame, |
static bool executeRedo(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- frame.editor().redo(source); |
+ frame.editor().redo(); |
return true; |
} |
static bool executeRemoveFormat(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- frame.editor().removeFormattingAndStyle(source); |
+ frame.editor().removeFormattingAndStyle(); |
return true; |
} |
@@ -1747,9 +1738,9 @@ static bool executeToggleItalic(LocalFrame& frame, |
static bool executeTranspose(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- frame.editor().transpose(source); |
+ frame.editor().transpose(); |
return true; |
} |
@@ -1765,9 +1756,9 @@ static bool executeUnderline(LocalFrame& frame, |
static bool executeUndo(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
- frame.editor().undo(source); |
+ frame.editor().undo(); |
return true; |
} |
@@ -1797,20 +1788,20 @@ static bool executeUnselect(LocalFrame& frame, |
static bool executeYank(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
frame.editor().insertTextWithoutSendingTextEvent( |
- source, frame.editor().killRing().yank(), false, 0); |
+ frame.editor().killRing().yank(), false, 0); |
frame.editor().killRing().setToYankedState(); |
return true; |
} |
static bool executeYankAndSelect(LocalFrame& frame, |
Event*, |
- EditCommandSource source, |
+ EditCommandSource, |
const String&) { |
frame.editor().insertTextWithoutSendingTextEvent( |
- source, frame.editor().killRing().yank(), true, 0); |
+ frame.editor().killRing().yank(), true, 0); |
frame.editor().killRing().setToYankedState(); |
return true; |
} |
@@ -2563,11 +2554,9 @@ bool Editor::executeCommand(const String& commandName) { |
// Specially handling commands that Editor::execCommand does not directly |
// support. |
if (commandName == "DeleteToEndOfParagraph") { |
- if (!deleteWithDirection(EditCommandSource::kMenuOrKeyBinding, |
- DeleteDirection::Forward, ParagraphBoundary, true, |
+ if (!deleteWithDirection(DeleteDirection::Forward, ParagraphBoundary, true, |
false)) |
- deleteWithDirection(EditCommandSource::kMenuOrKeyBinding, |
- DeleteDirection::Forward, CharacterGranularity, true, |
+ deleteWithDirection(DeleteDirection::Forward, CharacterGranularity, true, |
false); |
return true; |
} |