mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-30 23:52:43 +00:00 
			
		
		
		
	 57a25139a5
			
		
	
	
		57a25139a5
		
	
	
	
	
		
			
			The main thing missing is that we don't serialize the supports clause,
but for actually using a `@supports (something: cool) {}` rule in CSS,
it works!
		
	
			
		
			
				
	
	
		
			46 lines
		
	
	
	
		
			857 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
	
		
			857 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2021, the SerenityOS developers.
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/RefCounted.h>
 | |
| #include <AK/String.h>
 | |
| #include <LibWeb/Bindings/Wrappable.h>
 | |
| #include <LibWeb/CSS/CSSStyleDeclaration.h>
 | |
| #include <LibWeb/CSS/Selector.h>
 | |
| 
 | |
| namespace Web::CSS {
 | |
| 
 | |
| class CSSRule
 | |
|     : public RefCounted<CSSRule>
 | |
|     , public Bindings::Wrappable {
 | |
| public:
 | |
|     using WrapperType = Bindings::CSSRuleWrapper;
 | |
| 
 | |
|     virtual ~CSSRule();
 | |
| 
 | |
|     enum class Type : u32 {
 | |
|         Style,
 | |
|         Import,
 | |
|         Media,
 | |
|         Supports,
 | |
|         __Count,
 | |
|     };
 | |
| 
 | |
|     virtual StringView class_name() const = 0;
 | |
|     virtual Type type() const = 0;
 | |
| 
 | |
|     String css_text() const;
 | |
|     void set_css_text(StringView);
 | |
| 
 | |
|     template<typename T>
 | |
|     bool fast_is() const = delete;
 | |
| 
 | |
| protected:
 | |
|     virtual String serialized() const = 0;
 | |
| };
 | |
| 
 | |
| }
 |