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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class EditingStyle; | 36 class EditingStyle; |
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 virtual bool belongsTo(const LocalFrame&) const override; |
48 virtual void unapply() OVERRIDE; | 48 virtual void unapply() override; |
49 virtual void reapply() OVERRIDE; | 49 virtual void reapply() override; |
50 virtual EditAction editingAction() const OVERRIDE { return m_editAction; } | 50 virtual EditAction editingAction() const override { return m_editAction; } |
51 void append(SimpleEditCommand*); | 51 void append(SimpleEditCommand*); |
52 bool wasCreateLinkCommand() const { return m_editAction == EditActionCreateL
ink; } | 52 bool wasCreateLinkCommand() const { return m_editAction == EditActionCreateL
ink; } |
53 | 53 |
54 const VisibleSelection& startingSelection() const { return m_startingSelecti
on; } | 54 const VisibleSelection& startingSelection() const { return m_startingSelecti
on; } |
55 const VisibleSelection& endingSelection() const { return m_endingSelection;
} | 55 const VisibleSelection& endingSelection() const { return m_endingSelection;
} |
56 void setStartingSelection(const VisibleSelection&); | 56 void setStartingSelection(const VisibleSelection&); |
57 void setEndingSelection(const VisibleSelection&); | 57 void setEndingSelection(const VisibleSelection&); |
58 Element* startingRootEditableElement() const { return m_startingRootEditable
Element.get(); } | 58 Element* startingRootEditableElement() const { return m_startingRootEditable
Element.get(); } |
59 Element* endingRootEditableElement() const { return m_endingRootEditableElem
ent.get(); } | 59 Element* endingRootEditableElement() const { return m_endingRootEditableElem
ent.get(); } |
60 | 60 |
61 virtual void trace(Visitor*) OVERRIDE; | 61 virtual void trace(Visitor*) override; |
62 | 62 |
63 private: | 63 private: |
64 EditCommandComposition(Document*, const VisibleSelection& startingSelection,
const VisibleSelection& endingSelection, EditAction); | 64 EditCommandComposition(Document*, const VisibleSelection& startingSelection,
const VisibleSelection& endingSelection, EditAction); |
65 | 65 |
66 RefPtrWillBeMember<Document> m_document; | 66 RefPtrWillBeMember<Document> m_document; |
67 VisibleSelection m_startingSelection; | 67 VisibleSelection m_startingSelection; |
68 VisibleSelection m_endingSelection; | 68 VisibleSelection m_endingSelection; |
69 WillBeHeapVector<RefPtrWillBeMember<SimpleEditCommand> > m_commands; | 69 WillBeHeapVector<RefPtrWillBeMember<SimpleEditCommand> > m_commands; |
70 RefPtrWillBeMember<Element> m_startingRootEditableElement; | 70 RefPtrWillBeMember<Element> m_startingRootEditableElement; |
71 RefPtrWillBeMember<Element> m_endingRootEditableElement; | 71 RefPtrWillBeMember<Element> m_endingRootEditableElement; |
72 EditAction m_editAction; | 72 EditAction m_editAction; |
73 }; | 73 }; |
74 | 74 |
75 class CompositeEditCommand : public EditCommand { | 75 class CompositeEditCommand : public EditCommand { |
76 public: | 76 public: |
77 virtual ~CompositeEditCommand(); | 77 virtual ~CompositeEditCommand(); |
78 | 78 |
79 void apply(); | 79 void apply(); |
80 bool isFirstCommand(EditCommand* command) { return !m_commands.isEmpty() &&
m_commands.first() == command; } | 80 bool isFirstCommand(EditCommand* command) { return !m_commands.isEmpty() &&
m_commands.first() == command; } |
81 EditCommandComposition* composition() { return m_composition.get(); } | 81 EditCommandComposition* composition() { return m_composition.get(); } |
82 EditCommandComposition* ensureComposition(); | 82 EditCommandComposition* ensureComposition(); |
83 | 83 |
84 virtual bool isTypingCommand() const; | 84 virtual bool isTypingCommand() const; |
85 virtual bool preservesTypingStyle() const; | 85 virtual bool preservesTypingStyle() const; |
86 virtual void setShouldRetainAutocorrectionIndicator(bool); | 86 virtual void setShouldRetainAutocorrectionIndicator(bool); |
87 virtual bool shouldStopCaretBlinking() const { return false; } | 87 virtual bool shouldStopCaretBlinking() const { return false; } |
88 | 88 |
89 virtual void trace(Visitor*) OVERRIDE; | 89 virtual void trace(Visitor*) override; |
90 | 90 |
91 protected: | 91 protected: |
92 explicit CompositeEditCommand(Document&); | 92 explicit CompositeEditCommand(Document&); |
93 | 93 |
94 // | 94 // |
95 // sugary-sweet convenience functions to help create and apply edit commands
in composite commands | 95 // sugary-sweet convenience functions to help create and apply edit commands
in composite commands |
96 // | 96 // |
97 void appendNode(PassRefPtrWillBeRawPtr<Node>, PassRefPtrWillBeRawPtr<Contain
erNode> parent); | 97 void appendNode(PassRefPtrWillBeRawPtr<Node>, PassRefPtrWillBeRawPtr<Contain
erNode> parent); |
98 void applyCommandToComposite(PassRefPtrWillBeRawPtr<EditCommand>); | 98 void applyCommandToComposite(PassRefPtrWillBeRawPtr<EditCommand>); |
99 void applyCommandToComposite(PassRefPtrWillBeRawPtr<CompositeEditCommand>, c
onst VisibleSelection&); | 99 void applyCommandToComposite(PassRefPtrWillBeRawPtr<CompositeEditCommand>, c
onst VisibleSelection&); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 bool breakOutOfEmptyListItem(); | 164 bool breakOutOfEmptyListItem(); |
165 bool breakOutOfEmptyMailBlockquotedParagraph(); | 165 bool breakOutOfEmptyMailBlockquotedParagraph(); |
166 | 166 |
167 Position positionAvoidingSpecialElementBoundary(const Position&); | 167 Position positionAvoidingSpecialElementBoundary(const Position&); |
168 | 168 |
169 PassRefPtrWillBeRawPtr<Node> splitTreeToNode(Node*, Node*, bool splitAncesto
r = false); | 169 PassRefPtrWillBeRawPtr<Node> splitTreeToNode(Node*, Node*, bool splitAncesto
r = false); |
170 | 170 |
171 WillBeHeapVector<RefPtrWillBeMember<EditCommand> > m_commands; | 171 WillBeHeapVector<RefPtrWillBeMember<EditCommand> > m_commands; |
172 | 172 |
173 private: | 173 private: |
174 virtual bool isCompositeEditCommand() const OVERRIDE FINAL { return true; } | 174 virtual bool isCompositeEditCommand() const override final { return true; } |
175 | 175 |
176 RefPtrWillBeMember<EditCommandComposition> m_composition; | 176 RefPtrWillBeMember<EditCommandComposition> m_composition; |
177 }; | 177 }; |
178 | 178 |
179 DEFINE_TYPE_CASTS(CompositeEditCommand, EditCommand, command, command->isComposi
teEditCommand(), command.isCompositeEditCommand()); | 179 DEFINE_TYPE_CASTS(CompositeEditCommand, EditCommand, command, command->isComposi
teEditCommand(), command.isCompositeEditCommand()); |
180 | 180 |
181 } // namespace blink | 181 } // namespace blink |
182 | 182 |
183 #endif // CompositeEditCommand_h | 183 #endif // CompositeEditCommand_h |
OLD | NEW |