mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 00:42:44 +00:00 
			
		
		
		
	LibWeb: Implement StyleSheet.ownerNode :^)
This commit is contained in:
		
							parent
							
								
									183b2e71ba
								
							
						
					
					
						commit
						d07fcba69b
					
				
					 5 changed files with 32 additions and 7 deletions
				
			
		|  | @ -1,5 +1,5 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> | ||||
|  * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org> | ||||
|  * Copyright (c) 2021, the SerenityOS developers. | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  | @ -53,7 +53,10 @@ void HTMLLinkElement::inserted_into(Node& node) | |||
| 
 | ||||
|     if (m_relationship & Relationship::Stylesheet && !(m_relationship & Relationship::Alternate)) { | ||||
|         m_css_loader.load_from_url(document().complete_url(href())); | ||||
|         document().style_sheets().add_sheet(m_css_loader.style_sheet().release_nonnull()); | ||||
|         if (auto sheet = m_css_loader.style_sheet()) { | ||||
|             sheet->set_owner_node(this); | ||||
|             document().style_sheets().add_sheet(sheet.release_nonnull()); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> | ||||
|  * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org> | ||||
|  * Copyright (c) 2021, the SerenityOS developers. | ||||
|  * All rights reserved. | ||||
|  * | ||||
|  | @ -53,7 +53,11 @@ void HTMLStyleElement::children_changed() | |||
|             builder.append(downcast<DOM::Text>(child).text_content()); | ||||
|     }); | ||||
|     m_css_loader.load_from_text(builder.to_string()); | ||||
|     document().style_sheets().add_sheet(m_css_loader.style_sheet().release_nonnull()); | ||||
| 
 | ||||
|     if (auto sheet = m_css_loader.style_sheet()) { | ||||
|         sheet->set_owner_node(this); | ||||
|         document().style_sheets().add_sheet(sheet.release_nonnull()); | ||||
|     } | ||||
| 
 | ||||
|     HTMLElement::children_changed(); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling