OLD | NEW |
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 Loading... |
41 SelectReplacement = 1 << 0, | 41 SelectReplacement = 1 << 0, |
42 SmartReplace = 1 << 1, | 42 SmartReplace = 1 << 1, |
43 MatchStyle = 1 << 2, | 43 MatchStyle = 1 << 2, |
44 PreventNesting = 1 << 3, | 44 PreventNesting = 1 << 3, |
45 MovingParagraph = 1 << 4, | 45 MovingParagraph = 1 << 4, |
46 SanitizeFragment = 1 << 5 | 46 SanitizeFragment = 1 << 5 |
47 }; | 47 }; |
48 | 48 |
49 typedef unsigned CommandOptions; | 49 typedef unsigned CommandOptions; |
50 | 50 |
51 static ReplaceSelectionCommand* create(Document& document, DocumentFragment*
fragment, CommandOptions options, EditAction action = EditActionPaste) | 51 static ReplaceSelectionCommand* create(Document& document, DocumentFragment*
fragment, CommandOptions options, InputEvent::InputType inputType = InputEvent:
:InputType::Paste) |
52 { | 52 { |
53 return new ReplaceSelectionCommand(document, fragment, options, action); | 53 return new ReplaceSelectionCommand(document, fragment, options, inputTyp
e); |
54 } | 54 } |
55 | 55 |
56 EphemeralRange insertedRange() const; | 56 EphemeralRange insertedRange() const; |
57 | 57 |
58 DECLARE_VIRTUAL_TRACE(); | 58 DECLARE_VIRTUAL_TRACE(); |
59 | 59 |
60 private: | 60 private: |
61 ReplaceSelectionCommand(Document&, DocumentFragment*, CommandOptions, EditAc
tion); | 61 ReplaceSelectionCommand(Document&, DocumentFragment*, CommandOptions, InputE
vent::InputType); |
62 | 62 |
63 void doApply(EditingState*) override; | 63 void doApply(EditingState*) override; |
64 EditAction editingAction() const override; | 64 InputEvent::InputType inputType() const override; |
65 bool isReplaceSelectionCommand() const override; | 65 bool isReplaceSelectionCommand() const override; |
66 | 66 |
67 class InsertedNodes { | 67 class InsertedNodes { |
68 STACK_ALLOCATED(); | 68 STACK_ALLOCATED(); |
69 public: | 69 public: |
70 void respondToNodeInsertion(Node&); | 70 void respondToNodeInsertion(Node&); |
71 void willRemoveNodePreservingChildren(Node&); | 71 void willRemoveNodePreservingChildren(Node&); |
72 void willRemoveNode(Node&); | 72 void willRemoveNode(Node&); |
73 void didReplaceNode(Node&, Node& newNode); | 73 void didReplaceNode(Node&, Node& newNode); |
74 | 74 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 Position m_startOfInsertedContent; | 112 Position m_startOfInsertedContent; |
113 Position m_endOfInsertedContent; | 113 Position m_endOfInsertedContent; |
114 Member<EditingStyle> m_insertionStyle; | 114 Member<EditingStyle> m_insertionStyle; |
115 bool m_selectReplacement; | 115 bool m_selectReplacement; |
116 bool m_smartReplace; | 116 bool m_smartReplace; |
117 bool m_matchStyle; | 117 bool m_matchStyle; |
118 Member<DocumentFragment> m_documentFragment; | 118 Member<DocumentFragment> m_documentFragment; |
119 bool m_preventNesting; | 119 bool m_preventNesting; |
120 bool m_movingParagraph; | 120 bool m_movingParagraph; |
121 EditAction m_editAction; | 121 InputEvent::InputType m_inputType; |
122 bool m_sanitizeFragment; | 122 bool m_sanitizeFragment; |
123 bool m_shouldMergeEnd; | 123 bool m_shouldMergeEnd; |
124 | 124 |
125 Position m_startOfInsertedRange; | 125 Position m_startOfInsertedRange; |
126 Position m_endOfInsertedRange; | 126 Position m_endOfInsertedRange; |
127 }; | 127 }; |
128 | 128 |
129 DEFINE_TYPE_CASTS(ReplaceSelectionCommand, CompositeEditCommand, command, comman
d->isReplaceSelectionCommand(), command.isReplaceSelectionCommand()); | 129 DEFINE_TYPE_CASTS(ReplaceSelectionCommand, CompositeEditCommand, command, comman
d->isReplaceSelectionCommand(), command.isReplaceSelectionCommand()); |
130 | 130 |
131 } // namespace blink | 131 } // namespace blink |
132 | 132 |
133 #endif // ReplaceSelectionCommand_h | 133 #endif // ReplaceSelectionCommand_h |
OLD | NEW |