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

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

Issue 2639913002: Move class EditCommandComposition to UndoStep.h/cpp (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/UndoStep.h
diff --git a/third_party/WebKit/Source/core/editing/commands/UndoStep.h b/third_party/WebKit/Source/core/editing/commands/UndoStep.h
index 9ee7497a345c1ee6198fe887ad1d66d1bd091113..62b5eab96f6b4c3c4a215e684b11165f18c6f3a8 100644
--- a/third_party/WebKit/Source/core/editing/commands/UndoStep.h
+++ b/third_party/WebKit/Source/core/editing/commands/UndoStep.h
@@ -31,11 +31,16 @@
#ifndef UndoStep_h
#define UndoStep_h
+#include "core/editing/VisibleSelection.h"
#include "core/events/InputEvent.h"
#include "platform/heap/Handle.h"
namespace blink {
+class SimpleEditCommand;
+
+// TODO(xiaochengh): Get rid of this interface, and then rename
+// |EditCommandComposition| to |UndoStep|.
class UndoStep : public GarbageCollectedFinalized<UndoStep> {
public:
virtual ~UndoStep() {}
@@ -46,6 +51,49 @@ class UndoStep : public GarbageCollectedFinalized<UndoStep> {
virtual InputEvent::InputType inputType() const = 0;
};
+class EditCommandComposition final : public UndoStep {
+ public:
+ static EditCommandComposition* create(Document*,
+ const VisibleSelection&,
+ const VisibleSelection&,
+ InputEvent::InputType);
+
+ void unapply() override;
+ void reapply() override;
+ InputEvent::InputType inputType() const override;
+ void append(SimpleEditCommand*);
+ void append(EditCommandComposition*);
+
+ const VisibleSelection& startingSelection() const {
+ return m_startingSelection;
+ }
+ const VisibleSelection& endingSelection() const { return m_endingSelection; }
+ void setStartingSelection(const VisibleSelection&);
+ void setEndingSelection(const VisibleSelection&);
+ Element* startingRootEditableElement() const {
+ return m_startingRootEditableElement.get();
+ }
+ Element* endingRootEditableElement() const {
+ return m_endingRootEditableElement.get();
+ }
+
+ DECLARE_VIRTUAL_TRACE();
+
+ private:
+ EditCommandComposition(Document*,
+ const VisibleSelection& startingSelection,
+ const VisibleSelection& endingSelection,
+ InputEvent::InputType);
+
+ Member<Document> m_document;
+ VisibleSelection m_startingSelection;
+ VisibleSelection m_endingSelection;
+ HeapVector<Member<SimpleEditCommand>> m_commands;
+ Member<Element> m_startingRootEditableElement;
+ Member<Element> m_endingRootEditableElement;
+ InputEvent::InputType m_inputType;
+};
+
} // namespace blink
#endif

Powered by Google App Engine
This is Rietveld 408576698