mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 02:02:45 +00:00 
			
		
		
		
	 a8587fe54e
			
		
	
	
		a8587fe54e
		
	
	
	
	
		
			
			Adds support for place-items property which allows to specify both align-items and justify-items in a single declaration.
		
			
				
	
	
		
			42 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <LibWeb/CSS/StyleValue.h>
 | |
| 
 | |
| namespace Web::CSS {
 | |
| 
 | |
| class PlaceItemsStyleValue final : public StyleValueWithDefaultOperators<PlaceItemsStyleValue> {
 | |
| public:
 | |
|     static ErrorOr<ValueComparingNonnullRefPtr<PlaceItemsStyleValue>> create(ValueComparingNonnullRefPtr<StyleValue> align_items, ValueComparingNonnullRefPtr<StyleValue> justify_items)
 | |
|     {
 | |
|         return adopt_nonnull_ref_or_enomem(new (nothrow) PlaceItemsStyleValue(move(align_items), move(justify_items)));
 | |
|     }
 | |
|     virtual ~PlaceItemsStyleValue() override = default;
 | |
| 
 | |
|     ValueComparingNonnullRefPtr<StyleValue> align_items() const { return m_properties.align_items; }
 | |
|     ValueComparingNonnullRefPtr<StyleValue> justify_items() const { return m_properties.justify_items; }
 | |
| 
 | |
|     virtual ErrorOr<String> to_string() const override;
 | |
| 
 | |
|     bool properties_equal(PlaceItemsStyleValue const& other) const { return m_properties == other.m_properties; }
 | |
| 
 | |
| private:
 | |
|     PlaceItemsStyleValue(ValueComparingNonnullRefPtr<StyleValue> align_items, ValueComparingNonnullRefPtr<StyleValue> justify_items)
 | |
|         : StyleValueWithDefaultOperators(Type::PlaceItems)
 | |
|         , m_properties { .align_items = move(align_items), .justify_items = move(justify_items) }
 | |
|     {
 | |
|     }
 | |
| 
 | |
|     struct Properties {
 | |
|         ValueComparingNonnullRefPtr<StyleValue> align_items;
 | |
|         ValueComparingNonnullRefPtr<StyleValue> justify_items;
 | |
|         bool operator==(Properties const&) const = default;
 | |
|     } m_properties;
 | |
| };
 | |
| 
 | |
| }
 |