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

LibWeb: Rename StyleDeclarationRule -> Declaration

This is the term used in the CSS specs.
This commit is contained in:
Sam Atkins 2022-03-31 14:36:12 +01:00 committed by Andreas Kling
parent 8b538b1578
commit 611a209756
6 changed files with 21 additions and 21 deletions

View file

@ -13,12 +13,12 @@
namespace Web::CSS { namespace Web::CSS {
class StyleDeclarationRule { class Declaration {
friend class Parser; friend class Parser;
public: public:
StyleDeclarationRule(); Declaration();
~StyleDeclarationRule(); ~Declaration();
String to_string() const; String to_string() const;

View file

@ -6,7 +6,7 @@
#pragma once #pragma once
#include <LibWeb/CSS/Parser/StyleDeclarationRule.h> #include <LibWeb/CSS/Parser/Declaration.h>
#include <LibWeb/CSS/Parser/StyleRule.h> #include <LibWeb/CSS/Parser/StyleRule.h>
namespace Web::CSS { namespace Web::CSS {
@ -16,7 +16,7 @@ class DeclarationOrAtRule {
public: public:
explicit DeclarationOrAtRule(RefPtr<StyleRule> at); explicit DeclarationOrAtRule(RefPtr<StyleRule> at);
explicit DeclarationOrAtRule(StyleDeclarationRule declaration); explicit DeclarationOrAtRule(Declaration declaration);
~DeclarationOrAtRule(); ~DeclarationOrAtRule();
enum class DeclarationType { enum class DeclarationType {
@ -33,7 +33,7 @@ public:
return *m_at; return *m_at;
} }
StyleDeclarationRule const& declaration() const Declaration const& declaration() const
{ {
VERIFY(is_declaration()); VERIFY(is_declaration());
return m_declaration; return m_declaration;
@ -44,7 +44,7 @@ public:
private: private:
DeclarationType m_type; DeclarationType m_type;
RefPtr<StyleRule> m_at; RefPtr<StyleRule> m_at;
StyleDeclarationRule m_declaration; Declaration m_declaration;
}; };
} }

View file

@ -1909,7 +1909,7 @@ NonnullRefPtr<StyleFunctionRule> Parser::consume_a_function(TokenStream<T>& toke
// 5.4.6. Consume a declaration // 5.4.6. Consume a declaration
// https://www.w3.org/TR/css-syntax-3/#consume-declaration // https://www.w3.org/TR/css-syntax-3/#consume-declaration
template<typename T> template<typename T>
Optional<StyleDeclarationRule> Parser::consume_a_declaration(TokenStream<T>& tokens) Optional<Declaration> Parser::consume_a_declaration(TokenStream<T>& tokens)
{ {
// Note: This algorithm assumes that the next input token has already been checked to // Note: This algorithm assumes that the next input token has already been checked to
// be an <ident-token>. // be an <ident-token>.
@ -1930,7 +1930,7 @@ Optional<StyleDeclarationRule> Parser::consume_a_declaration(TokenStream<T>& tok
// Create a new declaration with its name set to the value of the current input token // Create a new declaration with its name set to the value of the current input token
// and its value initially set to the empty list. // and its value initially set to the empty list.
StyleDeclarationRule declaration; Declaration declaration;
declaration.m_name = ((Token)token).ident(); declaration.m_name = ((Token)token).ident();
// 1. While the next input token is a <whitespace-token>, consume the next input token. // 1. While the next input token is a <whitespace-token>, consume the next input token.
@ -2170,7 +2170,7 @@ Optional<StyleProperty> Parser::parse_as_supports_condition()
// 5.3.6. Parse a declaration // 5.3.6. Parse a declaration
// https://www.w3.org/TR/css-syntax-3/#parse-a-declaration // https://www.w3.org/TR/css-syntax-3/#parse-a-declaration
template<typename T> template<typename T>
Optional<StyleDeclarationRule> Parser::parse_a_declaration(TokenStream<T>& tokens) Optional<Declaration> Parser::parse_a_declaration(TokenStream<T>& tokens)
{ {
// To parse a declaration from input: // To parse a declaration from input:
@ -2513,7 +2513,7 @@ RefPtr<PropertyOwningCSSStyleDeclaration> Parser::convert_to_style_declaration(V
return PropertyOwningCSSStyleDeclaration::create(move(properties), move(custom_properties)); return PropertyOwningCSSStyleDeclaration::create(move(properties), move(custom_properties));
} }
Optional<StyleProperty> Parser::convert_to_style_property(StyleDeclarationRule const& declaration) Optional<StyleProperty> Parser::convert_to_style_property(Declaration const& declaration)
{ {
auto& property_name = declaration.m_name; auto& property_name = declaration.m_name;
auto property_id = property_id_from_string(property_name); auto property_id = property_id_from_string(property_name);

View file

@ -16,9 +16,9 @@
#include <LibWeb/CSS/GeneralEnclosed.h> #include <LibWeb/CSS/GeneralEnclosed.h>
#include <LibWeb/CSS/MediaQuery.h> #include <LibWeb/CSS/MediaQuery.h>
#include <LibWeb/CSS/Parser/ComponentValue.h> #include <LibWeb/CSS/Parser/ComponentValue.h>
#include <LibWeb/CSS/Parser/Declaration.h>
#include <LibWeb/CSS/Parser/DeclarationOrAtRule.h> #include <LibWeb/CSS/Parser/DeclarationOrAtRule.h>
#include <LibWeb/CSS/Parser/StyleBlockRule.h> #include <LibWeb/CSS/Parser/StyleBlockRule.h>
#include <LibWeb/CSS/Parser/StyleDeclarationRule.h>
#include <LibWeb/CSS/Parser/StyleFunctionRule.h> #include <LibWeb/CSS/Parser/StyleFunctionRule.h>
#include <LibWeb/CSS/Parser/StyleRule.h> #include <LibWeb/CSS/Parser/StyleRule.h>
#include <LibWeb/CSS/Parser/Tokenizer.h> #include <LibWeb/CSS/Parser/Tokenizer.h>
@ -139,7 +139,7 @@ private:
// "Parse a declaration" is used in @supports conditions. [CSS3-CONDITIONAL] // "Parse a declaration" is used in @supports conditions. [CSS3-CONDITIONAL]
template<typename T> template<typename T>
Optional<StyleDeclarationRule> parse_a_declaration(TokenStream<T>&); Optional<Declaration> parse_a_declaration(TokenStream<T>&);
template<typename T> template<typename T>
Vector<DeclarationOrAtRule> parse_a_style_blocks_contents(TokenStream<T>&); Vector<DeclarationOrAtRule> parse_a_style_blocks_contents(TokenStream<T>&);
@ -192,7 +192,7 @@ private:
template<typename T> template<typename T>
[[nodiscard]] Vector<DeclarationOrAtRule> consume_a_list_of_declarations(TokenStream<T>&); [[nodiscard]] Vector<DeclarationOrAtRule> consume_a_list_of_declarations(TokenStream<T>&);
template<typename T> template<typename T>
Optional<StyleDeclarationRule> consume_a_declaration(TokenStream<T>&); Optional<Declaration> consume_a_declaration(TokenStream<T>&);
template<typename T> template<typename T>
[[nodiscard]] ComponentValue consume_a_component_value(TokenStream<T>&); [[nodiscard]] ComponentValue consume_a_component_value(TokenStream<T>&);
template<typename T> template<typename T>
@ -206,7 +206,7 @@ private:
RefPtr<CSSRule> convert_to_rule(NonnullRefPtr<StyleRule>); RefPtr<CSSRule> convert_to_rule(NonnullRefPtr<StyleRule>);
RefPtr<PropertyOwningCSSStyleDeclaration> convert_to_style_declaration(Vector<DeclarationOrAtRule> declarations); RefPtr<PropertyOwningCSSStyleDeclaration> convert_to_style_declaration(Vector<DeclarationOrAtRule> declarations);
Optional<StyleProperty> convert_to_style_property(StyleDeclarationRule const&); Optional<StyleProperty> convert_to_style_property(Declaration const&);
class Dimension { class Dimension {
public: public:

View file

@ -6,9 +6,9 @@
*/ */
#include <LibWeb/CSS/Parser/ComponentValue.h> #include <LibWeb/CSS/Parser/ComponentValue.h>
#include <LibWeb/CSS/Parser/Declaration.h>
#include <LibWeb/CSS/Parser/DeclarationOrAtRule.h> #include <LibWeb/CSS/Parser/DeclarationOrAtRule.h>
#include <LibWeb/CSS/Parser/StyleBlockRule.h> #include <LibWeb/CSS/Parser/StyleBlockRule.h>
#include <LibWeb/CSS/Parser/StyleDeclarationRule.h>
#include <LibWeb/CSS/Parser/StyleFunctionRule.h> #include <LibWeb/CSS/Parser/StyleFunctionRule.h>
#include <LibWeb/CSS/Parser/StyleRule.h> #include <LibWeb/CSS/Parser/StyleRule.h>
#include <LibWeb/CSS/Serialize.h> #include <LibWeb/CSS/Serialize.h>
@ -20,7 +20,7 @@ DeclarationOrAtRule::DeclarationOrAtRule(RefPtr<StyleRule> at)
, m_at(move(at)) , m_at(move(at))
{ {
} }
DeclarationOrAtRule::DeclarationOrAtRule(StyleDeclarationRule declaration) DeclarationOrAtRule::DeclarationOrAtRule(Declaration declaration)
: m_type(DeclarationType::Declaration) : m_type(DeclarationType::Declaration)
, m_declaration(move(declaration)) , m_declaration(move(declaration))
{ {
@ -50,8 +50,8 @@ ComponentValue::ComponentValue(NonnullRefPtr<StyleBlockRule> block)
} }
ComponentValue::~ComponentValue() = default; ComponentValue::~ComponentValue() = default;
StyleDeclarationRule::StyleDeclarationRule() = default; Declaration::Declaration() = default;
StyleDeclarationRule::~StyleDeclarationRule() = default; Declaration::~Declaration() = default;
StyleFunctionRule::StyleFunctionRule(String name) StyleFunctionRule::StyleFunctionRule(String name)
: m_name(move(name)) : m_name(move(name))
@ -146,7 +146,7 @@ String ComponentValue::to_debug_string() const
}); });
} }
String StyleDeclarationRule::to_string() const String Declaration::to_string() const
{ {
StringBuilder builder; StringBuilder builder;

View file

@ -12,7 +12,7 @@
#include <AK/Variant.h> #include <AK/Variant.h>
#include <AK/Vector.h> #include <AK/Vector.h>
#include <LibWeb/CSS/GeneralEnclosed.h> #include <LibWeb/CSS/GeneralEnclosed.h>
#include <LibWeb/CSS/Parser/StyleDeclarationRule.h> #include <LibWeb/CSS/Parser/Declaration.h>
namespace Web::CSS { namespace Web::CSS {