LibWeb: Move CSS::CalculationResolutionContext to its own file

This struct will be used within CSSStyleValue.h in a future commit and
having it in CalculatedStyleValue.h causes a dependency loop.
This commit is contained in:
Callum Law 2025-07-18 23:17:04 +12:00 committed by Sam Atkins
commit b0508fb39a
Notes: github-actions[bot] 2025-08-04 10:30:57 +00:00
3 changed files with 22 additions and 5 deletions

View file

@ -20,6 +20,7 @@
#include <LibGfx/Color.h> #include <LibGfx/Color.h>
#include <LibJS/Heap/Cell.h> #include <LibJS/Heap/Cell.h>
#include <LibURL/URL.h> #include <LibURL/URL.h>
#include <LibWeb/CSS/CalculationResolutionContext.h>
#include <LibWeb/CSS/Keyword.h> #include <LibWeb/CSS/Keyword.h>
#include <LibWeb/CSS/Length.h> #include <LibWeb/CSS/Length.h>
#include <LibWeb/CSS/SerializationMode.h> #include <LibWeb/CSS/SerializationMode.h>

View file

@ -0,0 +1,21 @@
/*
* 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>
#include <LibWeb/CSS/Time.h>
namespace Web::CSS {
struct CalculationResolutionContext {
Variant<Empty, Angle, Frequency, Length, Time> percentage_basis {};
Optional<Length::ResolutionContext> length_resolution_context;
};
}

View file

@ -31,11 +31,6 @@ struct CalculationContext {
Optional<ValueType> percentages_resolve_as {}; Optional<ValueType> percentages_resolve_as {};
bool resolve_numbers_as_integers = false; bool resolve_numbers_as_integers = false;
}; };
// Contains the context for resolving the calculation.
struct CalculationResolutionContext {
Variant<Empty, Angle, Frequency, Length, Time> percentage_basis {};
Optional<Length::ResolutionContext> length_resolution_context;
};
class CalculatedStyleValue : public CSSStyleValue { class CalculatedStyleValue : public CSSStyleValue {
public: public: