mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 08:32:43 +00:00 
			
		
		
		
	LibWeb: Fix hit-testing for button element
Change 'dom_node_for_event_dispatch' to locate the closest layout node with a DOM node instead of only checking the direct ancestor. This fixes hit-testing for buttons because they are wrapped into multiple anonymous layout nodes (internally we use flex formatting for them).
This commit is contained in:
		
							parent
							
								
									8e21bbf7bf
								
							
						
					
					
						commit
						edab67d5e8
					
				
					 3 changed files with 28 additions and 2 deletions
				
			
		|  | @ -34,8 +34,12 @@ static JS::GCPtr<DOM::Node> dom_node_for_event_dispatch(Painting::Paintable& pai | |||
|         return node; | ||||
|     if (auto node = paintable.dom_node()) | ||||
|         return node; | ||||
|     if (auto* layout_parent = paintable.layout_node().parent()) | ||||
|         return layout_parent->dom_node(); | ||||
|     auto* layout_parent = paintable.layout_node().parent(); | ||||
|     while (layout_parent) { | ||||
|         if (auto* node = layout_parent->dom_node()) | ||||
|             return node; | ||||
|         layout_parent = layout_parent->parent(); | ||||
|     } | ||||
|     return nullptr; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Aliaksandr Kalenik
						Aliaksandr Kalenik