1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:27:44 +00:00

LibWeb: Use east const in StyleValue.{h,cpp}

This commit is contained in:
Sam Atkins 2021-10-18 15:26:38 +01:00 committed by Andreas Kling
parent 5d09f4abce
commit 58a0ca41a7
2 changed files with 16 additions and 16 deletions

View file

@ -367,7 +367,7 @@ Color IdentifierStyleValue::to_color(Layout::NodeWithStyle const& node) const
} }
} }
ImageStyleValue::ImageStyleValue(const AK::URL& url, DOM::Document* document) ImageStyleValue::ImageStyleValue(AK::URL const& url, DOM::Document* document)
: StyleValue(Type::Image) : StyleValue(Type::Image)
, m_url(url) , m_url(url)
, m_document(document) , m_document(document)

View file

@ -340,10 +340,10 @@ public:
virtual float to_number() const { return {}; } virtual float to_number() const { return {}; }
virtual String to_string() const = 0; virtual String to_string() const = 0;
bool operator==(const StyleValue& other) const { return equals(other); } bool operator==(StyleValue const& other) const { return equals(other); }
bool operator!=(const StyleValue& other) const { return !(*this == other); } bool operator!=(StyleValue const& other) const { return !(*this == other); }
virtual bool equals(const StyleValue& other) const virtual bool equals(StyleValue const& other) const
{ {
if (type() != other.type()) if (type() != other.type())
return false; return false;
@ -679,7 +679,7 @@ public:
virtual bool has_color() const override { return true; } virtual bool has_color() const override { return true; }
virtual Color to_color(Layout::NodeWithStyle const&) const override { return m_color; } virtual Color to_color(Layout::NodeWithStyle const&) const override { return m_color; }
virtual bool equals(const StyleValue& other) const override virtual bool equals(StyleValue const& other) const override
{ {
if (type() != other.type()) if (type() != other.type())
return false; return false;
@ -733,7 +733,7 @@ private:
// FIXME: Allow for fallback // FIXME: Allow for fallback
class CustomStyleValue : public StyleValue { class CustomStyleValue : public StyleValue {
public: public:
static NonnullRefPtr<CustomStyleValue> create(const String& custom_property_name) static NonnullRefPtr<CustomStyleValue> create(String const& custom_property_name)
{ {
return adopt_ref(*new CustomStyleValue(custom_property_name)); return adopt_ref(*new CustomStyleValue(custom_property_name));
} }
@ -741,7 +741,7 @@ public:
String to_string() const override { return m_custom_property_name; } String to_string() const override { return m_custom_property_name; }
private: private:
explicit CustomStyleValue(const String& custom_property_name) explicit CustomStyleValue(String const& custom_property_name)
: StyleValue(Type::CustomProperty) : StyleValue(Type::CustomProperty)
, m_custom_property_name(custom_property_name) , m_custom_property_name(custom_property_name)
{ {
@ -868,7 +868,7 @@ public:
virtual Color to_color(Layout::NodeWithStyle const& node) const override; virtual Color to_color(Layout::NodeWithStyle const& node) const override;
virtual String to_string() const override; virtual String to_string() const override;
virtual bool equals(const StyleValue& other) const override virtual bool equals(StyleValue const& other) const override
{ {
if (type() != other.type()) if (type() != other.type())
return false; return false;
@ -889,7 +889,7 @@ class ImageStyleValue final
: public StyleValue : public StyleValue
, public ImageResourceClient { , public ImageResourceClient {
public: public:
static NonnullRefPtr<ImageStyleValue> create(const AK::URL& url, DOM::Document* document) { return adopt_ref(*new ImageStyleValue(url, document)); } static NonnullRefPtr<ImageStyleValue> create(AK::URL const& url, DOM::Document* document) { return adopt_ref(*new ImageStyleValue(url, document)); }
virtual ~ImageStyleValue() override { } virtual ~ImageStyleValue() override { }
String to_string() const override { return String::formatted("Image({})", m_url.to_string()); } String to_string() const override { return String::formatted("Image({})", m_url.to_string()); }
@ -897,7 +897,7 @@ public:
const Gfx::Bitmap* bitmap() const { return m_bitmap; } const Gfx::Bitmap* bitmap() const { return m_bitmap; }
private: private:
ImageStyleValue(const AK::URL&, DOM::Document*); ImageStyleValue(AK::URL const&, DOM::Document*);
// ^ResourceClient // ^ResourceClient
virtual void resource_did_load() override; virtual void resource_did_load() override;
@ -945,7 +945,7 @@ private:
class LengthStyleValue : public StyleValue { class LengthStyleValue : public StyleValue {
public: public:
static NonnullRefPtr<LengthStyleValue> create(const Length& length) static NonnullRefPtr<LengthStyleValue> create(Length const& length)
{ {
return adopt_ref(*new LengthStyleValue(length)); return adopt_ref(*new LengthStyleValue(length));
} }
@ -958,15 +958,15 @@ public:
virtual String to_string() const override { return m_length.to_string(); } virtual String to_string() const override { return m_length.to_string(); }
virtual Length to_length() const override { return m_length; } virtual Length to_length() const override { return m_length; }
virtual bool equals(const StyleValue& other) const override virtual bool equals(StyleValue const& other) const override
{ {
if (type() != other.type()) if (type() != other.type())
return false; return false;
return m_length == static_cast<const LengthStyleValue&>(other).m_length; return m_length == static_cast<LengthStyleValue const&>(other).m_length;
} }
private: private:
explicit LengthStyleValue(const Length& length) explicit LengthStyleValue(Length const& length)
: StyleValue(Type::Length) : StyleValue(Type::Length)
, m_length(length) , m_length(length)
{ {
@ -1082,7 +1082,7 @@ private:
class StringStyleValue : public StyleValue { class StringStyleValue : public StyleValue {
public: public:
static NonnullRefPtr<StringStyleValue> create(const String& string) static NonnullRefPtr<StringStyleValue> create(String const& string)
{ {
return adopt_ref(*new StringStyleValue(string)); return adopt_ref(*new StringStyleValue(string));
} }
@ -1091,7 +1091,7 @@ public:
String to_string() const override { return m_string; } String to_string() const override { return m_string; }
private: private:
explicit StringStyleValue(const String& string) explicit StringStyleValue(String const& string)
: StyleValue(Type::String) : StyleValue(Type::String)
, m_string(string) , m_string(string)
{ {