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

Unified Diff: third_party/WebKit/Source/core/editing/Editor.h

Issue 2574793002: [Editing] Store |CommandSource| in |CompositeEditCommand| (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/Editor.h
diff --git a/third_party/WebKit/Source/core/editing/Editor.h b/third_party/WebKit/Source/core/editing/Editor.h
index 41a5b49adfbada602f5f88053a4315443332699a..479826394b00b53aee250a80b4de674af9472449 100644
--- a/third_party/WebKit/Source/core/editing/Editor.h
+++ b/third_party/WebKit/Source/core/editing/Editor.h
@@ -57,12 +57,12 @@ class StylePropertySet;
class TextEvent;
class UndoStack;
+enum class CommandSource;
enum class DeleteDirection;
enum class DeleteMode { Simple, Smart };
enum class InsertMode { Simple, Smart };
enum class DragSourceType { HTMLSource, PlainTextSource };
-enum EditorCommandSource { CommandFromMenuOrKeyBinding, CommandFromDOM };
enum EditorParagraphSeparator {
EditorParagraphSeparatorIsDiv,
EditorParagraphSeparatorIsP
@@ -94,16 +94,16 @@ class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> {
bool canDelete() const;
bool canSmartCopyOrDelete() const;
- void cut(EditorCommandSource);
+ void cut(CommandSource);
void copy();
- void paste(EditorCommandSource);
- void pasteAsPlainText(EditorCommandSource);
- void performDelete();
+ void paste(CommandSource);
+ void pasteAsPlainText(CommandSource);
+ void performDelete(CommandSource);
static void countEvent(ExecutionContext*, const Event*);
void copyImage(const HitTestResult&);
- void transpose();
+ void transpose(CommandSource);
void respondToChangedContents(const VisibleSelection& endingSelection);
@@ -111,24 +111,32 @@ class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> {
TriState selectionHasStyle(CSSPropertyID, const String& value) const;
String selectionStartCSSPropertyValue(CSSPropertyID);
- void removeFormattingAndStyle();
+ void removeFormattingAndStyle(CommandSource);
void registerCommandGroup(CompositeEditCommand* commandGroupWrapper);
void clearLastEditCommand();
- bool deleteWithDirection(DeleteDirection,
+ bool deleteWithDirection(CommandSource,
+ DeleteDirection,
TextGranularity,
bool killRing,
bool isTypingAction);
void deleteSelectionWithSmartDelete(
+ CommandSource,
DeleteMode,
InputEvent::InputType,
const Position& referenceMovePosition = Position());
- void applyStyle(StylePropertySet*, InputEvent::InputType);
- void applyParagraphStyle(StylePropertySet*, InputEvent::InputType);
- void applyStyleToSelection(StylePropertySet*, InputEvent::InputType);
- void applyParagraphStyleToSelection(StylePropertySet*, InputEvent::InputType);
+ void applyStyle(CommandSource, StylePropertySet*, InputEvent::InputType);
+ void applyParagraphStyle(CommandSource,
+ StylePropertySet*,
+ InputEvent::InputType);
+ void applyStyleToSelection(CommandSource,
+ StylePropertySet*,
+ InputEvent::InputType);
+ void applyParagraphStyleToSelection(CommandSource,
+ StylePropertySet*,
+ InputEvent::InputType);
void appliedEditing(CompositeEditCommand*);
void unappliedEditing(EditCommandComposition*);
@@ -142,7 +150,7 @@ class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> {
public:
Command();
- Command(const EditorInternalCommand*, EditorCommandSource, LocalFrame*);
+ Command(const EditorInternalCommand*, CommandSource, LocalFrame*);
bool execute(const String& parameter = String(),
Event* triggeringEvent = nullptr) const;
@@ -170,13 +178,13 @@ class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> {
RangeVector* getTargetRanges() const;
const EditorInternalCommand* m_command;
- EditorCommandSource m_source;
+ CommandSource m_source;
Member<LocalFrame> m_frame;
};
- Command createCommand(
- const String&
- commandName); // Command source is CommandFromMenuOrKeyBinding.
- Command createCommand(const String& commandName, EditorCommandSource);
+ // Command source is |CommandSource::MenuOrKeyBinding|.
+ Command createCommand(const String& commandName);
+ // Command source is |CommandSource::DOM|.
+ Command createCommandFromDOM(const String& commandName);
// |Editor::executeCommand| is implementation of |WebFrame::executeCommand|
// rather than |Document::execCommand|.
@@ -184,7 +192,8 @@ class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> {
bool executeCommand(const String& commandName, const String& value);
bool insertText(const String&, KeyboardEvent* triggeringEvent);
- bool insertTextWithoutSendingTextEvent(const String&,
+ bool insertTextWithoutSendingTextEvent(CommandSource,
+ const String&,
bool selectInsertedText,
TextEvent* triggeringEvent);
bool insertLineBreak();
@@ -194,9 +203,9 @@ class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> {
void toggleOverwriteModeEnabled();
bool canUndo();
- void undo();
+ void undo(CommandSource);
bool canRedo();
- void redo();
+ void redo(CommandSource);
void setBaseWritingDirection(WritingDirection);
@@ -240,7 +249,9 @@ class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> {
const VisibleSelection& mark() const; // Mark, to be used as emacs uses it.
void setMark(const VisibleSelection&);
- void computeAndSetTypingStyle(StylePropertySet*, InputEvent::InputType);
+ void computeAndSetTypingStyle(CommandSource,
+ StylePropertySet*,
+ InputEvent::InputType);
// |firstRectForRange| requires up-to-date layout.
IntRect firstRectForRange(const EphemeralRange&) const;
@@ -251,12 +262,14 @@ class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> {
bool markedTextMatchesAreHighlighted() const;
void setMarkedTextMatchesAreHighlighted(bool);
- void replaceSelectionWithFragment(DocumentFragment*,
+ void replaceSelectionWithFragment(CommandSource,
+ DocumentFragment*,
bool selectReplacement,
bool smartReplace,
bool matchStyle,
InputEvent::InputType);
- void replaceSelectionWithText(const String&,
+ void replaceSelectionWithText(CommandSource,
+ const String&,
bool selectReplacement,
bool smartReplace,
InputEvent::InputType);

Powered by Google App Engine
This is Rietveld 408576698