mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-30 21:01:00 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			43 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2025, Ladybird contributors
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
 | |
| 
 | |
| namespace Web::CSS {
 | |
| 
 | |
| // https://drafts.csswg.org/css-color-5/#funcdef-light-dark
 | |
| class LightDarkStyleValue final : public ColorStyleValue {
 | |
| public:
 | |
|     virtual ~LightDarkStyleValue() override = default;
 | |
| 
 | |
|     static ValueComparingNonnullRefPtr<LightDarkStyleValue const> create(ValueComparingNonnullRefPtr<StyleValue const> light, ValueComparingNonnullRefPtr<StyleValue const> dark)
 | |
|     {
 | |
|         return AK::adopt_ref(*new (nothrow) LightDarkStyleValue(move(light), move(dark)));
 | |
|     }
 | |
| 
 | |
|     virtual bool equals(StyleValue const&) const override;
 | |
|     virtual Optional<Color> to_color(ColorResolutionContext) const override;
 | |
|     virtual String to_string(SerializationMode) const override;
 | |
| 
 | |
| private:
 | |
|     LightDarkStyleValue(ValueComparingNonnullRefPtr<StyleValue const> light, ValueComparingNonnullRefPtr<StyleValue const> dark)
 | |
|         : ColorStyleValue(ColorStyleValue::ColorType::LightDark, ColorSyntax::Modern)
 | |
|         , m_properties { .light = move(light), .dark = move(dark) }
 | |
|     {
 | |
|     }
 | |
| 
 | |
|     struct Properties {
 | |
|         ValueComparingNonnullRefPtr<StyleValue const> light;
 | |
|         ValueComparingNonnullRefPtr<StyleValue const> dark;
 | |
|         bool operator==(Properties const&) const = default;
 | |
|     };
 | |
| 
 | |
|     Properties m_properties;
 | |
| };
 | |
| 
 | |
| } // Web::CSS
 | 
