LibWeb/CSS: Implement CSSNumericType.equals()
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

This commit is contained in:
Sam Atkins 2025-08-22 12:53:15 +01:00 committed by Andreas Kling
commit 7be645a091
Notes: github-actions[bot] 2025-08-29 09:58:23 +00:00
22 changed files with 181 additions and 16 deletions

View file

@ -102,4 +102,18 @@ GC::Ref<CSSNumericValue> CSSMathClamp::upper() const
return m_upper;
}
// https://drafts.css-houdini.org/css-typed-om-1/#equal-numeric-value
bool CSSMathClamp::is_equal_numeric_value(GC::Ref<CSSNumericValue> other) const
{
// AD-HOC: Spec doesn't handle clamp()
// 1. If value1 and value2 are not members of the same interface, return false.
auto* other_clamp = as_if<CSSMathClamp>(*other);
if (!other_clamp)
return false;
return m_lower->is_equal_numeric_value(other_clamp->m_lower)
&& m_value->is_equal_numeric_value(other_clamp->m_value)
&& m_upper->is_equal_numeric_value(other_clamp->m_upper);
}
}