mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 05:10:57 +00:00 
			
		
		
		
	LibWeb: Invalidate less elements affected by CSS custom properties
Before this change, whenever element's attributes changed, we would add a flag to "pending invalidation", indicating that all descendants whose style uses CSS custom properties needed to be recomputed. This resulted in severe overinvalidation, because we would run invalidation regardless of whether any custom property on affected element actually changed. This change takes another approach, and now we decide whether descendant's style needs to be recomputed based on whether ancestor's style recomputation results in a change of custom properties, though this approach adds a little overhead to style computation as now we have to compare old vs new hashmap of custom properties. This brings substantial improvement on discord and x.com where, before this change, advantage of using invalidation sets was lost and we had to recompute all descendants, because almost all of them use custom properties.
This commit is contained in:
		
							parent
							
								
									cbe4ba60c3
								
							
						
					
					
						commit
						d1fbb7b51e
					
				
				
				Notes:
				
					github-actions[bot]
				
				2025-07-30 09:07:23 +00:00 
				
			
			Author: https://github.com/kalenikaliaksandr
Commit: d1fbb7b51e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5618
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/tcl3
			
					 13 changed files with 71 additions and 67 deletions
				
			
		|  | @ -364,7 +364,6 @@ public: | |||
|     void invalidate_style(StyleInvalidationReason); | ||||
|     struct StyleInvalidationOptions { | ||||
|         bool invalidate_self { false }; | ||||
|         bool invalidate_elements_that_use_css_custom_properties { false }; | ||||
|     }; | ||||
|     void invalidate_style(StyleInvalidationReason, Vector<CSS::InvalidationSet::Property> const&, StyleInvalidationOptions); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Aliaksandr Kalenik
						Aliaksandr Kalenik