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

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

Issue 2637443002: Revert of [InputEvent] Remove unused |inputType()| from |UndoStep| and |EditCommandComposition| (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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 30 matching lines...) Expand all
41 class HTMLElement; 41 class HTMLElement;
42 class HTMLSpanElement; 42 class HTMLSpanElement;
43 class Text; 43 class Text;
44 44
45 enum class EditCommandSource { kMenuOrKeyBinding, kDOM }; 45 enum class EditCommandSource { kMenuOrKeyBinding, kDOM };
46 46
47 class EditCommandComposition final : public UndoStep { 47 class EditCommandComposition final : public UndoStep {
48 public: 48 public:
49 static EditCommandComposition* create(Document*, 49 static EditCommandComposition* create(Document*,
50 const VisibleSelection&, 50 const VisibleSelection&,
51 const VisibleSelection&); 51 const VisibleSelection&,
52 InputEvent::InputType);
52 53
53 bool belongsTo(const LocalFrame&) const override; 54 bool belongsTo(const LocalFrame&) const override;
54 void unapply(EditCommandSource) override; 55 void unapply(EditCommandSource) override;
55 void reapply(EditCommandSource) override; 56 void reapply(EditCommandSource) override;
57 InputEvent::InputType inputType() const override;
56 void append(SimpleEditCommand*); 58 void append(SimpleEditCommand*);
57 void append(EditCommandComposition*); 59 void append(EditCommandComposition*);
58 60
59 const VisibleSelection& startingSelection() const { 61 const VisibleSelection& startingSelection() const {
60 return m_startingSelection; 62 return m_startingSelection;
61 } 63 }
62 const VisibleSelection& endingSelection() const { return m_endingSelection; } 64 const VisibleSelection& endingSelection() const { return m_endingSelection; }
63 void setStartingSelection(const VisibleSelection&); 65 void setStartingSelection(const VisibleSelection&);
64 void setEndingSelection(const VisibleSelection&); 66 void setEndingSelection(const VisibleSelection&);
65 Element* startingRootEditableElement() const { 67 Element* startingRootEditableElement() const {
66 return m_startingRootEditableElement.get(); 68 return m_startingRootEditableElement.get();
67 } 69 }
68 Element* endingRootEditableElement() const { 70 Element* endingRootEditableElement() const {
69 return m_endingRootEditableElement.get(); 71 return m_endingRootEditableElement.get();
70 } 72 }
71 73
72 DECLARE_VIRTUAL_TRACE(); 74 DECLARE_VIRTUAL_TRACE();
73 75
74 private: 76 private:
75 EditCommandComposition(Document*, 77 EditCommandComposition(Document*,
76 const VisibleSelection& startingSelection, 78 const VisibleSelection& startingSelection,
77 const VisibleSelection& endingSelection); 79 const VisibleSelection& endingSelection,
80 InputEvent::InputType);
78 81
79 // TODO(chongz): Implement "beforeinput" as described below: 82 // TODO(chongz): Implement "beforeinput" as described below:
80 // Fires "beforeinput" and will returns |false| to cancel unapply / reapply if 83 // Fires "beforeinput" and will returns |false| to cancel unapply / reapply if
81 // * "beforeinput" was canceled, or 84 // * "beforeinput" was canceled, or
82 // * |frame| was destroyed by event handlers. 85 // * |frame| was destroyed by event handlers.
83 // Note: Undo stack will always get popped. 86 // Note: Undo stack will always get popped.
84 bool willUnapply(EditCommandSource); 87 bool willUnapply(EditCommandSource);
85 bool willReapply(EditCommandSource); 88 bool willReapply(EditCommandSource);
86 89
87 Member<Document> m_document; 90 Member<Document> m_document;
88 VisibleSelection m_startingSelection; 91 VisibleSelection m_startingSelection;
89 VisibleSelection m_endingSelection; 92 VisibleSelection m_endingSelection;
90 HeapVector<Member<SimpleEditCommand>> m_commands; 93 HeapVector<Member<SimpleEditCommand>> m_commands;
91 Member<Element> m_startingRootEditableElement; 94 Member<Element> m_startingRootEditableElement;
92 Member<Element> m_endingRootEditableElement; 95 Member<Element> m_endingRootEditableElement;
96 InputEvent::InputType m_inputType;
93 }; 97 };
94 98
95 class CORE_EXPORT CompositeEditCommand : public EditCommand { 99 class CORE_EXPORT CompositeEditCommand : public EditCommand {
96 public: 100 public:
97 enum ShouldPreserveSelection { PreserveSelection, DoNotPreserveSelection }; 101 enum ShouldPreserveSelection { PreserveSelection, DoNotPreserveSelection };
98 enum ShouldPreserveStyle { PreserveStyle, DoNotPreserveStyle }; 102 enum ShouldPreserveStyle { PreserveStyle, DoNotPreserveStyle };
99 103
100 ~CompositeEditCommand() override; 104 ~CompositeEditCommand() override;
101 105
102 // Returns |false| if the command failed. e.g. It's aborted. 106 // Returns |false| if the command failed. e.g. It's aborted.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 289
286 DEFINE_TYPE_CASTS(CompositeEditCommand, 290 DEFINE_TYPE_CASTS(CompositeEditCommand,
287 EditCommand, 291 EditCommand,
288 command, 292 command,
289 command->isCompositeEditCommand(), 293 command->isCompositeEditCommand(),
290 command.isCompositeEditCommand()); 294 command.isCompositeEditCommand());
291 295
292 } // namespace blink 296 } // namespace blink
293 297
294 #endif // CompositeEditCommand_h 298 #endif // CompositeEditCommand_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698