mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:22:43 +00:00 
			
		
		
		
	 c718ba5947
			
		
	
	
		c718ba5947
		
	
	
	
	
		
			
			Both of these are supposed to be set when the CSSRule is created. The spec is silent on setting it when a CSSRule is added to a parent. So, this is a bit ad-hoc. The parent rule gets set whenever a rule is added to a new parent. The parent stylesheet gets set whenever the rule or one of its ancestors is added to a different stylesheet. There may be some nuance there that I'm missing, but I'm sure we'll find out quickly once we have WPT running!
		
			
				
	
	
		
			43 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/Function.h>
 | |
| #include <AK/NonnullRefPtr.h>
 | |
| #include <LibWeb/CSS/CSSRule.h>
 | |
| #include <LibWeb/CSS/CSSRuleList.h>
 | |
| #include <LibWeb/Forward.h>
 | |
| 
 | |
| namespace Web::CSS {
 | |
| 
 | |
| class CSSGroupingRule : public CSSRule {
 | |
|     AK_MAKE_NONCOPYABLE(CSSGroupingRule);
 | |
|     AK_MAKE_NONMOVABLE(CSSGroupingRule);
 | |
| 
 | |
| public:
 | |
|     using WrapperType = Bindings::CSSGroupingRuleWrapper;
 | |
| 
 | |
|     virtual ~CSSGroupingRule() = default;
 | |
| 
 | |
|     CSSRuleList const& css_rules() const { return m_rules; }
 | |
|     CSSRuleList& css_rules() { return m_rules; }
 | |
|     NonnullRefPtr<CSSRuleList> css_rules_for_bindings() { return m_rules; }
 | |
|     DOM::ExceptionOr<u32> insert_rule(StringView rule, u32 index = 0);
 | |
|     DOM::ExceptionOr<void> delete_rule(u32 index);
 | |
| 
 | |
|     virtual void for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const;
 | |
| 
 | |
|     virtual void set_parent_style_sheet(CSSStyleSheet*) override;
 | |
| 
 | |
| protected:
 | |
|     explicit CSSGroupingRule(NonnullRefPtrVector<CSSRule>&&);
 | |
| 
 | |
| private:
 | |
|     NonnullRefPtr<CSSRuleList> m_rules;
 | |
| };
 | |
| 
 | |
| }
 |