diff options
author | Andreas Kling <kling@serenityos.org> | 2021-08-20 15:43:01 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-20 15:43:01 +0200 |
commit | f58e2350dcdf9aa92eed6b4639d6009fda018afd (patch) | |
tree | bbb1e9ae61f7f5c285dd179c7f3378a8e55a23ea | |
parent | ed7a2f21ff4ca7b453e0e93c4cde39aabd634ef1 (diff) | |
download | serenity-f58e2350dcdf9aa92eed6b4639d6009fda018afd.zip |
LibWeb: Parse the CSS `opacity` property with `strtof()` for now
With the new parser, we started interpreting the `opacity` property as a
string value, which made it turn into `auto` and so anything with
opacity ended up not visible (e.g the header on google.com)
This patch restores our old behavior for `opacity` by interpreting it
as a numeric value with optional decimals.
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index e76772186a..e6a3d1dff6 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -2869,6 +2869,12 @@ RefPtr<StyleValue> Parser::parse_css_value(ParsingContext const& context, Proper } } + // FIXME: This is a hack for the `opacity` property which should really take an <alpha-value> + if (property_id == PropertyID::Opacity && component_value.is(Token::Type::Number)) { + String string = component_value.token().number_string_value(); + return LengthStyleValue::create(Length::make_px(strtof(string.characters(), nullptr))); + } + if (auto builtin_or_dynamic = parse_builtin_or_dynamic_value(context, component_value)) return builtin_or_dynamic; |