mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +00:00 
			
		
		
		
	LibWeb: Move CSS Parser into new Web::CSS::Parser namespace
The goal here is to move the parser-internal classes into this namespace so they can have more convenient names without causing collisions. The Parser itself won't collide, and would be more convenient to just remain `CSS::Parser`, but having a namespace and a class with the same name makes C++ unhappy.
This commit is contained in:
		
							parent
							
								
									1304bf5a21
								
							
						
					
					
						commit
						c449cabae3
					
				
					 23 changed files with 61 additions and 58 deletions
				
			
		|  | @ -126,7 +126,7 @@ void HTMLLinkElement::resource_did_load_stylesheet() | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     auto sheet = parse_css_stylesheet(CSS::ParsingContext(document(), resource()->url()), resource()->encoded_data()); | ||||
|     auto sheet = parse_css_stylesheet(CSS::Parser::ParsingContext(document(), resource()->url()), resource()->encoded_data()); | ||||
|     if (!sheet) { | ||||
|         dbgln_if(CSS_LOADER_DEBUG, "HTMLLinkElement: Failed to parse stylesheet: {}", resource()->url()); | ||||
|         return; | ||||
|  |  | |||
|  | @ -126,7 +126,7 @@ void HTMLStyleElement::update_a_style_block() | |||
| 
 | ||||
|     // FIXME: This is a bit awkward, as the spec doesn't actually tell us when to parse the CSS text,
 | ||||
|     //        so we just do it here and pass the parsed sheet to create_a_css_style_sheet().
 | ||||
|     auto sheet = parse_css_stylesheet(CSS::ParsingContext(document()), text_content()); | ||||
|     auto sheet = parse_css_stylesheet(CSS::Parser::ParsingContext(document()), text_content()); | ||||
|     if (!sheet) | ||||
|         return; | ||||
| 
 | ||||
|  |  | |||
|  | @ -30,8 +30,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl | |||
|             if (value.equals_ignoring_case("center"sv) || value.equals_ignoring_case("middle"sv)) { | ||||
|                 style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebCenter)); | ||||
|             } else { | ||||
|                 CSS::Parser parser(CSS::ParsingContext(document()), value.view()); | ||||
|                 if (auto parsed_value = parser.parse_as_css_value(CSS::PropertyID::TextAlign)) | ||||
|                 if (auto parsed_value = parse_css_value(CSS::Parser::ParsingContext { document() }, value.view(), CSS::PropertyID::TextAlign)) | ||||
|                     style.set_property(CSS::PropertyID::TextAlign, parsed_value.release_nonnull()); | ||||
|             } | ||||
|             return; | ||||
|  |  | |||
|  | @ -390,7 +390,7 @@ NonnullRefPtr<CSS::CSSStyleDeclaration> Window::get_computed_style(DOM::Element& | |||
| 
 | ||||
| NonnullRefPtr<CSS::MediaQueryList> Window::match_media(String media) | ||||
| { | ||||
|     auto media_query_list = CSS::MediaQueryList::create(associated_document(), parse_media_query_list(CSS::ParsingContext(associated_document()), media)); | ||||
|     auto media_query_list = CSS::MediaQueryList::create(associated_document(), parse_media_query_list(CSS::Parser::ParsingContext(associated_document()), media)); | ||||
|     associated_document().add_media_query_list(media_query_list); | ||||
|     return media_query_list; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sam Atkins
						Sam Atkins