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

Unified Diff: third_party/WebKit/Source/core/editing/EditingUtilities.cpp

Issue 2558643003: [InputEvent] Move 'beforeinput' logic into |CompositeEditCommand::willApplyEditing()| (3/3) (Closed)
Patch Set: yosin's review, fix nits Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/EditingUtilities.cpp
diff --git a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
index 60ef9c2598a6be301ff403ab218034e448a039c1..f059f7a63ccf4dc2cca42088fe354442474994f2 100644
--- a/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
+++ b/third_party/WebKit/Source/core/editing/EditingUtilities.cpp
@@ -58,7 +58,6 @@
#include "core/html/HTMLUListElement.h"
#include "core/layout/LayoutObject.h"
#include "core/layout/LayoutTableCell.h"
-#include "platform/clipboard/ClipboardMimeTypes.h"
#include "wtf/Assertions.h"
#include "wtf/StdLibExtras.h"
#include "wtf/text/StringBuilder.h"
@@ -2047,85 +2046,6 @@ bool isTextSecurityNode(const Node* node) {
node->layoutObject()->style()->textSecurity() != TSNONE;
}
-DispatchEventResult dispatchBeforeInputInsertText(EventTarget* target,
- const String& data) {
- if (!RuntimeEnabledFeatures::inputEventEnabled())
- return DispatchEventResult::NotCanceled;
- if (!target)
- return DispatchEventResult::NotCanceled;
- // TODO(chongz): Pass appropriate |ranges| after it's defined on spec.
- // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype
- InputEvent* beforeInputEvent = InputEvent::createBeforeInput(
- InputEvent::InputType::InsertText, data,
- InputEvent::EventCancelable::IsCancelable,
- InputEvent::EventIsComposing::NotComposing, nullptr);
- return target->dispatchEvent(beforeInputEvent);
-}
-
-DispatchEventResult dispatchBeforeInputFromComposition(
- EventTarget* target,
- InputEvent::InputType inputType,
- const String& data,
- InputEvent::EventCancelable cancelable) {
- if (!RuntimeEnabledFeatures::inputEventEnabled())
- return DispatchEventResult::NotCanceled;
- if (!target)
- return DispatchEventResult::NotCanceled;
- // TODO(chongz): Pass appropriate |ranges| after it's defined on spec.
- // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype
- InputEvent* beforeInputEvent = InputEvent::createBeforeInput(
- inputType, data, cancelable, InputEvent::EventIsComposing::IsComposing,
- nullptr);
- return target->dispatchEvent(beforeInputEvent);
-}
-
-DispatchEventResult dispatchBeforeInputEditorCommand(
- EventTarget* target,
- InputEvent::InputType inputType,
- const RangeVector* ranges) {
- if (!RuntimeEnabledFeatures::inputEventEnabled())
- return DispatchEventResult::NotCanceled;
- if (!target)
- return DispatchEventResult::NotCanceled;
- InputEvent* beforeInputEvent = InputEvent::createBeforeInput(
- inputType, nullAtom, InputEvent::EventCancelable::IsCancelable,
- InputEvent::EventIsComposing::NotComposing, ranges);
- return target->dispatchEvent(beforeInputEvent);
-}
-
-DispatchEventResult dispatchBeforeInputDataTransfer(
- EventTarget* target,
- InputEvent::InputType inputType,
- DataTransfer* dataTransfer,
- const RangeVector* ranges) {
- if (!RuntimeEnabledFeatures::inputEventEnabled())
- return DispatchEventResult::NotCanceled;
- if (!target)
- return DispatchEventResult::NotCanceled;
-
- DCHECK(inputType == InputEvent::InputType::InsertFromPaste ||
- inputType == InputEvent::InputType::InsertReplacementText ||
- inputType == InputEvent::InputType::InsertFromDrop ||
- inputType == InputEvent::InputType::DeleteByCut)
- << "Unsupported inputType: " << (int)inputType;
-
- InputEvent* beforeInputEvent;
-
- if (hasRichlyEditableStyle(*(target->toNode())) || !dataTransfer) {
- beforeInputEvent = InputEvent::createBeforeInput(
- inputType, dataTransfer, InputEvent::EventCancelable::IsCancelable,
- InputEvent::EventIsComposing::NotComposing, ranges);
- } else {
- const String& data = dataTransfer->getData(mimeTypeTextPlain);
- // TODO(chongz): Pass appropriate |ranges| after it's defined on spec.
- // http://w3c.github.io/editing/input-events.html#dom-inputevent-inputtype
- beforeInputEvent = InputEvent::createBeforeInput(
- inputType, data, InputEvent::EventCancelable::IsCancelable,
- InputEvent::EventIsComposing::NotComposing, nullptr);
- }
- return target->dispatchEvent(beforeInputEvent);
-}
-
InputEvent::InputType deletionInputTypeFromTextGranularity(
DeleteDirection direction,
TextGranularity granularity) {
@@ -2135,13 +2055,13 @@ InputEvent::InputType deletionInputTypeFromTextGranularity(
if (granularity == WordGranularity)
return InputType::DeleteWordForward;
if (granularity == LineBoundary)
- return InputType::DeleteLineForward;
+ return InputType::DeleteSoftLineForward;
return InputType::DeleteContentForward;
case DeleteDirection::Backward:
if (granularity == WordGranularity)
return InputType::DeleteWordBackward;
if (granularity == LineBoundary)
- return InputType::DeleteLineBackward;
+ return InputType::DeleteSoftLineBackward;
return InputType::DeleteContentBackward;
default:
return InputType::None;

Powered by Google App Engine
This is Rietveld 408576698