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

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

Issue 2618583003: [InputEvent] Add 'beforeinput' logic in |will*()| and guarded by a flag (3/11) (Closed)
Patch Set: Change target to |startingRootEditableElement()| Created 3 years, 11 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return m_endingRootEditableElement.get(); 73 return m_endingRootEditableElement.get();
74 } 74 }
75 75
76 DECLARE_VIRTUAL_TRACE(); 76 DECLARE_VIRTUAL_TRACE();
77 77
78 private: 78 private:
79 EditCommandComposition(Document*, 79 EditCommandComposition(Document*,
80 const VisibleSelection& startingSelection, 80 const VisibleSelection& startingSelection,
81 const VisibleSelection& endingSelection); 81 const VisibleSelection& endingSelection);
82 82
83 // TODO(chongz): Implement "beforeinput" as described below: 83 // Fires "beforeinput" if |BeforeInputTiming == kShouldFireInCommand|.
84 // Fires "beforeinput" and will returns |false| to cancel unapply / reapply if 84 // Will return |false| to cancel unapply / reapply if
85 // * "beforeinput" was canceled, or 85 // * "beforeinput" was canceled, or
86 // * |frame| was destroyed by event handlers. 86 // * |frame| was destroyed by event handlers.
87 // Note: Undo stack will always get popped. 87 // Note: Undo stack will always get popped.
88 bool willUnapply(EditCommandSource, BeforeInputTiming); 88 bool willUnapply(EditCommandSource, BeforeInputTiming);
89 bool willReapply(EditCommandSource, BeforeInputTiming); 89 bool willReapply(EditCommandSource, BeforeInputTiming);
90 90
91 Member<Document> m_document; 91 Member<Document> m_document;
92 VisibleSelection m_startingSelection; 92 VisibleSelection m_startingSelection;
93 VisibleSelection m_endingSelection; 93 VisibleSelection m_endingSelection;
94 HeapVector<Member<SimpleEditCommand>> m_commands; 94 HeapVector<Member<SimpleEditCommand>> m_commands;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // |TypingCommand| will return the text of the last |m_commands|. 126 // |TypingCommand| will return the text of the last |m_commands|.
127 virtual String textDataForInputEvent() const; 127 virtual String textDataForInputEvent() const;
128 virtual DataTransfer* dataTransferForInputEvent() const; 128 virtual DataTransfer* dataTransferForInputEvent() const;
129 virtual RangeVector* targetRangesForInputEvent() const; 129 virtual RangeVector* targetRangesForInputEvent() const;
130 130
131 DECLARE_VIRTUAL_TRACE(); 131 DECLARE_VIRTUAL_TRACE();
132 132
133 protected: 133 protected:
134 explicit CompositeEditCommand(Document&); 134 explicit CompositeEditCommand(Document&);
135 135
136 // TODO(chongz): Implement "beforeinput" as described below: 136 // Fires "beforeinput" if |BeforeInputTiming == kShouldFireInCommand|.
137 // Fires "beforeinput" and will return |false| to cancel applying editing if 137 // Will return |false| to cancel applying editing if
138 // * "beforeinput" was canceled, or 138 // * "beforeinput" was canceled, or
139 // * |frame| was destroyed by event handlers. 139 // * |frame| was destroyed by event handlers.
140 // |willApplyEditing()| should be called from 140 // |willApplyEditing()| should be called from
141 // * |CompositeEditCommand::apply()|, and 141 // * |CompositeEditCommand::apply()|, and
142 // * |TypingCommand::willAddTypingToOpenCommand()|. 142 // * |TypingCommand::willAddTypingToOpenCommand()|.
143 bool willApplyEditing(EditCommandSource, BeforeInputTiming); 143 bool willApplyEditing(EditCommandSource, BeforeInputTiming);
144 144
145 // 145 //
146 // sugary-sweet convenience functions to help create and apply edit commands 146 // sugary-sweet convenience functions to help create and apply edit commands
147 // in composite commands 147 // in composite commands
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 DEFINE_TYPE_CASTS(CompositeEditCommand, 297 DEFINE_TYPE_CASTS(CompositeEditCommand,
298 EditCommand, 298 EditCommand,
299 command, 299 command,
300 command->isCompositeEditCommand(), 300 command->isCompositeEditCommand(),
301 command.isCompositeEditCommand()); 301 command.isCompositeEditCommand());
302 302
303 } // namespace blink 303 } // namespace blink
304 304
305 #endif // CompositeEditCommand_h 305 #endif // CompositeEditCommand_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698