mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:22:45 +00:00 
			
		
		
		
	LibWeb: Use paintable to represent event tracking node
The use of layout nodes likely predated the paintable tree, but now there is no point in introducing another level of indirection.
This commit is contained in:
		
							parent
							
								
									ad59fb7cf0
								
							
						
					
					
						commit
						31e5b5f5de
					
				
					 6 changed files with 24 additions and 14 deletions
				
			
		|  | @ -836,9 +836,9 @@ bool EventHandler::handle_keyup(KeyCode key, u32 modifiers, u32 code_point) | |||
|     return fire_keyboard_event(UIEvents::EventNames::keyup, m_browsing_context, key, modifiers, code_point); | ||||
| } | ||||
| 
 | ||||
| void EventHandler::set_mouse_event_tracking_layout_node(Layout::Node* layout_node) | ||||
| void EventHandler::set_mouse_event_tracking_paintable(Painting::Paintable* paintable) | ||||
| { | ||||
|     m_mouse_event_tracking_layout_node = layout_node; | ||||
|     m_mouse_event_tracking_paintable = paintable; | ||||
| } | ||||
| 
 | ||||
| CSSPixelPoint EventHandler::compute_mouse_event_client_offset(CSSPixelPoint event_page_position) const | ||||
|  | @ -880,11 +880,11 @@ CSSPixelPoint EventHandler::compute_mouse_event_movement(CSSPixelPoint screen_po | |||
| 
 | ||||
| Optional<EventHandler::Target> EventHandler::target_for_mouse_position(CSSPixelPoint position) | ||||
| { | ||||
|     if (m_mouse_event_tracking_layout_node) { | ||||
|         if (m_mouse_event_tracking_layout_node->paintable()->wants_mouse_events()) | ||||
|             return Target { m_mouse_event_tracking_layout_node->paintable(), {} }; | ||||
|     if (m_mouse_event_tracking_paintable) { | ||||
|         if (m_mouse_event_tracking_paintable->wants_mouse_events()) | ||||
|             return Target { m_mouse_event_tracking_paintable, {} }; | ||||
| 
 | ||||
|         m_mouse_event_tracking_layout_node = nullptr; | ||||
|         m_mouse_event_tracking_paintable = nullptr; | ||||
|     } | ||||
| 
 | ||||
|     if (auto result = paint_root()->hit_test(position, Painting::HitTestType::Exact); result.has_value()) | ||||
|  | @ -893,4 +893,9 @@ Optional<EventHandler::Target> EventHandler::target_for_mouse_position(CSSPixelP | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| void EventHandler::visit_edges(JS::Cell::Visitor& visitor) const | ||||
| { | ||||
|     visitor.visit(m_mouse_event_tracking_paintable); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Aliaksandr Kalenik
						Aliaksandr Kalenik