mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:17:35 +00:00
LibWeb: Cache and reuse some very common StyleValue objects
Length values: auto, 0px, 1px Color values: black, white, transparent
This commit is contained in:
parent
141b01d3e3
commit
bfe69e9d0d
3 changed files with 42 additions and 8 deletions
|
@ -856,10 +856,7 @@ private:
|
|||
|
||||
class ColorStyleValue : public StyleValue {
|
||||
public:
|
||||
static NonnullRefPtr<ColorStyleValue> create(Color color)
|
||||
{
|
||||
return adopt_ref(*new ColorStyleValue(color));
|
||||
}
|
||||
static NonnullRefPtr<ColorStyleValue> create(Color color);
|
||||
virtual ~ColorStyleValue() override { }
|
||||
|
||||
Color color() const { return m_color; }
|
||||
|
@ -1101,10 +1098,7 @@ private:
|
|||
|
||||
class LengthStyleValue : public StyleValue {
|
||||
public:
|
||||
static NonnullRefPtr<LengthStyleValue> create(Length const& length)
|
||||
{
|
||||
return adopt_ref(*new LengthStyleValue(length));
|
||||
}
|
||||
static NonnullRefPtr<LengthStyleValue> create(Length const&);
|
||||
virtual ~LengthStyleValue() override { }
|
||||
|
||||
Length const& length() const { return m_length; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue