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

Unified Diff: third_party/WebKit/Source/core/events/InputEvent.h

Issue 1965543002: [InputEvent] Support |sequence<Range> getRanges()| in 'beforeinput' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments about store and clear |Range| Created 4 years, 7 months 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/events/InputEvent.h
diff --git a/third_party/WebKit/Source/core/events/InputEvent.h b/third_party/WebKit/Source/core/events/InputEvent.h
index 651ee134743c67f4237bee6418d15bc2fca8da9f..b16f476de889a3b9c5e99100004ff2ea44978437 100644
--- a/third_party/WebKit/Source/core/events/InputEvent.h
+++ b/third_party/WebKit/Source/core/events/InputEvent.h
@@ -10,6 +10,8 @@
namespace blink {
+class Range;
+
class InputEvent final : public UIEvent {
DEFINE_WRAPPERTYPEINFO();
@@ -47,23 +49,43 @@ public:
IsComposing = true,
};
- static InputEvent* createBeforeInput(InputType, const String& data, EventCancelable, EventIsComposing);
+ static InputEvent* createBeforeInput(InputType, const String& data, EventCancelable, EventIsComposing, const RangeVector*);
String inputType() const;
const String& data() const { return m_data; }
bool isComposing() const { return m_isComposing; }
+ // Returns a copy of target ranges during event dispatch, and returns an empty
+ // vector after dispatch.
+ // TODO(chongz): Return Vector<StaticRange>.
+ HeapVector<Member<Range>> getRanges() const { return m_ranges; };
bool isInputEvent() const override;
+ EventDispatchMediator* createMediator() override;
+
DECLARE_VIRTUAL_TRACE();
private:
+ friend class InputEventDispatchMediator;
InputEvent();
InputEvent(const AtomicString&, const InputEventInit&);
InputType m_inputType;
String m_data;
bool m_isComposing;
+ // We have to stored |Range| internally and only expose |StaticRange|, please
+ // see comments in |InputEventDispatchMediator::dispatchEvent()|.
+ RangeVector m_ranges;
+};
+
+class InputEventDispatchMediator final : public EventDispatchMediator {
+public:
+ static InputEventDispatchMediator* create(InputEvent*);
+
+private:
+ explicit InputEventDispatchMediator(InputEvent*);
+ InputEvent& event() const;
+ DispatchEventResult dispatchEvent(EventDispatcher&) const override;
};
DEFINE_EVENT_TYPE_CASTS(InputEvent);

Powered by Google App Engine
This is Rietveld 408576698