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

Unified Diff: third_party/WebKit/Source/core/editing/Editor.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/Editor.cpp
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
index 2954891283900e17fad5cad4257946cc1f26294c..cf83cee1de0f0de0597858ab45120d051b817406 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -388,10 +388,10 @@ void Editor::deleteSelectionWithSmartDelete(
const bool kSanitizeMarkup = true;
DCHECK(frame().document());
DeleteSelectionCommand::create(
- *frame().document(), deleteMode == DeleteMode::Smart,
+ *frame().document(), source, deleteMode == DeleteMode::Smart,
kMergeBlocksAfterDelete, kExpandForSpecialElements, kSanitizeMarkup,
inputType, referenceMovePosition)
- ->apply(source);
+ ->apply();
}
void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace) {
@@ -590,9 +590,9 @@ void Editor::replaceSelectionWithFragment(EditCommandSource source,
if (matchStyle)
options |= ReplaceSelectionCommand::MatchStyle;
DCHECK(frame().document());
- ReplaceSelectionCommand::create(*frame().document(), fragment, options,
- inputType)
- ->apply(source);
+ ReplaceSelectionCommand::create(*frame().document(), source, fragment,
+ options, inputType)
+ ->apply();
revealSelectionAfterEditingOperation();
}
@@ -618,9 +618,10 @@ void Editor::replaceSelectionAfterDragging(DocumentFragment* fragment,
if (dragSourceType == DragSourceType::PlainTextSource)
options |= ReplaceSelectionCommand::MatchStyle;
DCHECK(frame().document());
- ReplaceSelectionCommand::create(*frame().document(), fragment, options,
- InputEvent::InputType::InsertFromDrop)
- ->apply(EditCommandSource::kMenuOrKeyBinding);
+ ReplaceSelectionCommand::create(
+ *frame().document(), EditCommandSource::kMenuOrKeyBinding, fragment,
+ options, InputEvent::InputType::InsertFromDrop)
+ ->apply();
}
bool Editor::deleteSelectionAfterDraggingWithEvents(
@@ -709,7 +710,7 @@ void Editor::respondToChangedContents(const VisibleSelection& endingSelection) {
void Editor::removeFormattingAndStyle(EditCommandSource source) {
DCHECK(frame().document());
- RemoveFormatCommand::create(*frame().document())->apply(source);
+ RemoveFormatCommand::create(*frame().document(), source)->apply();
}
void Editor::registerCommandGroup(CompositeEditCommand* commandGroupWrapper) {
@@ -746,9 +747,9 @@ void Editor::applyStyle(EditCommandSource source,
case RangeSelection:
if (style) {
DCHECK(frame().document());
- ApplyStyleCommand::create(*frame().document(),
+ ApplyStyleCommand::create(*frame().document(), source,
EditingStyle::create(style), inputType)
- ->apply(source);
+ ->apply();
}
break;
}
@@ -760,9 +761,10 @@ void Editor::applyParagraphStyle(EditCommandSource source,
if (frame().selection().isNone() || !style)
return;
DCHECK(frame().document());
- ApplyStyleCommand::create(*frame().document(), EditingStyle::create(style),
- inputType, ApplyStyleCommand::ForceBlockProperties)
- ->apply(source);
+ ApplyStyleCommand::create(*frame().document(), source,
+ EditingStyle::create(style), inputType,
+ ApplyStyleCommand::ForceBlockProperties)
+ ->apply();
}
void Editor::applyStyleToSelection(EditCommandSource source,
@@ -1444,8 +1446,9 @@ void Editor::computeAndSetTypingStyle(EditCommandSource source,
EditingStyle* blockStyle = typingStyle->extractAndRemoveBlockProperties();
if (!blockStyle->isEmpty()) {
DCHECK(frame().document());
- ApplyStyleCommand::create(*frame().document(), blockStyle, inputType)
- ->apply(source);
+ ApplyStyleCommand::create(*frame().document(), source, blockStyle,
+ inputType)
+ ->apply();
}
// Set the remaining style as the typing style.

Powered by Google App Engine
This is Rietveld 408576698