mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 13:20:59 +00:00 
			
		
		
		
	 37ea9a4ce3
			
		
	
	
		37ea9a4ce3
		
	
	
	
	
		
			
			This isn't part of the CSSOM API directly, but will be used by StylePropertyMapReadOnly.has() to avoid doing the work to serialize a string version of the property's value, just to throw it away again.
		
			
				
	
	
		
			53 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibWeb/CSS/CSSStyleDeclaration.h>
 | |
| #include <LibWeb/CSS/Descriptor.h>
 | |
| #include <LibWeb/CSS/DescriptorID.h>
 | |
| 
 | |
| namespace Web::CSS {
 | |
| 
 | |
| // A non-spec base class for descriptor-list classes
 | |
| class CSSDescriptors : public CSSStyleDeclaration {
 | |
|     WEB_PLATFORM_OBJECT(CSSDescriptors, CSSStyleDeclaration);
 | |
| 
 | |
| public:
 | |
|     virtual ~CSSDescriptors() override;
 | |
| 
 | |
|     virtual size_t length() const override;
 | |
|     virtual String item(size_t index) const override;
 | |
|     virtual WebIDL::ExceptionOr<void> set_property(StringView property, StringView value, StringView priority) override;
 | |
|     virtual WebIDL::ExceptionOr<String> remove_property(StringView property) override;
 | |
|     virtual String get_property_value(StringView property) const override;
 | |
|     virtual StringView get_property_priority(StringView property) const override;
 | |
| 
 | |
|     Vector<Descriptor> const& descriptors() const { return m_descriptors; }
 | |
|     RefPtr<StyleValue const> descriptor(DescriptorID) const;
 | |
|     RefPtr<StyleValue const> descriptor_or_initial_value(DescriptorID) const;
 | |
|     virtual String serialized() const override;
 | |
| 
 | |
|     virtual WebIDL::ExceptionOr<void> set_css_text(StringView) override;
 | |
| 
 | |
|     virtual bool has_property(StringView property_name) const override;
 | |
| 
 | |
| protected:
 | |
|     CSSDescriptors(JS::Realm&, AtRuleID, Vector<Descriptor>);
 | |
| 
 | |
| private:
 | |
|     bool set_a_css_declaration(DescriptorID, NonnullRefPtr<StyleValue const>, Important);
 | |
| 
 | |
|     virtual void visit_edges(Visitor&) override;
 | |
| 
 | |
|     AtRuleID m_at_rule_id;
 | |
|     Vector<Descriptor> m_descriptors;
 | |
| };
 | |
| 
 | |
| bool is_shorthand(AtRuleID, DescriptorID);
 | |
| void for_each_expanded_longhand(AtRuleID, DescriptorID, RefPtr<StyleValue const>, Function<void(DescriptorID, RefPtr<StyleValue const>)>);
 | |
| 
 | |
| }
 |