[M120 Migration] Implement hasEventListeners for Web Voice Touch 54/307754/2
authorjiangyuwei <yuwei.jiang@samsung.com>
Wed, 13 Mar 2024 00:51:49 +0000 (08:51 +0800)
committerYanqing Lu <yanqing.lu@samsung.com>
Thu, 14 Mar 2024 02:47:42 +0000 (02:47 +0000)
In order to support more elements in Web Voice Touch,
WebBrowser request new JS API for getting event listeners
attached to html element. So implemented the JS API:
bool hasEventListeners(const String eventType)

References:
  - https://review.tizen.org/gerrit/#/c/299220/

Change-Id: I077701f36eaf12f25161fda8b513127fa177533f
Signed-off-by: jiangyuwei <yuwei.jiang@samsung.com>
third_party/blink/renderer/core/dom/events/event_target.cc
third_party/blink/renderer/core/dom/events/event_target.h
third_party/blink/renderer/core/dom/events/event_target.idl

index b62911f..241e934 100644 (file)
@@ -586,6 +586,10 @@ bool EventTarget::removeEventListener(const AtomicString& event_type,
   return removeEventListener(event_type, event_listener, /*use_capture=*/false);
 }
 
+bool EventTarget::hasEventListeners(const AtomicString& event_type) {
+  return HasEventListeners(event_type);
+}
+
 bool EventTarget::removeEventListener(
     const AtomicString& event_type,
     V8EventListener* listener,
index 022773b..768371b 100644 (file)
@@ -171,6 +171,7 @@ class CORE_EXPORT EventTarget : public ScriptWrappable {
                            const EventListener*,
                            EventListenerOptions*);
   virtual void RemoveAllEventListeners();
+  bool hasEventListeners(const AtomicString& event_type);
 
   DispatchEventResult DispatchEvent(Event&);
 
index 94c0678..ef2aa40 100644 (file)
@@ -26,5 +26,6 @@
     [CallWith=ScriptState] constructor();
     void addEventListener(DOMString type, EventListener? listener, optional (AddEventListenerOptions or boolean) options);
     void removeEventListener(DOMString type, EventListener? listener, optional (EventListenerOptions or boolean) options);
+    boolean hasEventListeners(DOMString type);
     [ImplementedAs=dispatchEventForBindings, RaisesException, RuntimeCallStatsCounter=EventTargetDispatchEvent] boolean dispatchEvent(Event event);
 };