LibWeb: Include PropertyID.h in fewer header files

This reduces the size of the recompile when PropertyID.h is modified
from ~1500 to ~125
This commit is contained in:
Callum Law 2025-10-25 02:11:58 +13:00 committed by Sam Atkins
parent 59a1184469
commit 5381146e85
44 changed files with 67 additions and 19 deletions

View File

@ -13,6 +13,7 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/ComputedProperties.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleInvalidation.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>

View File

@ -13,6 +13,7 @@
#include <LibWeb/Bindings/KeyframeEffectPrototype.h>
#include <LibWeb/CSS/ComputedProperties.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/DOM/AbstractElement.h>

View File

@ -11,7 +11,6 @@
#include <LibWeb/Animations/AnimationEffect.h>
#include <LibWeb/Bindings/KeyframeEffectPrototype.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/Selector.h>
#include <LibWeb/CSS/StyleValues/StyleValue.h>

View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2025, Callum Law <callumlaw1709@outlook.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Forward.h>
namespace Web::CSS {
struct AcceptedTypeRange {
float min;
float max;
};
using AcceptedTypeRangeMap = HashMap<ValueType, AcceptedTypeRange>;
}

View File

@ -7,7 +7,6 @@
#pragma once
#include <LibWeb/Animations/Animation.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleValues/StyleValue.h>
namespace Web::CSS {

View File

@ -6,6 +6,7 @@
#include <LibWeb/CSS/CSSDescriptors.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/Serialize.h>
#include <LibWeb/CSS/StyleValues/ShorthandStyleValue.h>
#include <LibWeb/Infra/Strings.h>

View File

@ -11,6 +11,7 @@
#include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/CSSTransition.h>
#include <LibWeb/CSS/Interpolation.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
@ -27,6 +28,11 @@ GC::Ref<CSSTransition> CSSTransition::start_a_transition(DOM::AbstractElement ab
return realm.create<CSSTransition>(realm, abstract_element, property_id, transition_generation, delay, start_time, end_time, start_value, end_value, reversing_adjusted_start_value, reversing_shortening_factor);
}
StringView CSSTransition::transition_property() const
{
return string_from_property_id(m_transition_property);
}
Animations::AnimationClass CSSTransition::animation_class() const
{
return Animations::AnimationClass::CSSTransition;

View File

@ -9,7 +9,6 @@
#include <LibWeb/Animations/Animation.h>
#include <LibWeb/CSS/Interpolation.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/PseudoElement.h>
#include <LibWeb/CSS/StyleValues/StyleValue.h>
#include <LibWeb/CSS/Time.h>
@ -25,7 +24,7 @@ public:
size_t transition_generation, double delay, double start_time, double end_time, NonnullRefPtr<StyleValue const> start_value,
NonnullRefPtr<StyleValue const> end_value, NonnullRefPtr<StyleValue const> reversing_adjusted_start_value, double reversing_shortening_factor);
StringView transition_property() const { return string_from_property_id(m_transition_property); }
StringView transition_property() const;
virtual Animations::AnimationClass animation_class() const override;
virtual Optional<int> class_specific_composite_order(GC::Ref<Animations::Animation> other) const override;

View File

@ -7,6 +7,7 @@
#include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/CascadedProperties.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/PropertyNameAndID.h>
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/DOM/Element.h>

View File

@ -9,7 +9,6 @@
#include <LibGC/CellAllocator.h>
#include <LibJS/Heap/Cell.h>
#include <LibWeb/CSS/CascadeOrigin.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/Selector.h>
#include <LibWeb/CSS/StyleProperty.h>
#include <LibWeb/CSS/StyleValues/StyleValue.h>

View File

@ -14,6 +14,7 @@
#include <LibWeb/CSS/FontFace.h>
#include <LibWeb/CSS/FontFaceSet.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/CSS/StyleValues/ShorthandStyleValue.h>
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>

View File

@ -9,7 +9,7 @@
#include <AK/Array.h>
#include <AK/Optional.h>
#include <AK/String.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/Forward.h>
namespace Web::CSS {

View File

@ -26,7 +26,6 @@
#include <LibWeb/CSS/Parser/TokenStream.h>
#include <LibWeb/CSS/Parser/Tokenizer.h>
#include <LibWeb/CSS/Parser/Types.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/Ratio.h>
#include <LibWeb/CSS/Selector.h>
#include <LibWeb/CSS/StyleValues/AbstractImageStyleValue.h>

View File

@ -18,6 +18,7 @@
#include <LibWeb/CSS/CharacterTypes.h>
#include <LibWeb/CSS/Parser/ErrorReporter.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleValues/AngleStyleValue.h>
#include <LibWeb/CSS/StyleValues/BackgroundSizeStyleValue.h>
#include <LibWeb/CSS/StyleValues/BorderImageSliceStyleValue.h>
@ -61,6 +62,7 @@
#include <LibWeb/CSS/StyleValues/TransformationStyleValue.h>
#include <LibWeb/CSS/StyleValues/URLStyleValue.h>
#include <LibWeb/CSS/StyleValues/UnresolvedStyleValue.h>
#include <LibWeb/CSS/ValueType.h>
#include <LibWeb/Dump.h>
#include <LibWeb/Infra/Strings.h>

View File

@ -6,6 +6,7 @@
#include <LibWeb/CSS/Parser/Syntax.h>
#include <LibWeb/CSS/Serialize.h>
#include <LibWeb/CSS/ValueType.h>
namespace Web::CSS::Parser {

View File

@ -10,8 +10,8 @@
#include <AK/NonnullOwnPtr.h>
#include <AK/OwnPtr.h>
#include <AK/String.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/Export.h>
#include <LibWeb/Forward.h>
namespace Web::CSS::Parser {

View File

@ -16,6 +16,7 @@
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
#include <LibWeb/CSS/StyleValues/UnresolvedStyleValue.h>
#include <LibWeb/CSS/ValueType.h>
namespace Web::CSS::Parser {

View File

@ -8,7 +8,6 @@
#include <AK/FlyString.h>
#include <AK/Optional.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/PropertyName.h>
#include <LibWeb/CSS/Serialize.h>

View File

@ -5,6 +5,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleInvalidation.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>

View File

@ -6,7 +6,7 @@
#pragma once
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/Forward.h>
namespace Web::CSS {

View File

@ -7,7 +7,7 @@
#pragma once
#include <AK/FlyString.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/Forward.h>
namespace Web::CSS {

View File

@ -10,6 +10,7 @@
#pragma once
#include <AK/Function.h>
#include <LibWeb/CSS/AcceptedTypeRange.h>
#include <LibWeb/CSS/Angle.h>
#include <LibWeb/CSS/Enums.h>
#include <LibWeb/CSS/Flex.h>

View File

@ -7,6 +7,7 @@
#include "IntegerStyleValue.h"
#include <LibWeb/CSS/CSSUnitValue.h>
#include <LibWeb/CSS/Parser/ComponentValue.h>
#include <LibWeb/CSS/PropertyID.h>
namespace Web::CSS {

View File

@ -10,7 +10,9 @@
#include "NumberStyleValue.h"
#include <LibWeb/CSS/CSSUnitValue.h>
#include <LibWeb/CSS/Parser/ComponentValue.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/Serialize.h>
#include <LibWeb/CSS/ValueType.h>
namespace Web::CSS {

View File

@ -20,6 +20,7 @@
#include <LibWeb/CSS/CSSTransformComponent.h>
#include <LibWeb/CSS/CSSTranslate.h>
#include <LibWeb/CSS/CSSUnitValue.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/Serialize.h>
#include <LibWeb/CSS/StyleValues/AngleStyleValue.h>
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>

View File

@ -6,6 +6,7 @@
#include <LibUnicode/CharacterTypes.h>
#include <LibUnicode/Segmenter.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/DOM/Comment.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/DocumentFragment.h>

View File

@ -395,12 +395,14 @@ enum class Keyword : u16;
enum class MediaFeatureID : u8;
enum class PropertyID : u16;
enum class PaintOrder : u8;
enum class ValueType : u8;
struct BackgroundLayerData;
struct CalculationContext;
struct CalculationResolutionContext;
struct CSSStyleSheetInit;
struct GridRepeatParams;
struct LogicalAliasMappingContext;
struct StyleSheetIdentifier;
using PaintOrderList = Array<PaintOrder, 3>;

View File

@ -11,6 +11,7 @@
#include "CanvasFillStrokeStyles.h"
#include <AK/String.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/HTML/CanvasGradient.h>
#include <LibWeb/HTML/CanvasPattern.h>
#include <LibWeb/HTML/CanvasRenderingContext2D.h>

View File

@ -9,6 +9,7 @@
#include <LibWeb/Bindings/CanvasGradientPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/HTML/CanvasGradient.h>
#include <LibWeb/WebIDL/ExceptionOr.h>

View File

@ -18,6 +18,7 @@
#include <LibUnicode/Segmenter.h>
#include <LibWeb/Bindings/CanvasRenderingContext2DPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/HTML/CanvasRenderingContext2D.h>
#include <LibWeb/HTML/HTMLCanvasElement.h>
#include <LibWeb/HTML/HTMLImageElement.h>

View File

@ -5,6 +5,7 @@
*/
#include <LibWeb/Bindings/HTMLLIElementPrototype.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/HTML/HTMLLIElement.h>
#include <LibWeb/HTML/Numbers.h>

View File

@ -6,6 +6,7 @@
#include <LibWeb/Bindings/HTMLOListElementPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/AttributeNames.h>

View File

@ -6,6 +6,7 @@
#include <LibWeb/Bindings/HTMLUListElementPrototype.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/HTML/HTMLUListElement.h>

View File

@ -11,6 +11,7 @@
#include <LibUnicode/Segmenter.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/OffscreenCanvasRenderingContext2DPrototype.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/HTML/HTMLCanvasElement.h>
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/HTML/ImageBitmap.h>

View File

@ -7,6 +7,7 @@
#include <LibWeb/Bindings/ExceptionOrUtils.h>
#include <LibWeb/Bindings/MathMLElementPrototype.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleValues/IntegerStyleValue.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/CSS/StyleValues/MathDepthStyleValue.h>

View File

@ -5,6 +5,7 @@
*/
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/MathML/AttributeNames.h>

View File

@ -5,6 +5,7 @@
*/
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/HTML/Parser/HTMLParser.h>
#include <LibWeb/MathML/AttributeNames.h>
#include <LibWeb/MathML/MathMLMspaceElement.h>

View File

@ -8,6 +8,7 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/SVGCircleElementPrototype.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/SVG/AttributeNames.h>
#include <LibWeb/SVG/AttributeParser.h>

View File

@ -9,6 +9,7 @@
#include <LibGfx/ImmutableBitmap.h>
#include <LibWeb/Bindings/SVGFilterElementPrototype.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/DOM/Text.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/Painting/PaintableBox.h>

View File

@ -6,6 +6,7 @@
*/
#include "SVGFilterPrimitiveStandardAttributes.h"
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/SVG/SVGFEBlendElement.h>
#include <LibWeb/SVG/SVGFEColorMatrixElement.h>
#include <LibWeb/SVG/SVGFECompositeElement.h>

View File

@ -7,6 +7,7 @@
#include <LibWeb/Bindings/SVGSVGElementPrototype.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
#include <LibWeb/CSS/StyleValues/PercentageStyleValue.h>

View File

@ -82,8 +82,7 @@ ErrorOr<void> generate_header_file(JsonObject const& at_rules_data, Core::File&
#include <AK/FlyString.h>
#include <AK/Optional.h>
#include <AK/Types.h>
#include <LibWeb/CSS/Keyword.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/Forward.h>
namespace Web::CSS {
@ -152,6 +151,7 @@ ErrorOr<void> generate_implementation_file(JsonObject const& at_rules_data, Core
#include <LibWeb/CSS/DescriptorID.h>
#include <LibWeb/CSS/StyleValues/StyleValue.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyID.h>
namespace Web::CSS {

View File

@ -164,6 +164,7 @@ ErrorOr<void> generate_header_file(JsonObject& properties, JsonObject& logical_p
#include <AK/Traits.h>
#include <AK/Variant.h>
#include <LibJS/Forward.h>
#include <LibWeb/CSS/AcceptedTypeRange.h>
#include <LibWeb/CSS/Enums.h>
#include <LibWeb/CSS/ValueType.h>
#include <LibWeb/Export.h>
@ -259,11 +260,6 @@ bool property_is_single_valued(PropertyID);
bool property_is_list_valued(PropertyID);
bool property_accepts_type(PropertyID, ValueType);
struct AcceptedTypeRange {
float min;
float max;
};
using AcceptedTypeRangeMap = HashMap<ValueType, AcceptedTypeRange>;
AcceptedTypeRangeMap property_accepted_type_ranges(PropertyID);
bool property_accepts_keyword(PropertyID, Keyword);
Optional<Keyword> resolve_legacy_value_alias(PropertyID, Keyword);

View File

@ -58,7 +58,7 @@ ErrorOr<void> generate_header_file(JsonObject& pseudo_elements_data, Core::File&
#include <AK/Optional.h>
#include <AK/StringView.h>
#include <LibWeb/CSS/PropertyID.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Export.h>
namespace Web::CSS {
@ -115,6 +115,7 @@ ErrorOr<void> generate_implementation_file(JsonObject& pseudo_elements_data, Cor
generator.append(R"~~~(
#include <LibWeb/CSS/PseudoElement.h>
#include <LibWeb/CSS/PropertyID.h>
namespace Web::CSS {