diff options
author | Sam Atkins <atkinssj@gmail.com> | 2021-08-20 12:08:53 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-25 12:14:34 +0200 |
commit | 6d39f4342d48e0be49f217ab491407123547e99f (patch) | |
tree | 422bbc12b867e7c39107ad922ce30a16e670d26a /Userland/Libraries/LibWeb/CSS/Parser | |
parent | d2342caf426cecbeb3c28b77a7fa2e226228d385 (diff) | |
download | serenity-6d39f4342d48e0be49f217ab491407123547e99f.zip |
LibWeb: Use single shared instance of Inherit/InitialStyleValue
These are always the same, so we can avoid allocating them repeatedly
and just use a single instance of each. :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Parser')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index b901115d80..33fcfdb547 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -1404,9 +1404,9 @@ RefPtr<StyleValue> Parser::parse_builtin_value(ParsingContext const&, StyleCompo if (component_value.is(Token::Type::Ident)) { auto ident = component_value.token().ident(); if (ident.equals_ignoring_case("inherit")) - return InheritStyleValue::create(); + return InheritStyleValue::the(); if (ident.equals_ignoring_case("initial")) - return InitialStyleValue::create(); + return InitialStyleValue::the(); // FIXME: Implement `unset` keyword } @@ -2738,7 +2738,7 @@ RefPtr<StyleValue> Parser::parse_text_decoration_value(ParsingContext const& con decoration_style = IdentifierStyleValue::create(ValueID::Solid); // FIXME: Should default to 'currentcolor' special value: https://www.w3.org/TR/css-color-3/#currentcolor if (!decoration_color) - decoration_color = InitialStyleValue::create(); + decoration_color = InitialStyleValue::the(); return TextDecorationStyleValue::create(decoration_line.release_nonnull(), decoration_style.release_nonnull(), decoration_color.release_nonnull()); } |