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

Unified Diff: third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h

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.h
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h
index f6c2930ffa5ed34bbca22557c192a8fac3e8c561..bbb6d5a3a98f528012cb3deec22ff264cfcecfb1 100644
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.h
@@ -42,7 +42,11 @@ class HTMLElement;
class HTMLSpanElement;
class Text;
-enum class EditCommandSource { kMenuOrKeyBinding, kDOM };
+enum class EditCommandSource {
+ kMenuOrKeyBinding, // from menu, or keyboard shortcut
yosin_UTC9 2017/01/12 04:01:13 I prefer to use |kUserAction| instead of |kMenuOrK
chongz 2017/01/13 16:28:27 Will do.
+ kDOM, // document.execCommand()
yosin_UTC9 2017/01/12 04:01:13 I prefer to use |kExecCommand|, |kScriptAPI|, or a
chongz 2017/01/13 16:28:27 Will do.
+ kInternal, // Blink creates a command for implementation.
+};
class EditCommandComposition final : public UndoStep {
public:
@@ -100,7 +104,7 @@ class CORE_EXPORT CompositeEditCommand : public EditCommand {
~CompositeEditCommand() override;
// Returns |false| if the command failed. e.g. It's aborted.
- bool apply(EditCommandSource);
+ bool apply();
bool isFirstCommand(EditCommand* command) {
return !m_commands.isEmpty() && m_commands.front() == command;
}
@@ -120,7 +124,9 @@ class CORE_EXPORT CompositeEditCommand : public EditCommand {
DECLARE_VIRTUAL_TRACE();
protected:
- explicit CompositeEditCommand(Document&);
+ explicit CompositeEditCommand(
+ Document&,
+ EditCommandSource = EditCommandSource::kInternal);
// TODO(chongz): Implement "beforeinput" as described below:
// Fires "beforeinput" and will return |false| to cancel applying editing if
@@ -281,6 +287,7 @@ class CORE_EXPORT CompositeEditCommand : public EditCommand {
bool isCompositeEditCommand() const final { return true; }
Member<EditCommandComposition> m_composition;
+ EditCommandSource m_source;
};
DEFINE_TYPE_CASTS(CompositeEditCommand,

Powered by Google App Engine
This is Rietveld 408576698