| Index: third_party/WebKit/Source/core/events/InputEvent.cpp
|
| diff --git a/third_party/WebKit/Source/core/events/InputEvent.cpp b/third_party/WebKit/Source/core/events/InputEvent.cpp
|
| index 956208ac68b16121c887544c9b77be7d96987660..56c32b82612ce3892043d2e90963c9bc21c8c07a 100644
|
| --- a/third_party/WebKit/Source/core/events/InputEvent.cpp
|
| +++ b/third_party/WebKit/Source/core/events/InputEvent.cpp
|
| @@ -92,7 +92,8 @@ InputEvent::InputType convertStringToInputType(const String& stringName) {
|
| InputEvent::InputEvent(const AtomicString& type,
|
| const InputEventInit& initializer)
|
| : UIEvent(type, initializer) {
|
| - // TODO(ojan): We should find a way to prevent conversion like String->enum->String just in order to use initializer.
|
| + // TODO(ojan): We should find a way to prevent conversion like
|
| + // String->enum->String just in order to use initializer.
|
| // See InputEvent::createBeforeInput() for the first conversion.
|
| if (initializer.hasInputType())
|
| m_inputType = convertStringToInputType(initializer.inputType());
|
| @@ -116,7 +117,8 @@ InputEvent* InputEvent::createBeforeInput(InputType inputType,
|
|
|
| inputEventInit.setBubbles(true);
|
| inputEventInit.setCancelable(cancelable == IsCancelable);
|
| - // TODO(ojan): We should find a way to prevent conversion like String->enum->String just in order to use initializer.
|
| + // TODO(ojan): We should find a way to prevent conversion like
|
| + // String->enum->String just in order to use initializer.
|
| // See InputEvent::InputEvent() for the second conversion.
|
| inputEventInit.setInputType(convertInputTypeToString(inputType));
|
| inputEventInit.setData(data);
|
| @@ -155,7 +157,8 @@ InputEvent* InputEvent::createInput(InputType inputType,
|
|
|
| inputEventInit.setBubbles(true);
|
| inputEventInit.setCancelable(false);
|
| - // TODO(ojan): We should find a way to prevent conversion like String->enum->String just in order to use initializer.
|
| + // TODO(ojan): We should find a way to prevent conversion like
|
| + // String->enum->String just in order to use initializer.
|
| // See InputEvent::InputEvent() for the second conversion.
|
| inputEventInit.setInputType(convertInputTypeToString(inputType));
|
| inputEventInit.setData(data);
|
| @@ -183,8 +186,9 @@ bool InputEvent::isInputEvent() const {
|
| return true;
|
| }
|
|
|
| -// TODO(chongz): We should get rid of this |EventDispatchMediator| pattern and introduce
|
| -// simpler interface such as |beforeDispatchEvent()| and |afterDispatchEvent()| virtual methods.
|
| +// TODO(chongz): We should get rid of this |EventDispatchMediator| pattern and
|
| +// introduce simpler interface such as |beforeDispatchEvent()| and
|
| +// |afterDispatchEvent()| virtual methods.
|
| EventDispatchMediator* InputEvent::createMediator() {
|
| return InputEventDispatchMediator::create(this);
|
| }
|
| @@ -210,16 +214,17 @@ InputEvent& InputEventDispatchMediator::event() const {
|
| DispatchEventResult InputEventDispatchMediator::dispatchEvent(
|
| EventDispatcher& dispatcher) const {
|
| DispatchEventResult result = dispatcher.dispatch();
|
| - // It's weird to hold and clear live |Range| objects internally, and only expose |StaticRange|
|
| - // through |getTargetRanges()|. However there is no better solutions due to the following issues:
|
| - // 1. We don't want to expose live |Range| objects for the author to hold as it will slow down
|
| - // all DOM operations. So we just expose |StaticRange|.
|
| - // 2. Event handlers in chain might modify DOM, which means we have to keep a copy of live
|
| - // |Range| internally and return snapshots.
|
| - // 3. We don't want authors to hold live |Range| indefinitely by holding |InputEvent|, so we
|
| - // clear them after dispatch.
|
| - // Authors should explicitly call |getTargetRanges()|->|toRange()| if they want to keep a copy of |Range|.
|
| - // See Editing TF meeting notes:
|
| + // It's weird to hold and clear live |Range| objects internally, and only
|
| + // expose |StaticRange| through |getTargetRanges()|. However there is no
|
| + // better solutions due to the following issues:
|
| + // 1. We don't want to expose live |Range| objects for the author to hold as
|
| + // it will slow down all DOM operations. So we just expose |StaticRange|.
|
| + // 2. Event handlers in chain might modify DOM, which means we have to keep
|
| + // a copy of live |Range| internally and return snapshots.
|
| + // 3. We don't want authors to hold live |Range| indefinitely by holding
|
| + // |InputEvent|, so we clear them after dispatch.
|
| + // Authors should explicitly call |getTargetRanges()|->|toRange()| if they
|
| + // want to keep a copy of |Range|. See Editing TF meeting notes:
|
| // https://docs.google.com/document/d/1hCj6QX77NYIVY0RWrMHT1Yra6t8_Qu8PopaWLG0AM58/edit?usp=sharing
|
| event().m_ranges.clear();
|
| return result;
|
|
|