mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 10:42:45 +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. | ||||
|  * | ||||
|  | @ -26,7 +26,16 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <LibWeb/CSS/StyleSheet.h> | ||||
| #include <LibWeb/DOM/Element.h> | ||||
| 
 | ||||
| namespace Web::CSS { | ||||
| 
 | ||||
| void StyleSheet::set_owner_node(DOM::Element* element) | ||||
| { | ||||
|     if (element) | ||||
|         m_owner_node = element->make_weak_ptr<DOM::Element>(); | ||||
|     else | ||||
|         m_owner_node = nullptr; | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -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. | ||||
|  * | ||||
|  | @ -41,8 +41,14 @@ public: | |||
| 
 | ||||
|     virtual ~StyleSheet() = default; | ||||
| 
 | ||||
|     DOM::Element* owner_node() { return m_owner_node; } | ||||
|     void set_owner_node(DOM::Element*); | ||||
| 
 | ||||
| protected: | ||||
|     StyleSheet() = default; | ||||
| 
 | ||||
| private: | ||||
|     WeakPtr<DOM::Element> m_owner_node; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -1,9 +1,12 @@ | |||
| interface StyleSheet { | ||||
| 
 | ||||
|     readonly attribute Element? ownerNode; | ||||
| 
 | ||||
|     // readonly attribute CSSOMString type; | ||||
|     // readonly attribute USVString? href; | ||||
|     // readonly attribute (Element or ProcessingInstruction)? ownerNode; | ||||
|     // readonly attribute CSSStyleSheet? parentStyleSheet; | ||||
|     // readonly attribute DOMString? title; | ||||
|     // [SameObject, PutForwards=mediaText] readonly attribute MediaList media; | ||||
|     // attribute boolean disabled; | ||||
| 
 | ||||
| }; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling