Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 282da0f6ab84554f8e611949397ba3ec5cd65ee1
https://github.com/WebKit/WebKit/commit/282da0f6ab84554f8e611949397ba3ec5cd65ee1
Author: Sam Weinig <[email protected]>
Date: 2026-05-10 (Sun, 10 May 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/css/CSS2/normal-flow/margin-collapse-through-for-various-height-values.tentative-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/css-values/animations/calc-interpolation-expected.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/css/CSSPrimitiveValue.h
M Source/WebCore/css/calc/CSSCalcValue.cpp
M Source/WebCore/css/parser/CSSPropertyParserConsumer+Image.cpp
M Source/WebCore/css/parser/CSSPropertyParserConsumer+IntegerDefinitions.h
M
Source/WebCore/css/parser/CSSPropertyParserConsumer+MetaConsumerDefinitions.h
M Source/WebCore/css/values/CSSNoConversionDataRequiredToken.h
M Source/WebCore/css/values/color/CSSColorConversion+Normalize.h
M Source/WebCore/css/values/color/CSSColorConversion+ToTypedColor.h
M Source/WebCore/css/values/images/CSSGradient.h
M Source/WebCore/css/values/primitives/CSSPrimitiveNumeric.h
M Source/WebCore/css/values/primitives/CSSPrimitiveNumericRange.h
M Source/WebCore/css/values/primitives/CSSPrimitiveNumericRaw.h
M
Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes+Canonicalization.h
M Source/WebCore/page/IntersectionObserver.cpp
M Source/WebCore/rendering/RenderBox.cpp
M Source/WebCore/rendering/RenderBox.h
M Source/WebCore/style/StyleResolveForFont.cpp
M Source/WebCore/style/StyleResolveForFont.h
M Source/WebCore/style/values/fill-stroke/StyleStrokeWidth.cpp
M Source/WebCore/style/values/flexbox/StyleFlexBasis.h
M Source/WebCore/style/values/images/StyleGradient.cpp
M Source/WebCore/style/values/images/StyleGradient.h
M Source/WebCore/style/values/inline/StyleLineHeight.cpp
M Source/WebCore/style/values/non-standard/StyleWebKitTextStrokeWidth.cpp
M Source/WebCore/style/values/position/StyleInset.h
M
Source/WebCore/style/values/primitives/StyleLengthWrapper+CSSValueConversion.h
M
Source/WebCore/style/values/primitives/StyleLengthWrapper+DeprecatedCSSValueConversion.h
M
Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+CSSValueConversion.h
M
Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Conversions.cpp
M
Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Conversions.h
M
Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Evaluation.h
M Source/WebCore/style/values/sizing/StyleContainIntrinsicSize.cpp
M Source/WebCore/style/values/sizing/StyleMaximumSize.h
M Source/WebCore/style/values/sizing/StyleMinimumSize.h
M Source/WebCore/style/values/sizing/StylePreferredSize.h
M Source/WebCore/style/values/text/StyleLetterSpacing.cpp
M Source/WebCore/style/values/text/StyleLetterSpacing.h
M Source/WebCore/style/values/text/StyleTextIndent.h
M Source/WebCore/style/values/text/StyleWordSpacing.cpp
M Source/WebCore/style/values/text/StyleWordSpacing.h
M Source/WebCore/style/values/transforms/StylePerspective.cpp
M Source/WebCore/style/values/transforms/StyleTransformFunction.cpp
Log Message:
-----------
[Style] Unify numeric type resolution functions (part 1)
https://bugs.webkit.org/show_bug.cgi?id=314110
Reviewed by Darin Adler.
The goal of this refactoring series is to unify the way `CSSPrimitiveValue`
values get resolved.
This first change focuses on unifying the
StyleLengthWrapper+CSSValueConversion.h,
StyleLengthWrapper+DeprecatedCSSValueConversion.h and
StylePrimitiveNumericTypes+CSSValueConversion.h
to utilize the converters in StylePrimitiveNumericTypes+Conversion.h and
providing
utilities for non-standard <length-percentage>/<length> conversions to reuse
parts
of the general conversion infrastructure rather than reimplementing.
*
LayoutTests/imported/w3c/web-platform-tests/css/CSS2/normal-flow/margin-collapse-through-for-various-height-values.tentative-expected.txt:
- This test is now passing more subtests due to now correctly simplifying
all <length-percentage>
calc() values in all cases, not just when a strong CSS value has be
parsed.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-values/animations/calc-interpolation-expected.txt:
- This test is now passing more subtests due to uniformly applying clamping
in more places.
* Source/WebCore/css/CSSPrimitiveValue.h:
- Remove unused resolveAs() functions and predicates.
* Source/WebCore/css/calc/CSSCalcValue.cpp:
- Switch to using CSS::clampToRange.
* Source/WebCore/css/values/CSSNoConversionDataRequiredToken.h:
- Made default constructor explicit so that callers must use the
`NoConversionDataRequiredToken { }`
form and just use `{ }`. This makes it more clear at call sites what is
being requested.
* Source/WebCore/css/values/primitives/CSSPrimitiveNumeric.h:
- Add type aliases on AnglePercentage and LengthPercentage that expose the
Dimension/Percentage
types. This matches StylePrimitiveNumeric and is useful during generic
conversion.
* Source/WebCore/css/values/primitives/CSSPrimitiveNumericRange.h:
- Adds version of `clampToRangeOf` that forwards to the `clampToRange`
function that takes
additional range arguments.
* Source/WebCore/css/values/primitives/CSSPrimitiveNumericRaw.h:
- Add constructors that force eager clamping the value to the specified
range.
- Also adds type aliases on AnglePercentage and LengthPercentage that
expose the
Dimension/Percentage like was done in CSSPrimitiveNumeric.h
*
Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes+Canonicalization.h:
- Add trivial canonicalization for Flex to allow the conversion code to
generalize.
* Source/WebCore/page/IntersectionObserver.cpp:
- Avoid a CSSPrimitiveValue entirely by using MetaConsumer with strong CSS
types and
using Style::toStyle() for conversions.
* Source/WebCore/style/StyleResolveForFont.cpp:
* Source/WebCore/style/StyleResolveForFont.h:
- Remove unused function `fontStyleAngleFromCSSValueDeprecated` and the last
caller of `CSSPrimitiveValue::resolveAsAngleDeprecated`.
* Source/WebCore/style/values/fill-stroke/StyleStrokeWidth.cpp:
- Add missing `using namespace CSS::Literals`. It was getting this
previously due
to StylePrimitiveNumericTypes+CSSValueConversions.h doing it globally.
* Source/WebCore/style/values/inline/StyleLineHeight.cpp:
- Refactor to remove use of `CSSPrimitiveValue::resolveAs{type}` functions
and instead
use new `CSSPrimitiveValue::switchOn` + `toStyle()`.
* Source/WebCore/style/values/non-standard/StyleWebKitTextStrokeWidth.cpp:
- Add missing `using namespace CSS::Literals`. It was getting this
previously due
to StylePrimitiveNumericTypes+CSSValueConversions.h doing it globally.
*
Source/WebCore/style/values/primitives/StyleLengthWrapper+CSSValueConversion.h:
*
Source/WebCore/style/values/primitives/StyleLengthWrapper+DeprecatedCSSValueConversion.h:
- Extracts numeric conversions from both files into
`convertLengthWrapperFromCSSValue`
overloads that use `CSSPrimitiveValue::switchOn` + `Style::toStyle` for
conversion.
The `convertLengthWrapperFromCSSValue` functions allow
LetterSpacing/WordSpacing
to remove much of their duplicate logic.
- Removes duplication of CSSToLengthConversionData selection, using the
shared one
in StylePrimitiveNumericTypes+Conversions.h.
- Removes duplication of canonicalization, relying on `Style::toStyle` to
do it.
*
Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+CSSValueConversion.h:
- Extracts numeric conversions into `convertNumericFromCSSValue` overloads
that use
`CSSPrimitiveValue::switchOn` + `Style::toStyle` for conversion.
- Adds overloads that take `CSSToLengthConversionData`, matching strong
type conversion.
*
Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Conversions.h:
- Switches ConversionDataSpecializer to specialize based on Style type
instead of
CSS type, useful for cases where a CSS type converts to multiple Style
types.
- Makes passing rest parameters consistent through canonicalization.
- Adds overloads that convert from `BuilderState` to
`CSSToLengthConversionData`
consistently for all numeric types.
- Removes special clamping to LayoutUnit range. Types that want that opt-in
via
new CSS::Range values.
* Source/WebCore/style/values/sizing/StyleContainIntrinsicSize.cpp:
- Replace use of `CSSPrimitiveValue::resolveAsLength` with
`toStyleFromCSSValue`.
* Source/WebCore/style/values/text/StyleLetterSpacing.cpp:
* Source/WebCore/style/values/text/StyleWordSpacing.cpp:
- Use `convertLengthWrapperFromCSSValue` with custom
`CSSToLengthConversionData`
rather than duplicating conversion logic.
* Source/WebCore/style/values/transforms/StylePerspective.cpp:
- Replace use of `CSSPrimitiveValue::resolve{type}` with
`toStyleFromCSSValue`.
* Source/WebCore/style/values/transforms/StyleTransformFunction.cpp:
- Replace use of `CSSPrimitiveValue::resolve{type}` with
`toStyleFromCSSValue`.
Now that the LayoutUnit range clamping is declared via CSS::Range, the
normal path can work here.
Canonical link: https://commits.webkit.org/312965@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications