mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:52:45 +00:00 
			
		
		
		
	LibHTML: Use an enum for CSS property ID's
Instead of using string everywhere, have the CSS parser produce enum values, since they are a lot nicer to work with. In the future we should generate most of this code based on a list of supported CSS properties.
This commit is contained in:
		
							parent
							
								
									19dbfc3153
								
							
						
					
					
						commit
						31ac19543a
					
				
					 18 changed files with 207 additions and 94 deletions
				
			
		
							
								
								
									
										62
									
								
								Libraries/LibHTML/CSS/PropertyID.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								Libraries/LibHTML/CSS/PropertyID.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,62 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <AK/Traits.h> | ||||
| 
 | ||||
| namespace CSS { | ||||
| enum class PropertyID { | ||||
|     Invalid, | ||||
| 
 | ||||
|     BackgroundColor, | ||||
|     BorderBottomColor, | ||||
|     BorderBottomStyle, | ||||
|     BorderBottomWidth, | ||||
|     BorderCollapse, | ||||
|     BorderLeftColor, | ||||
|     BorderLeftStyle, | ||||
|     BorderLeftWidth, | ||||
|     BorderRightColor, | ||||
|     BorderRightStyle, | ||||
|     BorderRightWidth, | ||||
|     BorderSpacing, | ||||
|     BorderTopColor, | ||||
|     BorderTopStyle, | ||||
|     BorderTopWidth, | ||||
|     Color, | ||||
|     Display, | ||||
|     FontFamily, | ||||
|     FontSize, | ||||
|     FontStyle, | ||||
|     FontVariant, | ||||
|     FontWeight, | ||||
|     Height, | ||||
|     LetterSpacing, | ||||
|     LineHeight, | ||||
|     ListStyle, | ||||
|     ListStyleImage, | ||||
|     ListStylePosition, | ||||
|     ListStyleType, | ||||
|     MarginBottom, | ||||
|     MarginLeft, | ||||
|     MarginRight, | ||||
|     MarginTop, | ||||
|     PaddingBottom, | ||||
|     PaddingLeft, | ||||
|     PaddingRight, | ||||
|     PaddingTop, | ||||
|     TextAlign, | ||||
|     TextDecoration, | ||||
|     TextIndent, | ||||
|     TextTransform, | ||||
|     Visibility, | ||||
|     WhiteSpace, | ||||
|     Width, | ||||
|     WordSpacing, | ||||
| }; | ||||
| } | ||||
| 
 | ||||
| namespace AK { | ||||
| template<> | ||||
| struct Traits<CSS::PropertyID> : public GenericTraits<CSS::PropertyID> { | ||||
|     static unsigned hash(CSS::PropertyID property_id) { return int_hash((unsigned)property_id); } | ||||
| }; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling