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 428331d3e5ae2796fbebc10dec8be0ffe18ef462..463af6a2d7102545212a546af54db6ae19331501 100644 |
| --- a/third_party/WebKit/Source/core/editing/Editor.cpp |
| +++ b/third_party/WebKit/Source/core/editing/Editor.cpp |
| @@ -104,14 +104,21 @@ void dispatchInputEvent(Element* target, InputEvent::InputType inputType, const |
| return; |
| if (!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 (inputType == InputEvent::InputType::MoveByDragDrop) { |
|
chongz
2016/08/30 23:59:21
Do we have any other solution that does not requir
|
| + // Drag&Drop will be combined into one |MoveSelectionCommand|, we need to split it into |DeleteByDrag| and |InsertFromDrop|. |
| + if (startRoot) |
| + dispatchInputEvent(startRoot, InputEvent::InputType::DeleteByDrag, data, isComposing); |
| + if (endRoot) |
| + dispatchInputEvent(endRoot, InputEvent::InputType::InsertFromDrop, data, isComposing); |
|
yosin_UTC9
2016/08/31 01:20:34
Q: Do we dispatch "insertFromDrop" even if "delete
chongz
2016/09/02 18:02:10
Yes. Canceling 'deleteByDrag' only means cancellin
yosin_UTC9
2016/09/05 01:37:50
Your testing doesn't covered to make the case |end
chongz
2016/09/07 17:12:55
Added check in |dispatchInputEvent()|.
|
| + return; |
| + } |
| + |
| if (startRoot) |
| dispatchInputEvent(startRoot, inputType, data, isComposing); |
| if (endRoot && endRoot != startRoot) |
|
yosin_UTC9
2016/08/31 01:20:34
Do we need to check |endRoot.isConnected()|?
chongz
2016/09/02 18:02:10
It seems to me that if the element was changed, we
yosin_UTC9
2016/09/05 01:37:50
According DOM spec, https://www.w3.org/TR/dom/#dis
chongz
2016/09/07 17:12:55
OK, thanks for the reference!
|
| @@ -560,7 +567,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) |