diff --git a/Libraries/LibWeb/CSS/ComputedProperties.cpp b/Libraries/LibWeb/CSS/ComputedProperties.cpp index b2b4b94b009..741bab029a8 100644 --- a/Libraries/LibWeb/CSS/ComputedProperties.cpp +++ b/Libraries/LibWeb/CSS/ComputedProperties.cpp @@ -1494,7 +1494,7 @@ Optional> ComputedProperties::font_featu auto const& feature_tag = tag_value->as_open_type_tagged(); if (feature_tag.value()->is_integer()) { - result.set(feature_tag.tag(), feature_tag.value()->as_integer().value()); + result.set(feature_tag.tag(), feature_tag.value()->as_integer().integer()); } else { VERIFY(feature_tag.value()->is_calculated()); result.set(feature_tag.tag(), IntegerOrCalculated { feature_tag.value()->as_calculated() }); @@ -1521,7 +1521,7 @@ Optional> ComputedProperties::font_variat auto const& axis_tag = tag_value->as_open_type_tagged(); if (axis_tag.value()->is_number()) { - result.set(axis_tag.tag(), axis_tag.value()->as_number().value()); + result.set(axis_tag.tag(), axis_tag.value()->as_number().number()); } else { VERIFY(axis_tag.value()->is_calculated()); result.set(axis_tag.tag(), NumberOrCalculated { axis_tag.value()->as_calculated() }); diff --git a/Libraries/LibWeb/CSS/Interpolation.cpp b/Libraries/LibWeb/CSS/Interpolation.cpp index 62b0eba89e5..4945212f8fb 100644 --- a/Libraries/LibWeb/CSS/Interpolation.cpp +++ b/Libraries/LibWeb/CSS/Interpolation.cpp @@ -1151,8 +1151,8 @@ static RefPtr interpolate_value_impl(DOM::Element& element, Ca // https://drafts.csswg.org/css-values/#combine-integers // Interpolation of is defined as Vresult = round((1 - p) × VA + p × VB); // that is, interpolation happens in the real number space as for s, and the result is converted to an by rounding to the nearest integer. - auto interpolated_value = interpolate_raw(from.as_integer().value(), to.as_integer().value(), delta); - return IntegerStyleValue::create(round_to(interpolated_value)); + auto interpolated_value = interpolate_raw(from.as_integer().integer(), to.as_integer().integer(), delta); + return IntegerStyleValue::create(interpolated_value); } case StyleValue::Type::Length: { auto const& from_length = from.as_length().length(); diff --git a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp index ee70c161468..8458540ceb9 100644 --- a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp @@ -2180,7 +2180,7 @@ RefPtr Parser::parse_stroke_dasharray_value(TokenStream is a list of comma and/or white space separated or values. A value represents a value in user units. auto value = parse_number_value(tokens); - if (value && value->is_number() && value->as_number().value() < 0) + if (value && value->is_number() && value->as_number().number() < 0) return {}; if (value) { @@ -2836,7 +2836,7 @@ RefPtr Parser::parse_font_feature_settings_value(TokenStream value; if (tag_tokens.has_next_token()) { if (auto integer = parse_integer_value(tag_tokens)) { - if (integer->is_integer() && integer->as_integer().value() < 0) + if (integer->is_integer() && integer->as_integer().integer() < 0) return nullptr; value = integer; } else { diff --git a/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp b/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp index 12ba12d48f2..abc737353dd 100644 --- a/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/ValueParsing.cpp @@ -365,7 +365,7 @@ Optional Parser::parse_ratio(TokenStream& tokens) if (!maybe_calc) return {}; if (maybe_calc->is_number()) - return maybe_calc->as_number().value(); + return maybe_calc->as_number().number(); if (!maybe_calc->is_calculated() || !maybe_calc->as_calculated().resolves_to_number()) return {}; if (auto resolved_number = maybe_calc->as_calculated().resolve_number_deprecated({}); resolved_number.has_value() && resolved_number.value() >= 0) { diff --git a/Libraries/LibWeb/CSS/StyleValues/ColorFunctionStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/ColorFunctionStyleValue.cpp index e0aa7498ac8..4b22f774696 100644 --- a/Libraries/LibWeb/CSS/StyleValues/ColorFunctionStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/ColorFunctionStyleValue.cpp @@ -130,11 +130,11 @@ String ColorFunctionStyleValue::to_string(SerializationMode mode) const bool const is_alpha_required = [&]() { if (alpha->is_number()) - return alpha->as_number().value() < 1; + return alpha->as_number().number() < 1; return true; }(); - if (alpha->is_number() && alpha->as_number().value() < 0) + if (alpha->is_number() && alpha->as_number().number() < 0) alpha = NumberStyleValue::create(0); if (is_alpha_required) { diff --git a/Libraries/LibWeb/CSS/StyleValues/IntegerStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/IntegerStyleValue.cpp index 1c3b984654a..56a4144b5e4 100644 --- a/Libraries/LibWeb/CSS/StyleValues/IntegerStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/IntegerStyleValue.cpp @@ -5,6 +5,7 @@ */ #include "IntegerStyleValue.h" +#include namespace Web::CSS { @@ -15,7 +16,7 @@ String IntegerStyleValue::to_string(SerializationMode) const Vector IntegerStyleValue::tokenize() const { - return { Parser::Token::create_number(Number { Number::Type::Integer, value() }) }; + return { Parser::Token::create_number(Number { Number::Type::Integer, static_cast(m_value) }) }; } } diff --git a/Libraries/LibWeb/CSS/StyleValues/IntegerStyleValue.h b/Libraries/LibWeb/CSS/StyleValues/IntegerStyleValue.h index 4136547def3..52e550e8459 100644 --- a/Libraries/LibWeb/CSS/StyleValues/IntegerStyleValue.h +++ b/Libraries/LibWeb/CSS/StyleValues/IntegerStyleValue.h @@ -6,11 +6,11 @@ #pragma once -#include +#include namespace Web::CSS { -class IntegerStyleValue final : public CSSUnitValue { +class IntegerStyleValue final : public StyleValue { public: static ValueComparingNonnullRefPtr create(i64 value) { @@ -18,8 +18,6 @@ public: } i64 integer() const { return m_value; } - virtual double value() const override { return m_value; } - virtual StringView unit() const override { return "number"sv; } virtual String to_string(SerializationMode) const override; virtual Vector tokenize() const override; @@ -34,7 +32,7 @@ public: private: explicit IntegerStyleValue(i64 value) - : CSSUnitValue(Type::Integer) + : StyleValue(Type::Integer) , m_value(value) { } diff --git a/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.cpp index 051fe0a3806..08cccd065c9 100644 --- a/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.cpp @@ -8,6 +8,7 @@ */ #include "NumberStyleValue.h" +#include namespace Web::CSS { diff --git a/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.h b/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.h index 9f1b87170bb..b2759cfaa39 100644 --- a/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.h +++ b/Libraries/LibWeb/CSS/StyleValues/NumberStyleValue.h @@ -9,11 +9,11 @@ #pragma once -#include +#include namespace Web::CSS { -class NumberStyleValue final : public CSSUnitValue { +class NumberStyleValue final : public StyleValue { public: static ValueComparingNonnullRefPtr create(double value) { @@ -21,8 +21,6 @@ public: } double number() const { return m_value; } - virtual double value() const override { return m_value; } - virtual StringView unit() const override { return "number"sv; } virtual String to_string(SerializationMode) const override; virtual Vector tokenize() const override; @@ -37,7 +35,7 @@ public: private: explicit NumberStyleValue(double value) - : CSSUnitValue(Type::Number) + : StyleValue(Type::Number) , m_value(value) { } diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-transitions/animations/z-index-interpolation.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-transitions/animations/z-index-interpolation.txt index 5ff7085b8ab..a1e8f78ddc9 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-transitions/animations/z-index-interpolation.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-transitions/animations/z-index-interpolation.txt @@ -2,14 +2,14 @@ Harness status: OK Found 250 tests -212 Pass -38 Fail +215 Pass +35 Fail Pass CSS Transitions: property from neutral to [5] at (-0.3) should be [-4] Pass CSS Transitions: property from neutral to [5] at (0) should be [-2] Pass CSS Transitions: property from neutral to [5] at (0.3) should be [0] Pass CSS Transitions: property from neutral to [5] at (0.6) should be [2] Pass CSS Transitions: property from neutral to [5] at (1) should be [5] -Fail CSS Transitions: property from neutral to [5] at (1.5) should be [9] +Pass CSS Transitions: property from neutral to [5] at (1.5) should be [9] Fail CSS Transitions with transition: all: property from neutral to [5] at (-0.3) should be [-4] Fail CSS Transitions with transition: all: property from neutral to [5] at (0) should be [-2] Fail CSS Transitions with transition: all: property from neutral to [5] at (0.3) should be [0] @@ -21,13 +21,13 @@ Pass CSS Animations: property from neutral to [5] at (0) should be [-2 Pass CSS Animations: property from neutral to [5] at (0.3) should be [0] Pass CSS Animations: property from neutral to [5] at (0.6) should be [2] Pass CSS Animations: property from neutral to [5] at (1) should be [5] -Fail CSS Animations: property from neutral to [5] at (1.5) should be [9] +Pass CSS Animations: property from neutral to [5] at (1.5) should be [9] Pass Web Animations: property from neutral to [5] at (-0.3) should be [-4] Pass Web Animations: property from neutral to [5] at (0) should be [-2] Pass Web Animations: property from neutral to [5] at (0.3) should be [0] Pass Web Animations: property from neutral to [5] at (0.6) should be [2] Pass Web Animations: property from neutral to [5] at (1) should be [5] -Fail Web Animations: property from neutral to [5] at (1.5) should be [9] +Pass Web Animations: property from neutral to [5] at (1.5) should be [9] Pass CSS Transitions with transition-behavior:allow-discrete: property from [initial] to [5] at (-0.3) should be [initial] Pass CSS Transitions with transition-behavior:allow-discrete: property from [initial] to [5] at (0) should be [initial] Pass CSS Transitions with transition-behavior:allow-discrete: property from [initial] to [5] at (0.3) should be [initial]