| 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 2954891283900e17fad5cad4257946cc1f26294c..5d896db69810b2183056b1a76fe0646faba36802 100644
|
| --- a/third_party/WebKit/Source/core/editing/Editor.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/Editor.cpp
|
| @@ -106,8 +106,6 @@ void dispatchInputEvent(Element* target,
|
| 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);
|
| @@ -125,15 +123,6 @@ void dispatchInputEventEditableContentChanged(
|
| dispatchInputEvent(endRoot, inputType, data, isComposing);
|
| }
|
|
|
| -InputEvent::EventIsComposing isComposingFromCommand(
|
| - const CompositeEditCommand* command) {
|
| - if (command->isTypingCommand() &&
|
| - toTypingCommand(command)->compositionType() !=
|
| - TypingCommand::TextCompositionNone)
|
| - return InputEvent::EventIsComposing::IsComposing;
|
| - return InputEvent::EventIsComposing::NotComposing;
|
| -}
|
| -
|
| } // anonymous namespace
|
|
|
| Editor::RevealSelectionScope::RevealSelectionScope(Editor* editor)
|
| @@ -623,63 +612,6 @@ void Editor::replaceSelectionAfterDragging(DocumentFragment* fragment,
|
| ->apply(EditCommandSource::kMenuOrKeyBinding);
|
| }
|
|
|
| -bool Editor::deleteSelectionAfterDraggingWithEvents(
|
| - Element* dragSource,
|
| - DeleteMode deleteMode,
|
| - const Position& referenceMovePosition) {
|
| - if (!dragSource || !dragSource->isConnected())
|
| - return true;
|
| -
|
| - // Dispatch 'beforeinput'.
|
| - const bool shouldDelete = dispatchBeforeInputEditorCommand(
|
| - dragSource, InputEvent::InputType::DeleteByDrag,
|
| - nullptr) == DispatchEventResult::NotCanceled;
|
| -
|
| - // 'beforeinput' event handler may destroy frame, return false to cancel
|
| - // remaining actions;
|
| - if (m_frame->document()->frame() != m_frame)
|
| - return false;
|
| -
|
| - if (shouldDelete && dragSource->isConnected()) {
|
| - deleteSelectionWithSmartDelete(
|
| - EditCommandSource::kMenuOrKeyBinding, deleteMode,
|
| - InputEvent::InputType::DeleteByDrag, referenceMovePosition);
|
| - }
|
| -
|
| - return true;
|
| -}
|
| -
|
| -bool Editor::replaceSelectionAfterDraggingWithEvents(
|
| - Element* dropTarget,
|
| - DragData* dragData,
|
| - DocumentFragment* fragment,
|
| - Range* dropCaretRange,
|
| - InsertMode insertMode,
|
| - DragSourceType dragSourceType) {
|
| - if (!dropTarget || !dropTarget->isConnected())
|
| - return true;
|
| -
|
| - // Dispatch 'beforeinput'.
|
| - DataTransfer* dataTransfer =
|
| - DataTransfer::create(DataTransfer::DragAndDrop, DataTransferReadable,
|
| - dragData->platformData());
|
| - dataTransfer->setSourceOperation(dragData->draggingSourceOperationMask());
|
| - const bool shouldInsert =
|
| - dispatchBeforeInputDataTransfer(
|
| - dropTarget, InputEvent::InputType::InsertFromDrop, dataTransfer,
|
| - nullptr) == DispatchEventResult::NotCanceled;
|
| -
|
| - // 'beforeinput' event handler may destroy frame, return false to cancel
|
| - // remaining actions;
|
| - if (m_frame->document()->frame() != m_frame)
|
| - return false;
|
| -
|
| - if (shouldInsert && dropTarget->isConnected())
|
| - replaceSelectionAfterDragging(fragment, insertMode, dragSourceType);
|
| -
|
| - return true;
|
| -}
|
| -
|
| EphemeralRange Editor::selectedRange() {
|
| return frame().selection().selection().toNormalizedEphemeralRange();
|
| }
|
| @@ -1069,16 +1001,6 @@ void Editor::cut(EditCommandSource source) {
|
| writeSelectionToPasteboard();
|
| }
|
|
|
| - if (source == EditCommandSource::kMenuOrKeyBinding) {
|
| - if (dispatchBeforeInputDataTransfer(findEventTargetFromSelection(),
|
| - InputEvent::InputType::DeleteByCut,
|
| - nullptr, nullptr) !=
|
| - DispatchEventResult::NotCanceled)
|
| - return;
|
| - // 'beforeinput' event handler may destroy target frame.
|
| - if (m_frame->document()->frame() != m_frame)
|
| - return;
|
| - }
|
| deleteSelectionWithSmartDelete(
|
| source, canSmartCopyOrDelete() ? DeleteMode::Smart : DeleteMode::Simple,
|
| InputEvent::InputType::DeleteByCut);
|
| @@ -1113,7 +1035,9 @@ void Editor::copy() {
|
| }
|
| }
|
|
|
| -void Editor::paste(EditCommandSource source) {
|
| +// TODO(chongz): Pass |EditCommandSource| to |TextEvent| and don't fire
|
| +// 'beforeinput' for JS triggered paste.
|
| +void Editor::paste(EditCommandSource) {
|
| DCHECK(frame().document());
|
| if (tryDHTMLPaste(AllMimeTypes))
|
| return; // DHTML did the whole operation
|
| @@ -1127,21 +1051,6 @@ void Editor::paste(EditCommandSource source) {
|
| ? AllMimeTypes
|
| : PlainTextOnly;
|
|
|
| - if (source == EditCommandSource::kMenuOrKeyBinding) {
|
| - DataTransfer* dataTransfer =
|
| - DataTransfer::create(DataTransfer::CopyAndPaste, DataTransferReadable,
|
| - DataObject::createFromPasteboard(pasteMode));
|
| -
|
| - if (dispatchBeforeInputDataTransfer(findEventTargetFromSelection(),
|
| - InputEvent::InputType::InsertFromPaste,
|
| - dataTransfer, nullptr) !=
|
| - DispatchEventResult::NotCanceled)
|
| - return;
|
| - // 'beforeinput' event handler may destroy target frame.
|
| - if (m_frame->document()->frame() != m_frame)
|
| - return;
|
| - }
|
| -
|
| if (pasteMode == AllMimeTypes)
|
| pasteWithPasteboard(Pasteboard::generalPasteboard());
|
| else
|
| @@ -1296,7 +1205,7 @@ void Editor::setBaseWritingDirection(WritingDirection direction) {
|
| void Editor::revealSelectionAfterEditingOperation(
|
| const ScrollAlignment& alignment,
|
| RevealExtentOption revealExtentOption) {
|
| - if (m_preventRevealSelection)
|
| + if (m_preventRevealSelection || !m_frame->selection().isAvailable())
|
| return;
|
| frame().selection().revealSelection(alignment, revealExtentOption);
|
| }
|
|
|