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

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

Issue 2576903002: [EditCommandSource] Pass source from |Editor::Command| to |Editor::apply*()/insert*()/...| (2/3) (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 ad6ae5d9d47a244221214b480dfbfd742e0cdd6a..9094397086874d6487cfac16934dec90f9c5f07d 100644
--- a/third_party/WebKit/Source/core/editing/Editor.h
+++ b/third_party/WebKit/Source/core/editing/Editor.h
@@ -34,6 +34,7 @@
#include "core/editing/FrameSelection.h"
#include "core/editing/VisibleSelection.h"
#include "core/editing/WritingDirection.h"
+#include "core/editing/commands/CompositeEditCommand.h"
#include "core/editing/iterators/TextIterator.h"
#include "core/editing/markers/DocumentMarker.h"
#include "core/events/InputEvent.h"
@@ -98,12 +99,12 @@ class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> {
void copy();
void paste(CommandSource);
void pasteAsPlainText(CommandSource);
- void performDelete();
+ 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 +112,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*);
@@ -184,7 +193,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 +204,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 +250,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,15 +263,18 @@ 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&,
- bool selectReplacement,
- bool smartReplace,
- InputEvent::InputType);
+ void replaceSelectionWithText(
+ const String&,
+ bool selectReplacement,
+ bool smartReplace,
+ InputEvent::InputType,
+ CommandSource = CommandSource::MenuOrKeyBinding);
Xiaocheng 2016/12/15 03:27:50 I'm not a fan of this... Since the troublemaker i
Xiaocheng 2016/12/15 05:38:21 Implementation of WebLocalFrameImpl::replaceSelect
chongz 2016/12/16 00:45:22 Rebased and removed default parameter.
// TODO(xiaochengh): Replace |bool| parameters by |enum|.
void replaceSelectionAfterDragging(DocumentFragment*,
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | third_party/WebKit/Source/core/editing/Editor.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698