Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c6c6fc08e72bde6cf2962a73116feed1e56f43c9
https://github.com/WebKit/WebKit/commit/c6c6fc08e72bde6cf2962a73116feed1e56f43c9
Author: Chris Dumez <[email protected]>
Date: 2026-10-10 (Sat, 10 Oct 2026)
Changed paths:
M Source/WebCore/css/CSSComputedStyleDeclaration.cpp
M Source/WebCore/css/CSSProperties.json
M Source/WebCore/css/CSSProperty.h
M Source/WebCore/css/CSSPropertyInitialValues.h
M Source/WebCore/css/CSSStyleProperties.cpp
M Source/WebCore/css/CSSValue.h
M Source/WebCore/css/ComputedStyleDependencies.h
M Source/WebCore/css/ImmutableStyleProperties.cpp
M Source/WebCore/css/MutableStyleProperties.cpp
M Source/WebCore/css/ShorthandSerializer.h
M Source/WebCore/css/StyleProperties.cpp
M Source/WebCore/css/calc/CSSCalcRandomSharing.h
M Source/WebCore/css/parser/CSSParser.cpp
M Source/WebCore/css/parser/CSSParserFastPaths.h
M Source/WebCore/css/parser/CSSPropertyParser.h
M Source/WebCore/css/parser/CSSPropertyParserConsumer+Background.h
M Source/WebCore/css/parser/CSSPropertyParserResult.cpp
M Source/WebCore/css/scripts/process-css-properties.py
M
Source/WebCore/css/scripts/test/TestCSSPropertiesResults/CSSPropertyInitialValuesGeneratedInlines.h
M
Source/WebCore/css/scripts/test/TestCSSPropertiesResults/CSSPropertyNames.gperf
M
Source/WebCore/css/scripts/test/TestCSSPropertiesResults/CSSPropertyNames.h
M
Source/WebCore/css/scripts/test/TestCSSPropertiesResults/CSSPropertyParsing.cpp
M
Source/WebCore/css/scripts/test/TestCSSPropertiesResults/StyleBuilderGenerated.cpp
M
Source/WebCore/css/scripts/test/TestCSSPropertiesResults/StyleChangedAnimatablePropertiesGenerated.cpp
M
Source/WebCore/css/scripts/test/TestCSSPropertiesResults/StyleComputedStyleProperties+GettersInlines.h
M
Source/WebCore/css/scripts/test/TestCSSPropertiesResults/StyleComputedStyleProperties.h
M
Source/WebCore/css/scripts/test/TestCSSPropertiesResults/StyleExtractorGenerated.cpp
M
Source/WebCore/css/scripts/test/TestCSSPropertiesResults/StyleInterpolationWrapperMap.cpp
M
Source/WebCore/css/scripts/test/TestCSSPropertiesResults/StyleInterpolationWrapperMap.h
M
Source/WebCore/css/scripts/test/TestCSSPropertiesResults/StylePropertyShorthandFunctions.cpp
M Source/WebCore/dom/Document.h
M Source/WebCore/dom/Element.h
M Source/WebCore/dom/StyledElement.h
M Source/WebCore/editing/EditingStyle.cpp
M Source/WebCore/inspector/InspectorOverlay.cpp
M Source/WebCore/inspector/InspectorStyleSheet.cpp
M Source/WebCore/style/AnchorPositionEvaluator.h
M Source/WebCore/style/PropertyCascade.cpp
M Source/WebCore/style/PropertyCascade.h
M Source/WebCore/style/StyleBuilder.cpp
M Source/WebCore/style/StyleBuilder.h
M Source/WebCore/style/StyleBuilderGenerated.h
M Source/WebCore/style/StyleBuilderState.cpp
M Source/WebCore/style/StyleChangedAnimatableProperties.cpp
M Source/WebCore/style/StyleChangedAnimatablePropertiesCustom.h
M Source/WebCore/style/StyleDifference.cpp
M Source/WebCore/style/StyleExtractor.h
M Source/WebCore/style/StyleExtractorCustom.h
M Source/WebCore/style/StyleExtractorGenerated.h
M Source/WebCore/style/StyleInterpolationWrapperBase.h
M Source/WebCore/style/StyleInterpolationWrappers.h
M Source/WebCore/style/StyleSubstitutionResolver.h
M Source/WebCore/style/Styleable.cpp
M Source/WebCore/style/computed/StyleComputedStyleBase.h
M Source/WebCore/style/values/images/kinds/StylePaintImage.cpp
M Source/WebCore/style/values/primitives/StyleLengthResolution.h
M Source/WebCore/style/values/transitions/StyleSingleTransitionProperty.h
M Source/WebCore/style/values/will-change/StyleWillChange.cpp
M Source/WebCore/svg/SVGFontFaceElement.cpp
M Tools/Scripts/webkitpy/style/checkers/cpp.py
M Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
Log Message:
-----------
Convert CSSPropertyID to an enum class
https://bugs.webkit.org/show_bug.cgi?id=326984
Reviewed by Sam Weinig.
CSSPropertyID is now an enum class with short enumerator names, e.g.
CSSPropertyID::Color instead of CSSPropertyColor. This prevents implicit
conversions to integers and bool.
For the transition period, CSSPropertyNames.h also defines a
`CSSPropertyFoo` constant for each enumerator, so existing call sites keep
compiling. They will be converted in follow-up patches, after which the
constants will be removed. A new style check (runtime/css_property_id)
flags new uses of the deprecated constants.
Code that relied on implicit integer conversion now uses
std::to_underlying() for indexing and range math, and compares against
CSSPropertyID::Invalid explicitly instead of testing the ID for truthiness.
* Source/WebCore/css/scripts/process-css-properties.py:
Generate `enum class CSSPropertyID` and the transition constants. Use the
scoped names in all generated code, store CSSPropertyID in the gperf table,
and keep hashing the underlying value as `unsigned`.
* Source/WebCore/css/scripts/test/TestCSSPropertiesResults/*: Rebaselined.
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/inspector/InspectorOverlay.cpp:
* Source/WebCore/inspector/InspectorStyleSheet.cpp:
* Source/WebCore/style/StyleExtractorCustom.h:
* Source/WebCore/style/StyleInterpolationWrappers.h:
Replace CSSPropertyID::CSSPropertyFoo with CSSPropertyID::Foo.
* Source/WebCore/css/CSSPropertyInitialValues.h:
* Source/WebCore/css/CSSValue.h:
* Source/WebCore/css/ComputedStyleDependencies.h:
* Source/WebCore/css/ShorthandSerializer.h:
* Source/WebCore/css/calc/CSSCalcRandomSharing.h:
* Source/WebCore/css/parser/CSSParserFastPaths.h:
* Source/WebCore/css/parser/CSSPropertyParser.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Background.h:
* Source/WebCore/dom/Document.h:
* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/StyledElement.h:
* Source/WebCore/style/AnchorPositionEvaluator.h:
* Source/WebCore/style/StyleBuilderGenerated.h:
* Source/WebCore/style/StyleExtractor.h:
* Source/WebCore/style/StyleExtractorGenerated.h:
* Source/WebCore/style/StyleInterpolationWrapperBase.h:
* Source/WebCore/style/StyleSubstitutionResolver.h:
* Source/WebCore/style/computed/StyleComputedStyleBase.h:
* Source/WebCore/style/values/primitives/StyleLengthResolution.h:
Update forward declarations to `enum class`.
* Source/WebCore/css/CSSProperty.h:
* Source/WebCore/css/ImmutableStyleProperties.cpp:
* Source/WebCore/css/MutableStyleProperties.cpp:
* Source/WebCore/css/StyleProperties.cpp:
* Source/WebCore/css/parser/CSSParser.cpp:
* Source/WebCore/style/PropertyCascade.cpp:
* Source/WebCore/style/PropertyCascade.h:
* Source/WebCore/style/StyleBuilderState.cpp:
* Source/WebCore/style/StyleChangedAnimatableProperties.cpp:
* Source/WebCore/style/StyleChangedAnimatablePropertiesCustom.h:
* Source/WebCore/style/Styleable.cpp:
Use std::to_underlying() for bitset/array indexing and range math.
* Source/WebCore/style/StyleBuilder.cpp:
* Source/WebCore/style/StyleBuilder.h:
Make applyProperties() and applyPropertiesImpl() take CSSPropertyID
instead of int.
* Source/WebCore/editing/EditingStyle.cpp:
Make isEditingProperty() take a CSSPropertyID.
* Source/WebCore/css/CSSComputedStyleDeclaration.cpp:
* Source/WebCore/css/CSSStyleProperties.cpp:
* Source/WebCore/css/parser/CSSPropertyParserResult.cpp:
* Source/WebCore/style/StyleDifference.cpp:
* Source/WebCore/style/values/images/kinds/StylePaintImage.cpp:
* Source/WebCore/style/values/transitions/StyleSingleTransitionProperty.h:
* Source/WebCore/style/values/will-change/StyleWillChange.cpp:
* Source/WebCore/svg/SVGFontFaceElement.cpp:
Compare against CSSPropertyID::Invalid explicitly.
* Tools/Scripts/webkitpy/style/checkers/cpp.py:
Add runtime/css_property_id, which flags `CSSPropertyFoo` constants. The
enumerator names come from CSSProperties.json.
* Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py:
Canonical link: https://commits.webkit.org/323299@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications