| 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 337496ae8c03ae9750243fa347e79f0160a22ed1..c93f0c214be48c108f260f336e7a7aee46fd9659 100644
|
| --- a/third_party/WebKit/Source/core/events/InputEvent.cpp
|
| +++ b/third_party/WebKit/Source/core/events/InputEvent.cpp
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "core/events/InputEvent.h"
|
|
|
| +#include "core/dom/Range.h"
|
| #include "core/events/EventDispatcher.h"
|
| #include "public/platform/WebEditingCommandType.h"
|
|
|
| @@ -62,10 +63,12 @@ InputEvent::InputEvent(const AtomicString& type, const InputEventInit& initializ
|
| m_data = initializer.data();
|
| if (initializer.hasIsComposing())
|
| m_isComposing = initializer.isComposing();
|
| + if (initializer.hasRanges())
|
| + m_ranges = initializer.ranges();
|
| }
|
|
|
| /* static */
|
| -InputEvent* InputEvent::createBeforeInput(InputType inputType, const String& data, EventCancelable cancelable, EventIsComposing isComposing)
|
| +InputEvent* InputEvent::createBeforeInput(InputType inputType, const String& data, EventCancelable cancelable, EventIsComposing isComposing, const RangeVector* ranges)
|
| {
|
| InputEventInit inputEventInit;
|
|
|
| @@ -76,6 +79,8 @@ InputEvent* InputEvent::createBeforeInput(InputType inputType, const String& dat
|
| inputEventInit.setInputType(convertInputTypeToString(inputType));
|
| inputEventInit.setData(data);
|
| inputEventInit.setIsComposing(isComposing == IsComposing);
|
| + if (ranges)
|
| + inputEventInit.setRanges(*ranges);
|
|
|
| return InputEvent::create(EventTypeNames::beforeinput, inputEventInit);
|
| }
|
| @@ -90,9 +95,38 @@ bool InputEvent::isInputEvent() const
|
| return true;
|
| }
|
|
|
| +EventDispatchMediator* InputEvent::createMediator()
|
| +{
|
| + return InputEventDispatchMediator::create(this);
|
| +}
|
| +
|
| DEFINE_TRACE(InputEvent)
|
| {
|
| UIEvent::trace(visitor);
|
| + visitor->trace(m_ranges);
|
| +}
|
| +
|
| +InputEventDispatchMediator* InputEventDispatchMediator::create(InputEvent* inputEvent)
|
| +{
|
| + return new InputEventDispatchMediator(inputEvent);
|
| +}
|
| +
|
| +InputEventDispatchMediator::InputEventDispatchMediator(InputEvent* inputEvent)
|
| + : EventDispatchMediator(inputEvent)
|
| +{
|
| +}
|
| +
|
| +InputEvent& InputEventDispatchMediator::event() const
|
| +{
|
| + return toInputEvent(EventDispatchMediator::event());
|
| +}
|
| +
|
| +DispatchEventResult InputEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const
|
| +{
|
| + DispatchEventResult result = dispatcher.dispatch();
|
| + // Clear |m_ranges| manually in case event object was held by JavaScript.
|
| + event().m_ranges.clear();
|
| + return result;
|
| }
|
|
|
| } // namespace blink
|
|
|