mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 08:32:43 +00:00 
			
		
		
		
	LibWeb: Run IntersectionObserver steps only when needed
Instead of updating IOs in every iteration of the HTML event loop, we now only do it after a relayout, or after the viewport changes.
This commit is contained in:
		
							parent
							
								
									d3f8d24abb
								
							
						
					
					
						commit
						11b4216e65
					
				
					 3 changed files with 8 additions and 3 deletions
				
			
		|  | @ -29,6 +29,7 @@ | |||
| #include <LibWeb/HTML/TraversableNavigable.h> | ||||
| #include <LibWeb/HTML/Window.h> | ||||
| #include <LibWeb/HTML/WindowProxy.h> | ||||
| #include <LibWeb/HighResolutionTime/TimeOrigin.h> | ||||
| #include <LibWeb/Infra/Strings.h> | ||||
| #include <LibWeb/Layout/Node.h> | ||||
| #include <LibWeb/Loader/GeneratedPagesLoader.h> | ||||
|  | @ -1944,6 +1945,9 @@ void Navigable::scroll_offset_did_change() | |||
| 
 | ||||
|     // 3. Append doc to doc’s pending scroll event targets.
 | ||||
|     doc->pending_scroll_event_targets().append(*doc); | ||||
| 
 | ||||
|     // OPTIMIZATION: We do this here instead of in HTML::EventLoop::process() to avoid redundant work.
 | ||||
|     doc->run_the_update_intersection_observations_steps(HighResolutionTime::unsafe_shared_current_time()); | ||||
| } | ||||
| 
 | ||||
| CSSPixelRect Navigable::to_top_level_rect(CSSPixelRect const& a_rect) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling