mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Use existing StyleValues for math-depth
Previously we implemented an all encompassing `MathDepthStyleValue` specifically for the `math-depth` property, this was unnecessary since we can represent `auto-add` and `<integer>` using existing `StyleValue` classes. This brings the values created from parsing in line with those set via `StylePropertyMap` which allows us to simplify computation
This commit is contained in:
Notes:
github-actions[bot]
2026-01-15 12:04:30 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/eb5b73d3b5c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7464 Reviewed-by: https://github.com/AtkinsSJ ✅
38
Libraries/LibWeb/CSS/StyleValues/AddFunctionStyleValue.h
Normal file
38
Libraries/LibWeb/CSS/StyleValues/AddFunctionStyleValue.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2026, Callum Law <callumlaw1709@outlook.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/CSS/StyleValues/StyleValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
class AddFunctionStyleValue : public StyleValueWithDefaultOperators<AddFunctionStyleValue> {
|
||||
public:
|
||||
static NonnullRefPtr<AddFunctionStyleValue> create(NonnullRefPtr<StyleValue const> value)
|
||||
{
|
||||
return adopt_ref(*new AddFunctionStyleValue(move(value)));
|
||||
}
|
||||
|
||||
NonnullRefPtr<StyleValue const> value() const { return m_value; }
|
||||
virtual void serialize(StringBuilder&, SerializationMode) const override;
|
||||
|
||||
bool properties_equal(AddFunctionStyleValue const& other) const { return m_value == other.m_value; }
|
||||
|
||||
private:
|
||||
AddFunctionStyleValue(NonnullRefPtr<StyleValue const> value)
|
||||
: StyleValueWithDefaultOperators(Type::AddFunction)
|
||||
, m_value(move(value))
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~AddFunctionStyleValue() override = default;
|
||||
|
||||
ValueComparingNonnullRefPtr<StyleValue const> m_value;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user