mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:27:45 +00:00
LibWeb: Replace TextDecorationStyleValue with ShorthandStyleValue
This commit is contained in:
parent
d40b3f2a34
commit
8efac89a16
11 changed files with 8 additions and 95 deletions
|
@ -168,6 +168,8 @@ String ShorthandStyleValue::to_string() const
|
|||
return align_self;
|
||||
return MUST(String::formatted("{} {}", align_self, justify_self));
|
||||
}
|
||||
case PropertyID::TextDecoration:
|
||||
return MUST(String::formatted("{} {} {} {}", longhand(PropertyID::TextDecorationLine)->to_string(), longhand(PropertyID::TextDecorationThickness)->to_string(), longhand(PropertyID::TextDecorationStyle)->to_string(), longhand(PropertyID::TextDecorationColor)->to_string()));
|
||||
default:
|
||||
StringBuilder builder;
|
||||
auto first = true;
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
||||
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "TextDecorationStyleValue.h"
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
String TextDecorationStyleValue::to_string() const
|
||||
{
|
||||
return MUST(String::formatted("{} {} {} {}", m_properties.line->to_string(), m_properties.thickness->to_string(), m_properties.style->to_string(), m_properties.color->to_string()));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
|
||||
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2022-2023, MacDue <macdue@dueutil.tech>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/CSS/StyleValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
class TextDecorationStyleValue final : public StyleValueWithDefaultOperators<TextDecorationStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<TextDecorationStyleValue> create(
|
||||
ValueComparingNonnullRefPtr<StyleValue> line,
|
||||
ValueComparingNonnullRefPtr<StyleValue> thickness,
|
||||
ValueComparingNonnullRefPtr<StyleValue> style,
|
||||
ValueComparingNonnullRefPtr<StyleValue> color)
|
||||
{
|
||||
return adopt_ref(*new (nothrow) TextDecorationStyleValue(move(line), move(thickness), move(style), move(color)));
|
||||
}
|
||||
virtual ~TextDecorationStyleValue() override = default;
|
||||
|
||||
ValueComparingNonnullRefPtr<StyleValue> line() const { return m_properties.line; }
|
||||
ValueComparingNonnullRefPtr<StyleValue> thickness() const { return m_properties.thickness; }
|
||||
ValueComparingNonnullRefPtr<StyleValue> style() const { return m_properties.style; }
|
||||
ValueComparingNonnullRefPtr<StyleValue> color() const { return m_properties.color; }
|
||||
|
||||
virtual String to_string() const override;
|
||||
|
||||
bool properties_equal(TextDecorationStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||
|
||||
private:
|
||||
TextDecorationStyleValue(
|
||||
ValueComparingNonnullRefPtr<StyleValue> line,
|
||||
ValueComparingNonnullRefPtr<StyleValue> thickness,
|
||||
ValueComparingNonnullRefPtr<StyleValue> style,
|
||||
ValueComparingNonnullRefPtr<StyleValue> color)
|
||||
: StyleValueWithDefaultOperators(Type::TextDecoration)
|
||||
, m_properties { .line = move(line), .thickness = move(thickness), .style = move(style), .color = move(color) }
|
||||
{
|
||||
}
|
||||
|
||||
struct Properties {
|
||||
ValueComparingNonnullRefPtr<StyleValue> line;
|
||||
ValueComparingNonnullRefPtr<StyleValue> thickness;
|
||||
ValueComparingNonnullRefPtr<StyleValue> style;
|
||||
ValueComparingNonnullRefPtr<StyleValue> color;
|
||||
bool operator==(Properties const&) const = default;
|
||||
} m_properties;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue