mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
LibWeb: Actually remove FontStyleValue
Whoops!
This commit is contained in:
parent
23d59a6caf
commit
fe499681d9
3 changed files with 1 additions and 80 deletions
|
@ -4112,7 +4112,7 @@ RefPtr<StyleValue> Parser::parse_font_value(Vector<ComponentValue> const& compon
|
|||
}
|
||||
|
||||
// Since normal is the default value for all the properties that can have it, we don't have to actually
|
||||
// set anything to normal here. It'll be set when we create the FontStyleValue below.
|
||||
// set anything to normal here. It'll be set when we create the ShorthandStyleValue below.
|
||||
// We just need to make sure we were not given more normals than will fit.
|
||||
int unset_value_count = (font_style ? 0 : 1) + (font_weight ? 0 : 1) + (font_variant ? 0 : 1) + (font_stretch ? 0 : 1);
|
||||
if (unset_value_count < normal_count)
|
||||
|
|
|
@ -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 "FontStyleValue.h"
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
String FontStyleValue::to_string() const
|
||||
{
|
||||
return MUST(String::formatted("{} {} {} / {} {}", m_properties.font_style->to_string(), m_properties.font_weight->to_string(), m_properties.font_size->to_string(), m_properties.line_height->to_string(), m_properties.font_families->to_string()));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +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 FontStyleValue final : public StyleValueWithDefaultOperators<FontStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<FontStyleValue> create(
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_stretch,
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_style,
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_weight,
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_size,
|
||||
ValueComparingNonnullRefPtr<StyleValue> line_height,
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_families)
|
||||
{
|
||||
return adopt_ref(*new (nothrow) FontStyleValue(move(font_stretch), move(font_style), move(font_weight), move(font_size), move(line_height), move(font_families)));
|
||||
}
|
||||
virtual ~FontStyleValue() override = default;
|
||||
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_stretch() const { return m_properties.font_stretch; }
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_style() const { return m_properties.font_style; }
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_weight() const { return m_properties.font_weight; }
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_size() const { return m_properties.font_size; }
|
||||
ValueComparingNonnullRefPtr<StyleValue> line_height() const { return m_properties.line_height; }
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_families() const { return m_properties.font_families; }
|
||||
|
||||
virtual String to_string() const override;
|
||||
|
||||
bool properties_equal(FontStyleValue const& other) const { return m_properties == other.m_properties; }
|
||||
|
||||
private:
|
||||
FontStyleValue(ValueComparingNonnullRefPtr<StyleValue> font_stretch, ValueComparingNonnullRefPtr<StyleValue> font_style, ValueComparingNonnullRefPtr<StyleValue> font_weight, ValueComparingNonnullRefPtr<StyleValue> font_size, ValueComparingNonnullRefPtr<StyleValue> line_height, ValueComparingNonnullRefPtr<StyleValue> font_families)
|
||||
: StyleValueWithDefaultOperators(Type::Font)
|
||||
, m_properties { .font_stretch = move(font_stretch), .font_style = move(font_style), .font_weight = move(font_weight), .font_size = move(font_size), .line_height = move(line_height), .font_families = move(font_families) }
|
||||
{
|
||||
}
|
||||
|
||||
struct Properties {
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_stretch;
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_style;
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_weight;
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_size;
|
||||
ValueComparingNonnullRefPtr<StyleValue> line_height;
|
||||
ValueComparingNonnullRefPtr<StyleValue> font_families;
|
||||
// FIXME: Implement font-variant.
|
||||
bool operator==(Properties const&) const = default;
|
||||
} m_properties;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue