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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 24 matching lines...) Expand all
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 RawPtr<EditCommandComposition> create(Document*, const VisibleSelecti on&, const VisibleSelection&, EditAction);
46 46
47 bool belongsTo(const LocalFrame&) const override; 47 bool belongsTo(const LocalFrame&) const override;
48 void unapply() override; 48 void unapply() override;
49 void reapply() override; 49 void reapply() override;
50 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 Member<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 HeapVector<Member<SimpleEditCommand>> m_commands;
69 RefPtrWillBeMember<Element> m_startingRootEditableElement; 69 Member<Element> m_startingRootEditableElement;
70 RefPtrWillBeMember<Element> m_endingRootEditableElement; 70 Member<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 ~CompositeEditCommand() override; 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 isReplaceSelectionCommand() const; 83 virtual bool isReplaceSelectionCommand() const;
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 DECLARE_VIRTUAL_TRACE(); 89 DECLARE_VIRTUAL_TRACE();
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(RawPtr<Node>, RawPtr<ContainerNode> parent);
98 void applyCommandToComposite(PassRefPtrWillBeRawPtr<EditCommand>); 98 void applyCommandToComposite(RawPtr<EditCommand>);
99 void applyCommandToComposite(PassRefPtrWillBeRawPtr<CompositeEditCommand>, c onst VisibleSelection&); 99 void applyCommandToComposite(RawPtr<CompositeEditCommand>, const VisibleSele ction&);
100 void applyStyle(const EditingStyle*, EditAction = EditActionChangeAttributes ); 100 void applyStyle(const EditingStyle*, EditAction = EditActionChangeAttributes );
101 void applyStyle(const EditingStyle*, const Position& start, const Position& end, EditAction = EditActionChangeAttributes); 101 void applyStyle(const EditingStyle*, const Position& start, const Position& end, EditAction = EditActionChangeAttributes);
102 void applyStyledElement(PassRefPtrWillBeRawPtr<Element>); 102 void applyStyledElement(RawPtr<Element>);
103 void removeStyledElement(PassRefPtrWillBeRawPtr<Element>); 103 void removeStyledElement(RawPtr<Element>);
104 void deleteSelection(bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool expandForSpecialElements = true, bool sanitizeMarkup = true); 104 void deleteSelection(bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool expandForSpecialElements = true, bool sanitizeMarkup = true);
105 void deleteSelection(const VisibleSelection&, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool expandForSpecialElements = true, bool sanit izeMarkup = true); 105 void deleteSelection(const VisibleSelection&, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool expandForSpecialElements = true, bool sanit izeMarkup = true);
106 virtual void deleteTextFromNode(PassRefPtrWillBeRawPtr<Text>, unsigned offse t, unsigned count); 106 virtual void deleteTextFromNode(RawPtr<Text>, unsigned offset, unsigned coun t);
107 bool isRemovableBlock(const Node*); 107 bool isRemovableBlock(const Node*);
108 void insertNodeAfter(PassRefPtrWillBeRawPtr<Node>, PassRefPtrWillBeRawPtr<No de> refChild); 108 void insertNodeAfter(RawPtr<Node>, RawPtr<Node> refChild);
109 void insertNodeAt(PassRefPtrWillBeRawPtr<Node>, const Position&); 109 void insertNodeAt(RawPtr<Node>, const Position&);
110 void insertNodeAtTabSpanPosition(PassRefPtrWillBeRawPtr<Node>, const Positio n&); 110 void insertNodeAtTabSpanPosition(RawPtr<Node>, const Position&);
111 void insertNodeBefore(PassRefPtrWillBeRawPtr<Node>, PassRefPtrWillBeRawPtr<N ode> refChild, ShouldAssumeContentIsAlwaysEditable = DoNotAssumeContentIsAlwaysE ditable); 111 void insertNodeBefore(RawPtr<Node>, RawPtr<Node> refChild, ShouldAssumeConte ntIsAlwaysEditable = DoNotAssumeContentIsAlwaysEditable);
112 void insertParagraphSeparator(bool useDefaultParagraphElement = false, bool pasteBlockqutoeIntoUnquotedArea = false); 112 void insertParagraphSeparator(bool useDefaultParagraphElement = false, bool pasteBlockqutoeIntoUnquotedArea = false);
113 void insertTextIntoNode(PassRefPtrWillBeRawPtr<Text>, unsigned offset, const String& text); 113 void insertTextIntoNode(RawPtr<Text>, unsigned offset, const String& text);
114 void mergeIdenticalElements(PassRefPtrWillBeRawPtr<Element>, PassRefPtrWillB eRawPtr<Element>); 114 void mergeIdenticalElements(RawPtr<Element>, RawPtr<Element>);
115 void rebalanceWhitespace(); 115 void rebalanceWhitespace();
116 void rebalanceWhitespaceAt(const Position&); 116 void rebalanceWhitespaceAt(const Position&);
117 void rebalanceWhitespaceOnTextSubstring(PassRefPtrWillBeRawPtr<Text>, int st artOffset, int endOffset); 117 void rebalanceWhitespaceOnTextSubstring(RawPtr<Text>, int startOffset, int e ndOffset);
118 void prepareWhitespaceAtPositionForSplit(Position&); 118 void prepareWhitespaceAtPositionForSplit(Position&);
119 void replaceCollapsibleWhitespaceWithNonBreakingSpaceIfNeeded(const VisibleP osition&); 119 void replaceCollapsibleWhitespaceWithNonBreakingSpaceIfNeeded(const VisibleP osition&);
120 bool canRebalance(const Position&) const; 120 bool canRebalance(const Position&) const;
121 bool shouldRebalanceLeadingWhitespaceFor(const String&) const; 121 bool shouldRebalanceLeadingWhitespaceFor(const String&) const;
122 void removeCSSProperty(PassRefPtrWillBeRawPtr<Element>, CSSPropertyID); 122 void removeCSSProperty(RawPtr<Element>, CSSPropertyID);
123 void removeElementAttribute(PassRefPtrWillBeRawPtr<Element>, const Qualified Name& attribute); 123 void removeElementAttribute(RawPtr<Element>, const QualifiedName& attribute) ;
124 void removeChildrenInRange(PassRefPtrWillBeRawPtr<Node>, unsigned from, unsi gned to); 124 void removeChildrenInRange(RawPtr<Node>, unsigned from, unsigned to);
125 virtual void removeNode(PassRefPtrWillBeRawPtr<Node>, ShouldAssumeContentIsA lwaysEditable = DoNotAssumeContentIsAlwaysEditable); 125 virtual void removeNode(RawPtr<Node>, ShouldAssumeContentIsAlwaysEditable = DoNotAssumeContentIsAlwaysEditable);
126 HTMLSpanElement* replaceElementWithSpanPreservingChildrenAndAttributes(PassR efPtrWillBeRawPtr<HTMLElement>); 126 HTMLSpanElement* replaceElementWithSpanPreservingChildrenAndAttributes(RawPt r<HTMLElement>);
127 void removeNodePreservingChildren(PassRefPtrWillBeRawPtr<Node>, ShouldAssume ContentIsAlwaysEditable = DoNotAssumeContentIsAlwaysEditable); 127 void removeNodePreservingChildren(RawPtr<Node>, ShouldAssumeContentIsAlwaysE ditable = DoNotAssumeContentIsAlwaysEditable);
128 void removeNodeAndPruneAncestors(PassRefPtrWillBeRawPtr<Node>, Node* exclude Node = nullptr); 128 void removeNodeAndPruneAncestors(RawPtr<Node>, Node* excludeNode = nullptr);
129 void moveRemainingSiblingsToNewParent(Node*, Node* pastLastNodeToMove, PassR efPtrWillBeRawPtr<Element> prpNewParent); 129 void moveRemainingSiblingsToNewParent(Node*, Node* pastLastNodeToMove, RawPt r<Element> prpNewParent);
130 void updatePositionForNodeRemovalPreservingChildren(Position&, Node&); 130 void updatePositionForNodeRemovalPreservingChildren(Position&, Node&);
131 void prune(PassRefPtrWillBeRawPtr<Node>, Node* excludeNode = nullptr); 131 void prune(RawPtr<Node>, Node* excludeNode = nullptr);
132 void replaceTextInNode(PassRefPtrWillBeRawPtr<Text>, unsigned offset, unsign ed count, const String& replacementText); 132 void replaceTextInNode(RawPtr<Text>, unsigned offset, unsigned count, const String& replacementText);
133 Position replaceSelectedTextInNode(const String&); 133 Position replaceSelectedTextInNode(const String&);
134 void replaceTextInNodePreservingMarkers(PassRefPtrWillBeRawPtr<Text>, unsign ed offset, unsigned count, const String& replacementText); 134 void replaceTextInNodePreservingMarkers(RawPtr<Text>, unsigned offset, unsig ned count, const String& replacementText);
135 Position positionOutsideTabSpan(const Position&); 135 Position positionOutsideTabSpan(const Position&);
136 void setNodeAttribute(PassRefPtrWillBeRawPtr<Element>, const QualifiedName& attribute, const AtomicString& value); 136 void setNodeAttribute(RawPtr<Element>, const QualifiedName& attribute, const AtomicString& value);
137 void splitElement(PassRefPtrWillBeRawPtr<Element>, PassRefPtrWillBeRawPtr<No de> atChild); 137 void splitElement(RawPtr<Element>, RawPtr<Node> atChild);
138 void splitTextNode(PassRefPtrWillBeRawPtr<Text>, unsigned offset); 138 void splitTextNode(RawPtr<Text>, unsigned offset);
139 void splitTextNodeContainingElement(PassRefPtrWillBeRawPtr<Text>, unsigned o ffset); 139 void splitTextNodeContainingElement(RawPtr<Text>, unsigned offset);
140 void wrapContentsInDummySpan(PassRefPtrWillBeRawPtr<Element>); 140 void wrapContentsInDummySpan(RawPtr<Element>);
141 141
142 void deleteInsignificantText(PassRefPtrWillBeRawPtr<Text>, unsigned start, u nsigned end); 142 void deleteInsignificantText(RawPtr<Text>, unsigned start, unsigned end);
143 void deleteInsignificantText(const Position& start, const Position& end); 143 void deleteInsignificantText(const Position& start, const Position& end);
144 void deleteInsignificantTextDownstream(const Position&); 144 void deleteInsignificantTextDownstream(const Position&);
145 145
146 PassRefPtrWillBeRawPtr<HTMLBRElement> appendBlockPlaceholder(PassRefPtrWillB eRawPtr<Element>); 146 RawPtr<HTMLBRElement> appendBlockPlaceholder(RawPtr<Element>);
147 PassRefPtrWillBeRawPtr<HTMLBRElement> insertBlockPlaceholder(const Position& ); 147 RawPtr<HTMLBRElement> insertBlockPlaceholder(const Position&);
148 PassRefPtrWillBeRawPtr<HTMLBRElement> addBlockPlaceholderIfNeeded(Element*); 148 RawPtr<HTMLBRElement> addBlockPlaceholderIfNeeded(Element*);
149 void removePlaceholderAt(const Position&); 149 void removePlaceholderAt(const Position&);
150 150
151 PassRefPtrWillBeRawPtr<HTMLElement> insertNewDefaultParagraphElementAt(const Position&); 151 RawPtr<HTMLElement> insertNewDefaultParagraphElementAt(const Position&);
152 152
153 PassRefPtrWillBeRawPtr<HTMLElement> moveParagraphContentsToNewBlockIfNecessa ry(const Position&); 153 RawPtr<HTMLElement> moveParagraphContentsToNewBlockIfNecessary(const Positio n&);
154 154
155 void pushAnchorElementDown(Element*); 155 void pushAnchorElementDown(Element*);
156 156
157 // FIXME: preserveSelection and preserveStyle should be enums 157 // FIXME: preserveSelection and preserveStyle should be enums
158 void moveParagraph(const VisiblePosition&, const VisiblePosition&, const Vis iblePosition&, bool preserveSelection = false, bool preserveStyle = true, Node* constrainingAncestor = nullptr); 158 void moveParagraph(const VisiblePosition&, const VisiblePosition&, const Vis iblePosition&, bool preserveSelection = false, bool preserveStyle = true, Node* constrainingAncestor = nullptr);
159 void moveParagraphs(const VisiblePosition&, const VisiblePosition&, const Vi siblePosition&, bool preserveSelection = false, bool preserveStyle = true, Node* constrainingAncestor = nullptr); 159 void moveParagraphs(const VisiblePosition&, const VisiblePosition&, const Vi siblePosition&, bool preserveSelection = false, bool preserveStyle = true, Node* constrainingAncestor = nullptr);
160 void moveParagraphWithClones(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, HTMLElement* blockElement, Node* ou terNode); 160 void moveParagraphWithClones(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, HTMLElement* blockElement, Node* ou terNode);
161 void cloneParagraphUnderNewElement(const Position& start, const Position& en d, Node* outerNode, Element* blockElement); 161 void cloneParagraphUnderNewElement(const Position& start, const Position& en d, Node* outerNode, Element* blockElement);
162 void cleanupAfterDeletion(VisiblePosition destination = VisiblePosition()); 162 void cleanupAfterDeletion(VisiblePosition destination = VisiblePosition());
163 163
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 RawPtr<Node> splitTreeToNode(Node*, Node*, bool splitAncestor = false);
170 170
171 WillBeHeapVector<RefPtrWillBeMember<EditCommand>> m_commands; 171 HeapVector<Member<EditCommand>> m_commands;
172 172
173 private: 173 private:
174 bool isCompositeEditCommand() const final { return true; } 174 bool isCompositeEditCommand() const final { return true; }
175 175
176 RefPtrWillBeMember<EditCommandComposition> m_composition; 176 Member<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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698