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 26 matching lines...) Expand all Loading... |
37 class Element; | 37 class Element; |
38 class HTMLBRElement; | 38 class HTMLBRElement; |
39 class HTMLElement; | 39 class HTMLElement; |
40 class HTMLSpanElement; | 40 class HTMLSpanElement; |
41 class Text; | 41 class Text; |
42 | 42 |
43 class EditCommandComposition final : public UndoStep { | 43 class EditCommandComposition final : public UndoStep { |
44 public: | 44 public: |
45 static PassRefPtrWillBeRawPtr<EditCommandComposition> create(Document*, cons
t VisibleSelection&, const VisibleSelection&, EditAction); | 45 static PassRefPtrWillBeRawPtr<EditCommandComposition> create(Document*, cons
t VisibleSelection&, const VisibleSelection&, EditAction); |
46 | 46 |
47 virtual bool belongsTo(const LocalFrame&) const override; | 47 bool belongsTo(const LocalFrame&) const override; |
48 virtual void unapply() override; | 48 void unapply() override; |
49 virtual void reapply() override; | 49 void reapply() override; |
50 virtual EditAction editingAction() const override { return m_editAction; } | 50 EditAction editingAction() const override { return m_editAction; } |
51 void append(SimpleEditCommand*); | 51 void append(SimpleEditCommand*); |
52 | 52 |
53 const VisibleSelection& startingSelection() const { return m_startingSelecti
on; } | 53 const VisibleSelection& startingSelection() const { return m_startingSelecti
on; } |
54 const VisibleSelection& endingSelection() const { return m_endingSelection;
} | 54 const VisibleSelection& endingSelection() const { return m_endingSelection;
} |
55 void setStartingSelection(const VisibleSelection&); | 55 void setStartingSelection(const VisibleSelection&); |
56 void setEndingSelection(const VisibleSelection&); | 56 void setEndingSelection(const VisibleSelection&); |
57 Element* startingRootEditableElement() const { return m_startingRootEditable
Element.get(); } | 57 Element* startingRootEditableElement() const { return m_startingRootEditable
Element.get(); } |
58 Element* endingRootEditableElement() const { return m_endingRootEditableElem
ent.get(); } | 58 Element* endingRootEditableElement() const { return m_endingRootEditableElem
ent.get(); } |
59 | 59 |
60 DECLARE_VIRTUAL_TRACE(); | 60 DECLARE_VIRTUAL_TRACE(); |
61 | 61 |
62 private: | 62 private: |
63 EditCommandComposition(Document*, const VisibleSelection& startingSelection,
const VisibleSelection& endingSelection, EditAction); | 63 EditCommandComposition(Document*, const VisibleSelection& startingSelection,
const VisibleSelection& endingSelection, EditAction); |
64 | 64 |
65 RefPtrWillBeMember<Document> m_document; | 65 RefPtrWillBeMember<Document> m_document; |
66 VisibleSelection m_startingSelection; | 66 VisibleSelection m_startingSelection; |
67 VisibleSelection m_endingSelection; | 67 VisibleSelection m_endingSelection; |
68 WillBeHeapVector<RefPtrWillBeMember<SimpleEditCommand>> m_commands; | 68 WillBeHeapVector<RefPtrWillBeMember<SimpleEditCommand>> m_commands; |
69 RefPtrWillBeMember<Element> m_startingRootEditableElement; | 69 RefPtrWillBeMember<Element> m_startingRootEditableElement; |
70 RefPtrWillBeMember<Element> m_endingRootEditableElement; | 70 RefPtrWillBeMember<Element> m_endingRootEditableElement; |
71 EditAction m_editAction; | 71 EditAction m_editAction; |
72 }; | 72 }; |
73 | 73 |
74 class CompositeEditCommand : public EditCommand { | 74 class CompositeEditCommand : public EditCommand { |
75 public: | 75 public: |
76 virtual ~CompositeEditCommand(); | 76 ~CompositeEditCommand() override; |
77 | 77 |
78 void apply(); | 78 void apply(); |
79 bool isFirstCommand(EditCommand* command) { return !m_commands.isEmpty() &&
m_commands.first() == command; } | 79 bool isFirstCommand(EditCommand* command) { return !m_commands.isEmpty() &&
m_commands.first() == command; } |
80 EditCommandComposition* composition() { return m_composition.get(); } | 80 EditCommandComposition* composition() { return m_composition.get(); } |
81 EditCommandComposition* ensureComposition(); | 81 EditCommandComposition* ensureComposition(); |
82 | 82 |
83 virtual bool isTypingCommand() const; | 83 virtual bool isTypingCommand() const; |
84 virtual bool preservesTypingStyle() const; | 84 virtual bool preservesTypingStyle() const; |
85 virtual void setShouldRetainAutocorrectionIndicator(bool); | 85 virtual void setShouldRetainAutocorrectionIndicator(bool); |
86 virtual bool shouldStopCaretBlinking() const { return false; } | 86 virtual bool shouldStopCaretBlinking() const { return false; } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 bool breakOutOfEmptyListItem(); | 163 bool breakOutOfEmptyListItem(); |
164 bool breakOutOfEmptyMailBlockquotedParagraph(); | 164 bool breakOutOfEmptyMailBlockquotedParagraph(); |
165 | 165 |
166 Position positionAvoidingSpecialElementBoundary(const Position&); | 166 Position positionAvoidingSpecialElementBoundary(const Position&); |
167 | 167 |
168 PassRefPtrWillBeRawPtr<Node> splitTreeToNode(Node*, Node*, bool splitAncesto
r = false); | 168 PassRefPtrWillBeRawPtr<Node> splitTreeToNode(Node*, Node*, bool splitAncesto
r = false); |
169 | 169 |
170 WillBeHeapVector<RefPtrWillBeMember<EditCommand>> m_commands; | 170 WillBeHeapVector<RefPtrWillBeMember<EditCommand>> m_commands; |
171 | 171 |
172 private: | 172 private: |
173 virtual bool isCompositeEditCommand() const override final { return true; } | 173 bool isCompositeEditCommand() const final { return true; } |
174 | 174 |
175 RefPtrWillBeMember<EditCommandComposition> m_composition; | 175 RefPtrWillBeMember<EditCommandComposition> m_composition; |
176 }; | 176 }; |
177 | 177 |
178 DEFINE_TYPE_CASTS(CompositeEditCommand, EditCommand, command, command->isComposi
teEditCommand(), command.isCompositeEditCommand()); | 178 DEFINE_TYPE_CASTS(CompositeEditCommand, EditCommand, command, command->isComposi
teEditCommand(), command.isCompositeEditCommand()); |
179 | 179 |
180 } // namespace blink | 180 } // namespace blink |
181 | 181 |
182 #endif // CompositeEditCommand_h | 182 #endif // CompositeEditCommand_h |
OLD | NEW |