2025-07-18 23:17:04 +12:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2025, Callum Law <callumlaw1709@outlook.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibWeb/CSS/Angle.h>
|
|
|
|
#include <LibWeb/CSS/Frequency.h>
|
|
|
|
#include <LibWeb/CSS/Length.h>
|
2025-10-01 01:36:05 +13:00
|
|
|
#include <LibWeb/CSS/StyleValues/ComputationContext.h>
|
2025-07-18 23:17:04 +12:00
|
|
|
#include <LibWeb/CSS/Time.h>
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
|
|
struct CalculationResolutionContext {
|
2025-10-01 01:36:05 +13:00
|
|
|
using PercentageBasis = Variant<Empty, Angle, Frequency, Length, Time>;
|
|
|
|
|
|
|
|
PercentageBasis percentage_basis {};
|
2025-07-18 23:17:04 +12:00
|
|
|
Optional<Length::ResolutionContext> length_resolution_context;
|
2025-10-01 01:36:05 +13:00
|
|
|
|
|
|
|
static CalculationResolutionContext from_computation_context(ComputationContext const& computation_context, PercentageBasis percentage_basis = {})
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
.percentage_basis = percentage_basis,
|
|
|
|
.length_resolution_context = computation_context.length_resolution_context,
|
|
|
|
};
|
|
|
|
}
|
2025-07-18 23:17:04 +12:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|