Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/Editor.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp |
| index 477e1de0f71b071d8c669549dc110d78e6a2b5d5..012f8ad4085056924c7b4e1a66de326d9ce00202 100644 |
| --- a/third_party/WebKit/Source/core/editing/Editor.cpp |
| +++ b/third_party/WebKit/Source/core/editing/Editor.cpp |
| @@ -102,19 +102,23 @@ void dispatchInputEvent(Element* target, InputEvent::InputType inputType, const |
| { |
| if (!RuntimeEnabledFeatures::inputEventEnabled()) |
| return; |
| - if (!target) |
| + if (!target || !target->isConnected()) |
|
yosin_UTC9
2016/09/08 04:34:40
One more.
Could you make |disaptchInputEvent()| to
chongz
2016/09/08 22:37:50
I've added check for |ownerDocument()| but I don't
chongz
2016/09/13 17:17:12
dtapuska@ I'm not sure if I understood the issue c
dtapuska
2016/09/13 17:27:50
Ya this change seems odd to me. The old code use t
yosin_UTC9
2016/09/14 01:57:37
I changed mind, we should verify source and target
|
| return; |
| - // TODO(chongz): Pass appreciate |ranges| after it's defined on spec. |
| - // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype |
| InputEvent* inputEvent = InputEvent::createInput(inputType, data, isComposing, nullptr); |
| target->dispatchScopedEvent(inputEvent); |
| } |
| void dispatchInputEventEditableContentChanged(Element* startRoot, Element* endRoot, InputEvent::InputType inputType, const String& data, InputEvent::EventIsComposing isComposing) |
| { |
| - if (startRoot) |
| - dispatchInputEvent(startRoot, inputType, data, isComposing); |
| - if (endRoot && endRoot != startRoot) |
| + if (inputType == InputEvent::InputType::MoveByDragDrop) { |
| + // Drag&Drop will be combined into one |MoveSelectionCommand|, we need to split it into |DeleteByDrag| and |InsertFromDrop|. |
| + dispatchInputEvent(startRoot, InputEvent::InputType::DeleteByDrag, data, isComposing); |
| + dispatchInputEvent(endRoot, InputEvent::InputType::InsertFromDrop, data, isComposing); |
| + return; |
| + } |
| + |
| + dispatchInputEvent(startRoot, inputType, data, isComposing); |
| + if (endRoot != startRoot) |
| dispatchInputEvent(endRoot, inputType, data, isComposing); |
| } |
| @@ -560,7 +564,7 @@ void Editor::replaceSelectionAfterDragging(DocumentFragment* fragment, bool smar |
| if (plainText) |
| options |= ReplaceSelectionCommand::MatchStyle; |
| DCHECK(frame().document()); |
| - ReplaceSelectionCommand::create(*frame().document(), fragment, options, InputEvent::InputType::Drag)->apply(); |
| + ReplaceSelectionCommand::create(*frame().document(), fragment, options, InputEvent::InputType::InsertFromDrop)->apply(); |
| } |
| void Editor::moveSelectionAfterDragging(DocumentFragment* fragment, const Position& pos, bool smartInsert, bool smartDelete) |