1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:47:45 +00:00

LibWeb: Rename CompositeStyleValue -> ShorthandStyleValue

It's a shorthand, so let's call it that. :^)
This commit is contained in:
Sam Atkins 2023-09-19 12:21:15 +01:00 committed by Sam Atkins
parent 69482f1f14
commit d20254f1bc
9 changed files with 24 additions and 24 deletions

View file

@ -4,24 +4,24 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "CompositeStyleValue.h"
#include "ShorthandStyleValue.h"
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
namespace Web::CSS {
CompositeStyleValue::CompositeStyleValue(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values)
: StyleValueWithDefaultOperators(Type::Composite)
ShorthandStyleValue::ShorthandStyleValue(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values)
: StyleValueWithDefaultOperators(Type::Shorthand)
, m_properties { move(sub_properties), move(values) }
{
if (m_properties.sub_properties.size() != m_properties.values.size()) {
dbgln("CompositeStyleValue: sub_properties and values must be the same size! {} != {}", m_properties.sub_properties.size(), m_properties.values.size());
dbgln("ShorthandStyleValue: sub_properties and values must be the same size! {} != {}", m_properties.sub_properties.size(), m_properties.values.size());
VERIFY_NOT_REACHED();
}
}
CompositeStyleValue::~CompositeStyleValue() = default;
ShorthandStyleValue::~ShorthandStyleValue() = default;
String CompositeStyleValue::to_string() const
String ShorthandStyleValue::to_string() const
{
StringBuilder builder;
auto first = true;

View file

@ -10,23 +10,23 @@
namespace Web::CSS {
class CompositeStyleValue final : public StyleValueWithDefaultOperators<CompositeStyleValue> {
class ShorthandStyleValue final : public StyleValueWithDefaultOperators<ShorthandStyleValue> {
public:
static ValueComparingNonnullRefPtr<CompositeStyleValue> create(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values)
static ValueComparingNonnullRefPtr<ShorthandStyleValue> create(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values)
{
return adopt_ref(*new CompositeStyleValue(move(sub_properties), move(values)));
return adopt_ref(*new ShorthandStyleValue(move(sub_properties), move(values)));
}
virtual ~CompositeStyleValue() override;
virtual ~ShorthandStyleValue() override;
Vector<PropertyID> const& sub_properties() const { return m_properties.sub_properties; }
Vector<ValueComparingNonnullRefPtr<StyleValue const>> const& values() const { return m_properties.values; }
virtual String to_string() const override;
bool properties_equal(CompositeStyleValue const& other) const { return m_properties == other.m_properties; }
bool properties_equal(ShorthandStyleValue const& other) const { return m_properties == other.m_properties; }
private:
CompositeStyleValue(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values);
ShorthandStyleValue(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values);
struct Properties {
Vector<PropertyID> sub_properties;