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

Side by Side Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 2117543003: [InputEvent] Fill |data| field for 'input' event InsertText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add virtual function |textData()| to |EditCommand| Created 4 years, 5 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) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 return InputEvent::InputType::InsertText; 135 return InputEvent::InputType::InsertText;
136 default: 136 default:
137 return InputEvent::InputType::None; 137 return InputEvent::InputType::None;
138 } 138 }
139 } 139 }
140 140
141 // TODO(chongz): Handle other edit actions. 141 // TODO(chongz): Handle other edit actions.
142 return InputEvent::InputType::None; 142 return InputEvent::InputType::None;
143 } 143 }
144 144
145 String dataFromCommand(const CompositeEditCommand* command)
yosin_UTC9 2016/07/06 01:20:55 It seems having |EditCommand::textDataForInputEven
chongz 2016/07/06 23:34:32 Done.
146 {
147 if (!command->isTypingCommand() || toTypingCommand(command)->commandTypeOfOp enCommand() != TypingCommand::InsertText)
148 return emptyString();
149 return command->textData();
150 }
151
145 InputEvent::EventIsComposing isComposingFromCommand(const CompositeEditCommand* command) 152 InputEvent::EventIsComposing isComposingFromCommand(const CompositeEditCommand* command)
146 { 153 {
147 if (command->isTypingCommand() && toTypingCommand(command)->compositionType( ) != TypingCommand::TextCompositionNone) 154 if (command->isTypingCommand() && toTypingCommand(command)->compositionType( ) != TypingCommand::TextCompositionNone)
148 return InputEvent::EventIsComposing::IsComposing; 155 return InputEvent::EventIsComposing::IsComposing;
149 return InputEvent::EventIsComposing::NotComposing; 156 return InputEvent::EventIsComposing::NotComposing;
150 } 157 }
151 158
152 } // anonymous namespace 159 } // anonymous namespace
153 160
154 Editor::RevealSelectionScope::RevealSelectionScope(Editor* editor) 161 Editor::RevealSelectionScope::RevealSelectionScope(Editor* editor)
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 EventQueueScope scope; 752 EventQueueScope scope;
746 frame().document()->updateStyleAndLayout(); 753 frame().document()->updateStyleAndLayout();
747 754
748 // Request spell checking after pasting before any further DOM change. 755 // Request spell checking after pasting before any further DOM change.
749 requestSpellcheckingAfterApplyingCommand(cmd); 756 requestSpellcheckingAfterApplyingCommand(cmd);
750 757
751 EditCommandComposition* composition = cmd->composition(); 758 EditCommandComposition* composition = cmd->composition();
752 DCHECK(composition); 759 DCHECK(composition);
753 dispatchEditableContentChangedEvents(composition->startingRootEditableElemen t(), composition->endingRootEditableElement()); 760 dispatchEditableContentChangedEvents(composition->startingRootEditableElemen t(), composition->endingRootEditableElement());
754 // TODO(chongz): Filter empty InputType after spec is finalized. 761 // TODO(chongz): Filter empty InputType after spec is finalized.
755 // TODO(chongz): Fill in |data| field. 762 dispatchInputEventEditableContentChanged(composition->startingRootEditableEl ement(), composition->endingRootEditableElement(), inputTypeFromCommand(cmd), da taFromCommand(cmd), isComposingFromCommand(cmd));
756 dispatchInputEventEditableContentChanged(composition->startingRootEditableEl ement(), composition->endingRootEditableElement(), inputTypeFromCommand(cmd), em ptyString(), isComposingFromCommand(cmd));
757 VisibleSelection newSelection(cmd->endingSelection()); 763 VisibleSelection newSelection(cmd->endingSelection());
758 764
759 // Don't clear the typing style with this selection change. We do those thin gs elsewhere if necessary. 765 // Don't clear the typing style with this selection change. We do those thin gs elsewhere if necessary.
760 changeSelectionAfterCommand(newSelection, 0); 766 changeSelectionAfterCommand(newSelection, 0);
761 767
762 if (!cmd->preservesTypingStyle()) 768 if (!cmd->preservesTypingStyle())
763 frame().selection().clearTypingStyle(); 769 frame().selection().clearTypingStyle();
764 770
765 // Command will be equal to last edit command only in the case of typing 771 // Command will be equal to last edit command only in the case of typing
766 if (m_lastEditCommand.get() == cmd) { 772 if (m_lastEditCommand.get() == cmd) {
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 1429
1424 DEFINE_TRACE(Editor) 1430 DEFINE_TRACE(Editor)
1425 { 1431 {
1426 visitor->trace(m_frame); 1432 visitor->trace(m_frame);
1427 visitor->trace(m_lastEditCommand); 1433 visitor->trace(m_lastEditCommand);
1428 visitor->trace(m_undoStack); 1434 visitor->trace(m_undoStack);
1429 visitor->trace(m_mark); 1435 visitor->trace(m_mark);
1430 } 1436 }
1431 1437
1432 } // namespace blink 1438 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698