2025-10-24 10:11:58 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2025, Callum Law <callumlaw1709@outlook.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
2026-04-13 07:43:21 -03:00
|
|
|
struct NumericRange {
|
2026-03-25 00:43:51 -03:00
|
|
|
double min;
|
|
|
|
|
double max;
|
2026-04-15 23:15:53 -03:00
|
|
|
|
|
|
|
|
bool contains(double value) const { return value >= min && value <= max; }
|
2025-10-24 10:11:58 -03:00
|
|
|
};
|
2026-04-15 23:15:53 -03:00
|
|
|
|
2026-04-13 07:43:21 -03:00
|
|
|
using NumericRangesByValueType = HashMap<ValueType, NumericRange>;
|
2025-10-24 10:11:58 -03:00
|
|
|
|
2026-04-15 23:15:53 -03:00
|
|
|
constexpr NumericRange infinite_range = { AK::NumericLimits<float>::lowest(), AK::NumericLimits<float>::max() };
|
|
|
|
|
constexpr NumericRange non_negative_range = { 0, AK::NumericLimits<float>::max() };
|
|
|
|
|
|
|
|
|
|
constexpr NumericRange infinite_integer_range = { AK::NumericLimits<i32>::min(), AK::NumericLimits<i32>::max() };
|
|
|
|
|
constexpr NumericRange non_negative_integer_range = { 0, AK::NumericLimits<i32>::max() };
|
|
|
|
|
|
2025-10-24 10:11:58 -03:00
|
|
|
}
|