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

Unified Diff: third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.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/CompositeEditCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
index 866d02dfe99734e203c106c3f9c8b144b4f294f3..0ce7b44abcf6679e036212e8c6748b4696cf298e 100644
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
@@ -189,14 +189,15 @@ DEFINE_TRACE(EditCommandComposition) {
UndoStep::trace(visitor);
}
-CompositeEditCommand::CompositeEditCommand(Document& document)
- : EditCommand(document) {}
+CompositeEditCommand::CompositeEditCommand(Document& document,
+ EditCommandSource source)
+ : EditCommand(document), m_source(source) {}
CompositeEditCommand::~CompositeEditCommand() {
DCHECK(isTopLevelCommand() || !m_composition);
}
-bool CompositeEditCommand::apply(EditCommandSource source) {
+bool CompositeEditCommand::apply() {
DCHECK(!isCommandGroupWrapper());
if (!endingSelection().isContentRichlyEditable()) {
switch (inputType()) {
@@ -232,7 +233,7 @@ bool CompositeEditCommand::apply(EditCommandSource source) {
// the creation of VisiblePositions).
document().updateStyleAndLayoutIgnorePendingStylesheets();
- if (!willApplyEditing(source))
+ if (!willApplyEditing(m_source))
return false;
LocalFrame* frame = document().frame();
@@ -333,7 +334,8 @@ void CompositeEditCommand::appendCommandToComposite(
void CompositeEditCommand::applyStyle(const EditingStyle* style,
EditingState* editingState) {
applyCommandToComposite(
- ApplyStyleCommand::create(document(), style, InputEvent::InputType::None),
+ ApplyStyleCommand::create(document(), EditCommandSource::kInternal, style,
+ InputEvent::InputType::None),
editingState);
}
@@ -757,11 +759,13 @@ void CompositeEditCommand::deleteSelection(EditingState* editingState,
bool mergeBlocksAfterDelete,
bool expandForSpecialElements,
bool sanitizeMarkup) {
- if (endingSelection().isRange())
- applyCommandToComposite(DeleteSelectionCommand::create(
- document(), smartDelete, mergeBlocksAfterDelete,
- expandForSpecialElements, sanitizeMarkup),
- editingState);
+ if (endingSelection().isRange()) {
+ applyCommandToComposite(
+ DeleteSelectionCommand::create(
+ document(), EditCommandSource::kInternal, smartDelete,
+ mergeBlocksAfterDelete, expandForSpecialElements, sanitizeMarkup),
+ editingState);
+ }
}
void CompositeEditCommand::deleteSelection(const VisibleSelection& selection,
@@ -1686,7 +1690,8 @@ void CompositeEditCommand::moveParagraphs(
if (shouldPreserveStyle == DoNotPreserveStyle)
options |= ReplaceSelectionCommand::MatchStyle;
applyCommandToComposite(
- ReplaceSelectionCommand::create(document(), fragment, options),
+ ReplaceSelectionCommand::create(document(), EditCommandSource::kInternal,
+ fragment, options),
editingState);
if (editingState->isAborted())
return;

Powered by Google App Engine
This is Rietveld 408576698