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

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

Issue 2073643002: Use enum instead of "bool preserveSelection and bool preserveStyle" of moveParagraph() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 VisibleSelection m_startingSelection; 67 VisibleSelection m_startingSelection;
68 VisibleSelection m_endingSelection; 68 VisibleSelection m_endingSelection;
69 HeapVector<Member<SimpleEditCommand>> m_commands; 69 HeapVector<Member<SimpleEditCommand>> m_commands;
70 Member<Element> m_startingRootEditableElement; 70 Member<Element> m_startingRootEditableElement;
71 Member<Element> m_endingRootEditableElement; 71 Member<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 enum ShouldPreserveSelection { PreserveSelection, DoNotPreserveSelection };
78 enum ShouldPreserveStyle { PreserveStyle, DoNotPreserveStyle };
79
77 ~CompositeEditCommand() override; 80 ~CompositeEditCommand() override;
78 81
79 // Returns |false| if the command failed. e.g. It's aborted. 82 // Returns |false| if the command failed. e.g. It's aborted.
80 bool apply(); 83 bool apply();
81 bool isFirstCommand(EditCommand* command) { return !m_commands.isEmpty() && m_commands.first() == command; } 84 bool isFirstCommand(EditCommand* command) { return !m_commands.isEmpty() && m_commands.first() == command; }
82 EditCommandComposition* composition() { return m_composition.get(); } 85 EditCommandComposition* composition() { return m_composition.get(); }
83 EditCommandComposition* ensureComposition(); 86 EditCommandComposition* ensureComposition();
84 87
85 virtual bool isReplaceSelectionCommand() const; 88 virtual bool isReplaceSelectionCommand() const;
86 virtual bool isTypingCommand() const; 89 virtual bool isTypingCommand() const;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 HTMLBRElement* insertBlockPlaceholder(const Position&, EditingState*); 152 HTMLBRElement* insertBlockPlaceholder(const Position&, EditingState*);
150 HTMLBRElement* addBlockPlaceholderIfNeeded(Element*, EditingState*); 153 HTMLBRElement* addBlockPlaceholderIfNeeded(Element*, EditingState*);
151 void removePlaceholderAt(const Position&); 154 void removePlaceholderAt(const Position&);
152 155
153 HTMLElement* insertNewDefaultParagraphElementAt(const Position&, EditingStat e*); 156 HTMLElement* insertNewDefaultParagraphElementAt(const Position&, EditingStat e*);
154 157
155 HTMLElement* moveParagraphContentsToNewBlockIfNecessary(const Position&, Edi tingState*); 158 HTMLElement* moveParagraphContentsToNewBlockIfNecessary(const Position&, Edi tingState*);
156 159
157 void pushAnchorElementDown(Element*, EditingState*); 160 void pushAnchorElementDown(Element*, EditingState*);
158 161
159 // FIXME: preserveSelection and preserveStyle should be enums 162 void moveParagraph(const VisiblePosition&, const VisiblePosition&, const Vis iblePosition&, EditingState*, ShouldPreserveSelection = DoNotPreserveSelection, ShouldPreserveStyle = PreserveStyle, Node* constrainingAncestor = nullptr);
160 void moveParagraph(const VisiblePosition&, const VisiblePosition&, const Vis iblePosition&, EditingState*, bool preserveSelection = false, bool preserveStyle = true, Node* constrainingAncestor = nullptr); 163 void moveParagraphs(const VisiblePosition&, const VisiblePosition&, const Vi siblePosition&, EditingState*, ShouldPreserveSelection = DoNotPreserveSelection, ShouldPreserveStyle = PreserveStyle, Node* constrainingAncestor = nullptr);
161 void moveParagraphs(const VisiblePosition&, const VisiblePosition&, const Vi siblePosition&, EditingState*, bool preserveSelection = false, bool preserveStyl e = true, Node* constrainingAncestor = nullptr);
162 void moveParagraphWithClones(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, HTMLElement* blockElement, Node* ou terNode, EditingState*); 164 void moveParagraphWithClones(const VisiblePosition& startOfParagraphToMove, const VisiblePosition& endOfParagraphToMove, HTMLElement* blockElement, Node* ou terNode, EditingState*);
163 void cloneParagraphUnderNewElement(const Position& start, const Position& en d, Node* outerNode, Element* blockElement, EditingState*); 165 void cloneParagraphUnderNewElement(const Position& start, const Position& en d, Node* outerNode, Element* blockElement, EditingState*);
164 void cleanupAfterDeletion(EditingState*, VisiblePosition destination = Visib lePosition()); 166 void cleanupAfterDeletion(EditingState*, VisiblePosition destination = Visib lePosition());
165 167
166 bool breakOutOfEmptyListItem(EditingState*); 168 bool breakOutOfEmptyListItem(EditingState*);
167 bool breakOutOfEmptyMailBlockquotedParagraph(EditingState*); 169 bool breakOutOfEmptyMailBlockquotedParagraph(EditingState*);
168 170
169 Position positionAvoidingSpecialElementBoundary(const Position&, EditingStat e*); 171 Position positionAvoidingSpecialElementBoundary(const Position&, EditingStat e*);
170 172
171 Node* splitTreeToNode(Node*, Node*, bool splitAncestor = false); 173 Node* splitTreeToNode(Node*, Node*, bool splitAncestor = false);
172 174
173 HeapVector<Member<EditCommand>> m_commands; 175 HeapVector<Member<EditCommand>> m_commands;
174 176
175 private: 177 private:
176 bool isCompositeEditCommand() const final { return true; } 178 bool isCompositeEditCommand() const final { return true; }
177 179
178 Member<EditCommandComposition> m_composition; 180 Member<EditCommandComposition> m_composition;
179 }; 181 };
180 182
181 DEFINE_TYPE_CASTS(CompositeEditCommand, EditCommand, command, command->isComposi teEditCommand(), command.isCompositeEditCommand()); 183 DEFINE_TYPE_CASTS(CompositeEditCommand, EditCommand, command, command->isComposi teEditCommand(), command.isCompositeEditCommand());
182 184
183 } // namespace blink 185 } // namespace blink
184 186
185 #endif // CompositeEditCommand_h 187 #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