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

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

Issue 2583993002: [Editing] Introduce |CompositeEditCommand::willApplyEditing()| in prepare for 'beforeinput' (1/3) (Closed)
Patch Set: Created 4 years 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 virtual bool isDragAndDropCommand() const; 111 virtual bool isDragAndDropCommand() const;
112 virtual bool preservesTypingStyle() const; 112 virtual bool preservesTypingStyle() const;
113 virtual void setShouldRetainAutocorrectionIndicator(bool); 113 virtual void setShouldRetainAutocorrectionIndicator(bool);
114 virtual bool shouldStopCaretBlinking() const { return false; } 114 virtual bool shouldStopCaretBlinking() const { return false; }
115 115
116 DECLARE_VIRTUAL_TRACE(); 116 DECLARE_VIRTUAL_TRACE();
117 117
118 protected: 118 protected:
119 explicit CompositeEditCommand(Document&); 119 explicit CompositeEditCommand(Document&);
120 120
121 // Fires "beforeinput", returns |false| to cancel applying editing if
122 // * "beforeinput" was canceled, or
123 // * |frame| was destroyed by event handlers.
124 // |willApplyEditing()| should be called from
125 // * |CompositeEditCommand::willApply()|, and
126 // * |TypingCommand::willAddTypingToOpenCommand()|.
127 bool willApplyEditing(EditCommandSource);
Xiaocheng 2016/12/19 03:33:57 Please add a TODO: implementation note here since
chongz 2016/12/19 06:48:57 Will do.
chongz 2016/12/19 20:55:22 Done.
128
121 // 129 //
122 // sugary-sweet convenience functions to help create and apply edit commands 130 // sugary-sweet convenience functions to help create and apply edit commands
123 // in composite commands 131 // in composite commands
124 // 132 //
125 void appendNode(Node*, ContainerNode* parent, EditingState*); 133 void appendNode(Node*, ContainerNode* parent, EditingState*);
126 void applyCommandToComposite(EditCommand*, EditingState*); 134 void applyCommandToComposite(EditCommand*, EditingState*);
127 void applyCommandToComposite(CompositeEditCommand*, 135 void applyCommandToComposite(CompositeEditCommand*,
128 const VisibleSelection&, 136 const VisibleSelection&,
129 EditingState*); 137 EditingState*);
130 void applyStyle(const EditingStyle*, EditingState*); 138 void applyStyle(const EditingStyle*, EditingState*);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 bool breakOutOfEmptyMailBlockquotedParagraph(EditingState*); 266 bool breakOutOfEmptyMailBlockquotedParagraph(EditingState*);
259 267
260 Position positionAvoidingSpecialElementBoundary(const Position&, 268 Position positionAvoidingSpecialElementBoundary(const Position&,
261 EditingState*); 269 EditingState*);
262 270
263 Node* splitTreeToNode(Node*, Node*, bool splitAncestor = false); 271 Node* splitTreeToNode(Node*, Node*, bool splitAncestor = false);
264 272
265 HeapVector<Member<EditCommand>> m_commands; 273 HeapVector<Member<EditCommand>> m_commands;
266 274
267 private: 275 private:
276 // Returns |false| to cancel applying command.
277 bool willApply(EditCommandSource);
278
268 bool isCompositeEditCommand() const final { return true; } 279 bool isCompositeEditCommand() const final { return true; }
269 280
270 Member<EditCommandComposition> m_composition; 281 Member<EditCommandComposition> m_composition;
271 }; 282 };
272 283
273 DEFINE_TYPE_CASTS(CompositeEditCommand, 284 DEFINE_TYPE_CASTS(CompositeEditCommand,
274 EditCommand, 285 EditCommand,
275 command, 286 command,
276 command->isCompositeEditCommand(), 287 command->isCompositeEditCommand(),
277 command.isCompositeEditCommand()); 288 command.isCompositeEditCommand());
278 289
279 } // namespace blink 290 } // namespace blink
280 291
281 #endif // CompositeEditCommand_h 292 #endif // CompositeEditCommand_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698