diff options
author | Egor Ananyin <ananinegor@gmail.com> | 2021-04-12 17:12:42 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-12 17:47:59 +0200 |
commit | d5eb09adc23f8b980ad3ffde01fe86d9a338b363 (patch) | |
tree | eec5d906f4b4f2aaa2b28f6227cc84abd59bb193 /Userland/Libraries/LibWeb/CSS/Parser | |
parent | b2a055228172c4dc7b285bafee2f125d65b4aac9 (diff) | |
download | serenity-d5eb09adc23f8b980ad3ffde01fe86d9a338b363.zip |
LibWeb: Parse border-style correctly
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Parser')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp | 26 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.h | 2 |
2 files changed, 18 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp index f231f2a2b4..a007c6eb4a 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.cpp @@ -285,23 +285,31 @@ RefPtr<CSS::ColorStyleValue> parse_color(const CSS::ParsingContext& context, con return nullptr; } -RefPtr<CSS::StringStyleValue> parse_line_style(const CSS::ParsingContext& context, const StringView& part) +RefPtr<CSS::IdentifierStyleValue> parse_line_style(const CSS::ParsingContext& context, const StringView& part) { auto parsed_value = parse_css_value(context, part); - if (!parsed_value || !parsed_value->is_string()) + if (!parsed_value || parsed_value->type() != CSS::StyleValue::Type::Identifier) return nullptr; - auto value = static_ptr_cast<CSS::StringStyleValue>(parsed_value); - if (value->to_string() == "dotted") + auto value = static_ptr_cast<CSS::IdentifierStyleValue>(parsed_value); + if (value->id() == CSS::ValueID::Dotted) return value; - if (value->to_string() == "dashed") + if (value->id() == CSS::ValueID::Dashed) return value; - if (value->to_string() == "solid") + if (value->id() == CSS::ValueID::Solid) return value; - if (value->to_string() == "double") + if (value->id() == CSS::ValueID::Double) return value; - if (value->to_string() == "groove") + if (value->id() == CSS::ValueID::Groove) return value; - if (value->to_string() == "ridge") + if (value->id() == CSS::ValueID::Ridge) + return value; + if (value->id() == CSS::ValueID::None) + return value; + if (value->id() == CSS::ValueID::Hidden) + return value; + if (value->id() == CSS::ValueID::Inset) + return value; + if (value->id() == CSS::ValueID::Outset) return value; return nullptr; } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.h b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.h index e03c83ba59..e47956f267 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/DeprecatedCSSParser.h @@ -55,7 +55,7 @@ Optional<CSS::Selector> parse_selector(const CSS::ParsingContext&, const StringV RefPtr<CSS::LengthStyleValue> parse_line_width(const CSS::ParsingContext&, const StringView&); RefPtr<CSS::ColorStyleValue> parse_color(const CSS::ParsingContext&, const StringView&); -RefPtr<CSS::StringStyleValue> parse_line_style(const CSS::ParsingContext&, const StringView&); +RefPtr<CSS::IdentifierStyleValue> parse_line_style(const CSS::ParsingContext&, const StringView&); RefPtr<CSS::StyleValue> parse_html_length(const DOM::Document&, const StringView&); |