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

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: Rename |EditCommand::textData()| to |EditCommand::textDataForInputEvent()| 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 // TODO(chongz): |InsertNonText| event might require a document fragment |data|.
146 String dataFromCommand(const CompositeEditCommand* command)
yosin_UTC9 2016/07/07 00:44:32 We don't need to have this function at this time.
147 {
148 return command->textDataForInputEvent();
149 }
150
145 InputEvent::EventIsComposing isComposingFromCommand(const CompositeEditCommand* command) 151 InputEvent::EventIsComposing isComposingFromCommand(const CompositeEditCommand* command)
146 { 152 {
147 if (command->isTypingCommand() && toTypingCommand(command)->compositionType( ) != TypingCommand::TextCompositionNone) 153 if (command->isTypingCommand() && toTypingCommand(command)->compositionType( ) != TypingCommand::TextCompositionNone)
148 return InputEvent::EventIsComposing::IsComposing; 154 return InputEvent::EventIsComposing::IsComposing;
149 return InputEvent::EventIsComposing::NotComposing; 155 return InputEvent::EventIsComposing::NotComposing;
150 } 156 }
151 157
152 } // anonymous namespace 158 } // anonymous namespace
153 159
154 Editor::RevealSelectionScope::RevealSelectionScope(Editor* editor) 160 Editor::RevealSelectionScope::RevealSelectionScope(Editor* editor)
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 EventQueueScope scope; 751 EventQueueScope scope;
746 frame().document()->updateStyleAndLayout(); 752 frame().document()->updateStyleAndLayout();
747 753
748 // Request spell checking after pasting before any further DOM change. 754 // Request spell checking after pasting before any further DOM change.
749 requestSpellcheckingAfterApplyingCommand(cmd); 755 requestSpellcheckingAfterApplyingCommand(cmd);
750 756
751 EditCommandComposition* composition = cmd->composition(); 757 EditCommandComposition* composition = cmd->composition();
752 DCHECK(composition); 758 DCHECK(composition);
753 dispatchEditableContentChangedEvents(composition->startingRootEditableElemen t(), composition->endingRootEditableElement()); 759 dispatchEditableContentChangedEvents(composition->startingRootEditableElemen t(), composition->endingRootEditableElement());
754 // TODO(chongz): Filter empty InputType after spec is finalized. 760 // TODO(chongz): Filter empty InputType after spec is finalized.
755 // TODO(chongz): Fill in |data| field. 761 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()); 762 VisibleSelection newSelection(cmd->endingSelection());
758 763
759 // Don't clear the typing style with this selection change. We do those thin gs elsewhere if necessary. 764 // Don't clear the typing style with this selection change. We do those thin gs elsewhere if necessary.
760 changeSelectionAfterCommand(newSelection, 0); 765 changeSelectionAfterCommand(newSelection, 0);
761 766
762 if (!cmd->preservesTypingStyle()) 767 if (!cmd->preservesTypingStyle())
763 frame().selection().clearTypingStyle(); 768 frame().selection().clearTypingStyle();
764 769
765 // Command will be equal to last edit command only in the case of typing 770 // Command will be equal to last edit command only in the case of typing
766 if (m_lastEditCommand.get() == cmd) { 771 if (m_lastEditCommand.get() == cmd) {
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 1428
1424 DEFINE_TRACE(Editor) 1429 DEFINE_TRACE(Editor)
1425 { 1430 {
1426 visitor->trace(m_frame); 1431 visitor->trace(m_frame);
1427 visitor->trace(m_lastEditCommand); 1432 visitor->trace(m_lastEditCommand);
1428 visitor->trace(m_undoStack); 1433 visitor->trace(m_undoStack);
1429 visitor->trace(m_mark); 1434 visitor->trace(m_mark);
1430 } 1435 }
1431 1436
1432 } // namespace blink 1437 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698