mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-11-04 07:10:57 +00:00 
			
		
		
		
	This reverts 0e3487b9ab.
Back when I made that change, I thought we could make our StyleValue
classes match the typed-om definitions directly. However, they have
different requirements. Typed-om types need to be mutable and GCed,
whereas StyleValues are immutable and ideally wouldn't require a JS VM.
While I was already making such a cataclysmic change, I've moved it into
the StyleValues directory, because it *not* being there has bothered me
for a long time. 😅
		
	
			
		
			
				
	
	
		
			50 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
/*
 | 
						|
 * Copyright (c) 2025, Tim Ledbetter <tim.ledbetter@ladybird.org>
 | 
						|
 *
 | 
						|
 * SPDX-License-Identifier: BSD-2-Clause
 | 
						|
 */
 | 
						|
 | 
						|
#pragma once
 | 
						|
 | 
						|
#include <LibWeb/CSS/StyleValues/StyleValue.h>
 | 
						|
 | 
						|
namespace Web::CSS {
 | 
						|
 | 
						|
class BorderImageSliceStyleValue final : public StyleValueWithDefaultOperators<BorderImageSliceStyleValue> {
 | 
						|
public:
 | 
						|
    static ValueComparingNonnullRefPtr<BorderImageSliceStyleValue const> create(ValueComparingNonnullRefPtr<StyleValue const> top, ValueComparingNonnullRefPtr<StyleValue const> right, ValueComparingNonnullRefPtr<StyleValue const> bottom, ValueComparingNonnullRefPtr<StyleValue const> left, bool fill)
 | 
						|
    {
 | 
						|
        return adopt_ref(*new (nothrow) BorderImageSliceStyleValue(top, right, bottom, left, fill));
 | 
						|
    }
 | 
						|
 | 
						|
    virtual ~BorderImageSliceStyleValue() override = default;
 | 
						|
 | 
						|
    ValueComparingNonnullRefPtr<StyleValue const> top() const { return m_properties.top; }
 | 
						|
    ValueComparingNonnullRefPtr<StyleValue const> left() const { return m_properties.left; }
 | 
						|
    ValueComparingNonnullRefPtr<StyleValue const> bottom() const { return m_properties.bottom; }
 | 
						|
    ValueComparingNonnullRefPtr<StyleValue const> right() const { return m_properties.right; }
 | 
						|
 | 
						|
    bool fill() const { return m_properties.fill; }
 | 
						|
 | 
						|
    virtual String to_string(SerializationMode) const override;
 | 
						|
 | 
						|
    bool properties_equal(BorderImageSliceStyleValue const& other) const { return m_properties == other.m_properties; }
 | 
						|
 | 
						|
private:
 | 
						|
    BorderImageSliceStyleValue(ValueComparingNonnullRefPtr<StyleValue const> top, ValueComparingNonnullRefPtr<StyleValue const> right, ValueComparingNonnullRefPtr<StyleValue const> bottom, ValueComparingNonnullRefPtr<StyleValue const> left, bool fill)
 | 
						|
        : StyleValueWithDefaultOperators(Type::BorderImageSlice)
 | 
						|
        , m_properties { .top = move(top), .right = move(right), .bottom = move(bottom), .left = move(left), .fill = fill }
 | 
						|
    {
 | 
						|
    }
 | 
						|
 | 
						|
    struct Properties {
 | 
						|
        ValueComparingNonnullRefPtr<StyleValue const> top;
 | 
						|
        ValueComparingNonnullRefPtr<StyleValue const> right;
 | 
						|
        ValueComparingNonnullRefPtr<StyleValue const> bottom;
 | 
						|
        ValueComparingNonnullRefPtr<StyleValue const> left;
 | 
						|
        bool fill;
 | 
						|
        bool operator==(Properties const&) const = default;
 | 
						|
    } m_properties;
 | 
						|
};
 | 
						|
 | 
						|
}
 |