mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibWeb: Rename CompositeStyleValue -> ShorthandStyleValue
It's a shorthand, so let's call it that. :^)
This commit is contained in:
parent
69482f1f14
commit
d20254f1bc
9 changed files with 24 additions and 24 deletions
|
@ -11,7 +11,6 @@ source_set("StyleValues") {
|
||||||
"BorderStyleValue.cpp",
|
"BorderStyleValue.cpp",
|
||||||
"CalculatedStyleValue.cpp",
|
"CalculatedStyleValue.cpp",
|
||||||
"ColorStyleValue.cpp",
|
"ColorStyleValue.cpp",
|
||||||
"CompositeStyleValue.cpp",
|
|
||||||
"ConicGradientStyleValue.cpp",
|
"ConicGradientStyleValue.cpp",
|
||||||
"ContentStyleValue.cpp",
|
"ContentStyleValue.cpp",
|
||||||
"DisplayStyleValue.cpp",
|
"DisplayStyleValue.cpp",
|
||||||
|
@ -44,6 +43,7 @@ source_set("StyleValues") {
|
||||||
"RadialGradientStyleValue.cpp",
|
"RadialGradientStyleValue.cpp",
|
||||||
"RectStyleValue.cpp",
|
"RectStyleValue.cpp",
|
||||||
"ShadowStyleValue.cpp",
|
"ShadowStyleValue.cpp",
|
||||||
|
"ShorthandStyleValue.cpp",
|
||||||
"StyleValueList.cpp",
|
"StyleValueList.cpp",
|
||||||
"TextDecorationStyleValue.cpp",
|
"TextDecorationStyleValue.cpp",
|
||||||
"TransformationStyleValue.cpp",
|
"TransformationStyleValue.cpp",
|
||||||
|
|
|
@ -88,7 +88,6 @@ set(SOURCES
|
||||||
CSS/StyleValues/BorderStyleValue.cpp
|
CSS/StyleValues/BorderStyleValue.cpp
|
||||||
CSS/StyleValues/CalculatedStyleValue.cpp
|
CSS/StyleValues/CalculatedStyleValue.cpp
|
||||||
CSS/StyleValues/ColorStyleValue.cpp
|
CSS/StyleValues/ColorStyleValue.cpp
|
||||||
CSS/StyleValues/CompositeStyleValue.cpp
|
|
||||||
CSS/StyleValues/ConicGradientStyleValue.cpp
|
CSS/StyleValues/ConicGradientStyleValue.cpp
|
||||||
CSS/StyleValues/ContentStyleValue.cpp
|
CSS/StyleValues/ContentStyleValue.cpp
|
||||||
CSS/StyleValues/DisplayStyleValue.cpp
|
CSS/StyleValues/DisplayStyleValue.cpp
|
||||||
|
@ -121,6 +120,7 @@ set(SOURCES
|
||||||
CSS/StyleValues/RadialGradientStyleValue.cpp
|
CSS/StyleValues/RadialGradientStyleValue.cpp
|
||||||
CSS/StyleValues/RectStyleValue.cpp
|
CSS/StyleValues/RectStyleValue.cpp
|
||||||
CSS/StyleValues/ShadowStyleValue.cpp
|
CSS/StyleValues/ShadowStyleValue.cpp
|
||||||
|
CSS/StyleValues/ShorthandStyleValue.cpp
|
||||||
CSS/StyleValues/StyleValueList.cpp
|
CSS/StyleValues/StyleValueList.cpp
|
||||||
CSS/StyleValues/TextDecorationStyleValue.cpp
|
CSS/StyleValues/TextDecorationStyleValue.cpp
|
||||||
CSS/StyleValues/TransformationStyleValue.cpp
|
CSS/StyleValues/TransformationStyleValue.cpp
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
#include <LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/BorderStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/BorderStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/CompositeStyleValue.h>
|
|
||||||
#include <LibWeb/CSS/StyleValues/ContentStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/ContentStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/CustomIdentStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/CustomIdentStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
|
||||||
|
@ -80,6 +79,7 @@
|
||||||
#include <LibWeb/CSS/StyleValues/ResolutionStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/ResolutionStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/RevertStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/RevertStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
|
||||||
|
#include <LibWeb/CSS/StyleValues/ShorthandStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
||||||
#include <LibWeb/CSS/StyleValues/TextDecorationStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/TextDecorationStyleValue.h>
|
||||||
|
@ -6003,7 +6003,7 @@ Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(Property
|
||||||
longhand_values.unchecked_append(StyleValueList::create(move(it.value), StyleValueList::Separator::Space));
|
longhand_values.unchecked_append(StyleValueList::create(move(it.value), StyleValueList::Separator::Space));
|
||||||
}
|
}
|
||||||
|
|
||||||
return { CompositeStyleValue::create(move(longhand_properties), move(longhand_values)) };
|
return { ShorthandStyleValue::create(move(longhand_properties), move(longhand_values)) };
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<StyleValue> Parser::parse_css_value_for_property(PropertyID property_id, TokenStream<ComponentValue>& tokens)
|
RefPtr<StyleValue> Parser::parse_css_value_for_property(PropertyID property_id, TokenStream<ComponentValue>& tokens)
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include <LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/BorderRadiusStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/BorderStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/BorderStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/CompositeStyleValue.h>
|
|
||||||
#include <LibWeb/CSS/StyleValues/CustomIdentStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/CustomIdentStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/EasingStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/EasingStyleValue.h>
|
||||||
|
@ -61,6 +60,7 @@
|
||||||
#include <LibWeb/CSS/StyleValues/PlaceSelfStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/PlaceSelfStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/RectStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/RectStyleValue.h>
|
||||||
|
#include <LibWeb/CSS/StyleValues/ShorthandStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
||||||
#include <LibWeb/CSS/StyleValues/TextDecorationStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/TextDecorationStyleValue.h>
|
||||||
|
@ -442,10 +442,10 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.is_composite()) {
|
if (value.is_shorthand()) {
|
||||||
auto& composite_value = value.as_composite();
|
auto& shorthand_value = value.as_shorthand();
|
||||||
auto& properties = composite_value.sub_properties();
|
auto& properties = shorthand_value.sub_properties();
|
||||||
auto& values = composite_value.values();
|
auto& values = shorthand_value.values();
|
||||||
for (size_t i = 0; i < properties.size(); ++i)
|
for (size_t i = 0; i < properties.size(); ++i)
|
||||||
set_property_expanding_shorthands(style, properties[i], values[i], document, declaration, properties_for_revert);
|
set_property_expanding_shorthands(style, properties[i], values[i], document, declaration, properties_for_revert);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include <LibWeb/CSS/StyleValues/BorderStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/BorderStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/CalculatedStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/CalculatedStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/CompositeStyleValue.h>
|
|
||||||
#include <LibWeb/CSS/StyleValues/ConicGradientStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/ConicGradientStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/ContentStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/ContentStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/CustomIdentStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/CustomIdentStyleValue.h>
|
||||||
|
@ -61,6 +60,7 @@
|
||||||
#include <LibWeb/CSS/StyleValues/ResolutionStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/ResolutionStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/RevertStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/RevertStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
|
||||||
|
#include <LibWeb/CSS/StyleValues/ShorthandStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
|
||||||
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
||||||
#include <LibWeb/CSS/StyleValues/TextDecorationStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/TextDecorationStyleValue.h>
|
||||||
|
|
|
@ -92,7 +92,6 @@ using StyleValueVector = Vector<ValueComparingNonnullRefPtr<StyleValue const>>;
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(BorderRadiusShorthand, border_radius_shorthand) \
|
__ENUMERATE_STYLE_VALUE_TYPE(BorderRadiusShorthand, border_radius_shorthand) \
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(Calculated, calculated) \
|
__ENUMERATE_STYLE_VALUE_TYPE(Calculated, calculated) \
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(Color, color) \
|
__ENUMERATE_STYLE_VALUE_TYPE(Color, color) \
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(Composite, composite) \
|
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(ConicGradient, conic_gradient) \
|
__ENUMERATE_STYLE_VALUE_TYPE(ConicGradient, conic_gradient) \
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(Content, content) \
|
__ENUMERATE_STYLE_VALUE_TYPE(Content, content) \
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(CustomIdent, custom_ident) \
|
__ENUMERATE_STYLE_VALUE_TYPE(CustomIdent, custom_ident) \
|
||||||
|
@ -133,6 +132,7 @@ using StyleValueVector = Vector<ValueComparingNonnullRefPtr<StyleValue const>>;
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(Resolution, resolution) \
|
__ENUMERATE_STYLE_VALUE_TYPE(Resolution, resolution) \
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(Revert, revert) \
|
__ENUMERATE_STYLE_VALUE_TYPE(Revert, revert) \
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(Shadow, shadow) \
|
__ENUMERATE_STYLE_VALUE_TYPE(Shadow, shadow) \
|
||||||
|
__ENUMERATE_STYLE_VALUE_TYPE(Shorthand, shorthand) \
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(String, string) \
|
__ENUMERATE_STYLE_VALUE_TYPE(String, string) \
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(TextDecoration, text_decoration) \
|
__ENUMERATE_STYLE_VALUE_TYPE(TextDecoration, text_decoration) \
|
||||||
__ENUMERATE_STYLE_VALUE_TYPE(Time, time) \
|
__ENUMERATE_STYLE_VALUE_TYPE(Time, time) \
|
||||||
|
|
|
@ -4,24 +4,24 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CompositeStyleValue.h"
|
#include "ShorthandStyleValue.h"
|
||||||
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
CompositeStyleValue::CompositeStyleValue(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values)
|
ShorthandStyleValue::ShorthandStyleValue(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values)
|
||||||
: StyleValueWithDefaultOperators(Type::Composite)
|
: StyleValueWithDefaultOperators(Type::Shorthand)
|
||||||
, m_properties { move(sub_properties), move(values) }
|
, m_properties { move(sub_properties), move(values) }
|
||||||
{
|
{
|
||||||
if (m_properties.sub_properties.size() != m_properties.values.size()) {
|
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();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CompositeStyleValue::~CompositeStyleValue() = default;
|
ShorthandStyleValue::~ShorthandStyleValue() = default;
|
||||||
|
|
||||||
String CompositeStyleValue::to_string() const
|
String ShorthandStyleValue::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
auto first = true;
|
auto first = true;
|
|
@ -10,23 +10,23 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
class CompositeStyleValue final : public StyleValueWithDefaultOperators<CompositeStyleValue> {
|
class ShorthandStyleValue final : public StyleValueWithDefaultOperators<ShorthandStyleValue> {
|
||||||
public:
|
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<PropertyID> const& sub_properties() const { return m_properties.sub_properties; }
|
||||||
Vector<ValueComparingNonnullRefPtr<StyleValue const>> const& values() const { return m_properties.values; }
|
Vector<ValueComparingNonnullRefPtr<StyleValue const>> const& values() const { return m_properties.values; }
|
||||||
|
|
||||||
virtual String to_string() const override;
|
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:
|
private:
|
||||||
CompositeStyleValue(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values);
|
ShorthandStyleValue(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values);
|
||||||
|
|
||||||
struct Properties {
|
struct Properties {
|
||||||
Vector<PropertyID> sub_properties;
|
Vector<PropertyID> sub_properties;
|
|
@ -94,7 +94,6 @@ class CSSSupportsRule;
|
||||||
class CalculatedStyleValue;
|
class CalculatedStyleValue;
|
||||||
class Clip;
|
class Clip;
|
||||||
class ColorStyleValue;
|
class ColorStyleValue;
|
||||||
class CompositeStyleValue;
|
|
||||||
class ConicGradientStyleValue;
|
class ConicGradientStyleValue;
|
||||||
class ContentStyleValue;
|
class ContentStyleValue;
|
||||||
class CustomIdentStyleValue;
|
class CustomIdentStyleValue;
|
||||||
|
@ -164,6 +163,7 @@ class RevertStyleValue;
|
||||||
class Screen;
|
class Screen;
|
||||||
class Selector;
|
class Selector;
|
||||||
class ShadowStyleValue;
|
class ShadowStyleValue;
|
||||||
|
class ShorthandStyleValue;
|
||||||
class Size;
|
class Size;
|
||||||
class StringStyleValue;
|
class StringStyleValue;
|
||||||
class StyleComputer;
|
class StyleComputer;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue