2020-03-18 20:20:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/*
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-15 19:15:52 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *  Copyright  ( c )  2020 - 2022 ,  Andreas  Kling  < kling @ serenityos . org > 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 20:20:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
									
										
										
										
											2021-04-22 01:24:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *  SPDX - License - Identifier :  BSD - 2 - Clause 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 20:20:35 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# pragma once 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-01-08 19:23:00 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <AK/DeprecatedFlyString.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  <AK/Noncopyable.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <AK/Vector.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-06 14:28:41 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <LibJS/Forward.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-28 13:42:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <LibWeb/Bindings/PlatformObject.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 20:43:24 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <LibWeb/DOM/DOMEventListener.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  <LibWeb/Forward.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-14 18:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <LibWeb/HTML/EventHandler.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-25 17:03:42 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <LibWeb/WebIDL/ExceptionOr.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-07-26 19:37:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								namespace  Web : : DOM  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-28 13:42:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								class  EventTarget  :  public  Bindings : : PlatformObject  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    WEB_PLATFORM_OBJECT ( EventTarget ,  Bindings : : PlatformObject ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								public : 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-25 16:15:49 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    virtual  ~ EventTarget ( )  override ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-02-06 19:27:44 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    virtual  bool  is_focusable ( )  const  {  return  false ;  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-09 09:52:27 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    void  add_event_listener ( FlyString  const &  type ,  IDLEventListener *  callback ,  Variant < AddEventListenerOptions ,  bool >  const &  options ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    void  remove_event_listener ( FlyString  const &  type ,  IDLEventListener *  callback ,  Variant < EventListenerOptions ,  bool >  const &  options ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-19 22:02:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // NOTE: These are for internal use only. They operate as though addEventListener(type, callback) was called instead of addEventListener(type, callback, options).
 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-09 09:52:27 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    void  add_event_listener_without_options ( FlyString  const &  type ,  IDLEventListener &  callback ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    void  remove_event_listener_without_options ( FlyString  const &  type ,  IDLEventListener &  callback ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-21 18:32:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-08 22:29:40 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    virtual  bool  dispatch_event ( Event & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-09-25 17:03:42 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    WebIDL : : ExceptionOr < bool >  dispatch_event_binding ( Event & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-05-04 22:38:36 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-01 20:58:27 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    virtual  EventTarget *  get_parent ( Event  const & )  {  return  nullptr ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-21 18:32:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-08 14:12:01 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    void  add_an_event_listener ( DOMEventListener & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-16 20:43:24 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    void  remove_an_event_listener ( DOMEventListener & ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    void  remove_from_event_listener_list ( DOMEventListener & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-28 13:42:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    Vector < JS : : Handle < DOMEventListener > >  event_listener_list ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-04-01 20:58:27 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    Function < void ( Event  const & ) >  activation_behavior ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-21 18:32:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // NOTE: These only exist for checkbox and radio input elements.
 
							 
						 
					
						
							
								
									
										
										
										
											2022-02-18 20:40:12 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    virtual  void  legacy_pre_activation_behavior ( )  {  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    virtual  void  legacy_cancelled_activation_behavior ( )  {  } 
							 
						 
					
						
							
								
									
										
										
										
											2022-03-14 23:05:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    virtual  void  legacy_cancelled_activation_behavior_was_not_called ( )  {  } 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-21 18:32:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-06 07:25:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    WebIDL : : CallbackType *  event_handler_attribute ( FlyString  const &  name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    void  set_event_handler_attribute ( FlyString  const &  name ,  WebIDL : : CallbackType * ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-19 01:38:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-09 09:52:27 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    bool  has_event_listener ( FlyString  const &  type )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2023-02-28 18:39:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    bool  has_event_listeners ( )  const ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-10-24 14:56:29 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								protected : 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-28 13:42:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    explicit  EventTarget ( JS : : Realm & ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-09 09:52:27 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    void  element_event_handler_attribute_changed ( FlyString  const &  local_name ,  Optional < String >  const &  value ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-09-20 19:22:44 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-08-28 13:42:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    virtual  void  visit_edges ( Cell : : Visitor & )  override ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-10-14 18:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								private : 
							 
						 
					
						
							
								
									
										
										
										
											2022-08-28 13:42:07 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    Vector < JS : : NonnullGCPtr < DOMEventListener > >  m_event_listener_list ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-14 18:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-map
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    // Spec Note: The order of the entries of event handler map could be arbitrary. It is not observable through any algorithms that operate on the map.
 
							 
						 
					
						
							
								
									
										
										
										
											2023-04-09 09:52:27 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    HashMap < FlyString ,  JS : : GCPtr < HTML : : EventHandler > >  m_event_handler_map ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-14 18:03:08 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-09 09:52:27 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    WebIDL : : CallbackType *  get_current_value_of_event_handler ( FlyString  const &  name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    void  activate_event_handler ( FlyString  const &  name ,  HTML : : EventHandler &  event_handler ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    void  deactivate_event_handler ( FlyString  const &  name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    JS : : ThrowCompletionOr < void >  process_event_handler_for_event ( FlyString  const &  name ,  Event &  event ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2023-04-06 07:25:18 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  is_window_reflecting_body_element_event_handler ( FlyString  const &  name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-06-27 19:20:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-03-18 15:22:31 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								}