mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 16:52:43 +00:00 
			
		
		
		
	 279924242d
			
		
	
	
		279924242d
		
	
	
	
	
		
			
			This represents the value of properties assigned via their shorthands, and is expanded when computing actual property values.
		
			
				
	
	
		
			38 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2023, Ali Mohammad Pur <mpfard@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include "CompositeStyleValue.h"
 | |
| #include <LibWeb/CSS/StyleValues/StyleValueList.h>
 | |
| 
 | |
| namespace Web::CSS {
 | |
| 
 | |
| CompositeStyleValue::CompositeStyleValue(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values)
 | |
|     : StyleValueWithDefaultOperators(Type::Composite)
 | |
|     , m_properties { move(sub_properties), move(values) }
 | |
| {
 | |
|     if (m_properties.sub_properties.size() != m_properties.values.size()) {
 | |
|         dbgln("CompositeStyleValue: sub_properties and values must be the same size! {} != {}", m_properties.sub_properties.size(), m_properties.values.size());
 | |
|         VERIFY_NOT_REACHED();
 | |
|     }
 | |
| }
 | |
| 
 | |
| CompositeStyleValue::~CompositeStyleValue() = default;
 | |
| 
 | |
| ErrorOr<String> CompositeStyleValue::to_string() const
 | |
| {
 | |
|     StringBuilder builder;
 | |
|     auto first = true;
 | |
|     for (auto& value : m_properties.values) {
 | |
|         if (first)
 | |
|             first = false;
 | |
|         else
 | |
|             builder.append(' ');
 | |
|         builder.append(TRY(value->to_string()));
 | |
|     }
 | |
|     return builder.to_string();
 | |
| }
 | |
| 
 | |
| }
 |