[webkit-changes] [WebKit/WebKit] 65b8b2: Annotate CSS/Style numeric primitives with their v...

Sam Weinig noreply at github.com
Mon Oct 14 09:56:11 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 65b8b27448c2291db57953908cc3814051f188ab
      https://github.com/WebKit/WebKit/commit/65b8b27448c2291db57953908cc3814051f188ab
  Author: Sam Weinig <sam at webkit.org>
  Date:   2024-10-14 (Mon, 14 Oct 2024)

  Changed paths:
    M Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/css/CSSFilterFunctionDescriptor.h
    M Source/WebCore/css/CSSFontFaceSet.cpp
    M Source/WebCore/css/CSSProperties.json
    M Source/WebCore/css/calc/CSSCalcTree+CalculationValue.cpp
    M Source/WebCore/css/calc/CSSCalcTree+Parser.cpp
    M Source/WebCore/css/calc/CSSCalcTree+Parser.h
    M Source/WebCore/css/calc/CSSCalcTree+Serialization.cpp
    M Source/WebCore/css/calc/CSSCalcTree.h
    M Source/WebCore/css/calc/CSSCalcValue.cpp
    M Source/WebCore/css/calc/CSSCalcValue.h
    M Source/WebCore/css/color/CSSColorConversion+Normalize.h
    M Source/WebCore/css/color/CSSColorConversion+ToTypedColor.h
    M Source/WebCore/css/color/CSSColorDescriptors.h
    M Source/WebCore/css/color/CSSColorMixResolver.cpp
    M Source/WebCore/css/color/CSSColorMixResolver.h
    M Source/WebCore/css/color/CSSColorMixSerialization.cpp
    M Source/WebCore/css/color/CSSColorMixSerialization.h
    M Source/WebCore/css/color/CSSUnresolvedColor.h
    M Source/WebCore/css/color/CSSUnresolvedColorMix.cpp
    M Source/WebCore/css/color/CSSUnresolvedColorMix.h
    M Source/WebCore/css/color/StyleColorMix.h
    M Source/WebCore/css/parser/CSSParserFastPaths.cpp
    M Source/WebCore/css/parser/CSSParserFastPaths.h
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Angle.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Angle.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+AngleDefinitions.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+AnglePercentage.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+AnglePercentage.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+AnglePercentageDefinitions.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+CSSPrimitiveValueResolver.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Color.cpp
    A Source/WebCore/css/parser/CSSPropertyParserConsumer+FlexDefinitions.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Font.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Font.h
    A Source/WebCore/css/parser/CSSPropertyParserConsumer+FrequencyDefinitions.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Image.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Integer.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Integer.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+IntegerDefinitions.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Length.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Length.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+LengthDefinitions.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+LengthPercentage.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+LengthPercentage.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+LengthPercentageDefinitions.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+MetaConsumer.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+MetaConsumerDefinitions.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Number.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Number.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+NumberDefinitions.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Percentage.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+PercentageDefinitions.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Position.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Position.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Primitives.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Primitives.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Resolution.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Resolution.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+ResolutionDefinitions.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Time.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Time.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+TimeDefinitions.h
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
    M Source/WebCore/css/parser/CSSPropertyParserOptions.h
    M Source/WebCore/css/process-css-properties.py
    M Source/WebCore/css/typedom/CSSNumericValue.cpp
    M Source/WebCore/css/typedom/CSSUnitValue.cpp
    M Source/WebCore/css/typedom/numeric/CSSMathValue.cpp
    M Source/WebCore/css/values/CSSGradient.cpp
    M Source/WebCore/css/values/CSSGradient.h
    M Source/WebCore/css/values/CSSPosition.cpp
    M Source/WebCore/css/values/CSSPosition.h
    M Source/WebCore/css/values/CSSPrimitiveNumericTypes+ComputedStyleDependencies.cpp
    M Source/WebCore/css/values/CSSPrimitiveNumericTypes+ComputedStyleDependencies.h
    M Source/WebCore/css/values/CSSPrimitiveNumericTypes+SymbolReplacement.cpp
    M Source/WebCore/css/values/CSSPrimitiveNumericTypes+SymbolReplacement.h
    A Source/WebCore/css/values/CSSPrimitiveNumericTypes.cpp
    M Source/WebCore/css/values/CSSPrimitiveNumericTypes.h
    M Source/WebCore/html/HTMLInputElement.cpp
    M Source/WebCore/html/HTMLMarqueeElement.cpp
    M Source/WebCore/platform/Length.cpp
    M Source/WebCore/platform/calc/CalculationTree.h
    M Source/WebCore/platform/calc/CalculationValue.cpp
    M Source/WebCore/platform/calc/CalculationValue.h
    M Source/WebCore/rendering/style/StyleGradientImage.cpp
    M Source/WebCore/style/StyleResolveForFont.cpp
    M Source/WebCore/style/values/StyleGradient.cpp
    M Source/WebCore/style/values/StyleGradient.h
    M Source/WebCore/style/values/StylePosition.cpp
    M Source/WebCore/style/values/StylePosition.h
    M Source/WebCore/style/values/StylePrimitiveNumericTypes+Conversions.cpp
    M Source/WebCore/style/values/StylePrimitiveNumericTypes+Conversions.h
    R Source/WebCore/style/values/StylePrimitiveNumericTypes.cpp
    M Source/WebCore/style/values/StylePrimitiveNumericTypes.h

  Log Message:
  -----------
  Annotate CSS/Style numeric primitives with their value range
https://bugs.webkit.org/show_bug.cgi?id=281080

Reviewed by Darin Adler.

Adds a non-type template parameter to each CSS/Style numeric primitive
type, encoding the allowed value range directly. The value range is
represented by CSS::Range. Eventually it will likely be useful to extend
this to additional metadata, such as whether unitless values are supported
when parsing, but this initial change only introduces the range.

Most users of the numeric types will use them in non-generic ways (e.g.
the gradient code uses a CSS::LengthPercentage<CSS::NonNegative>), but
for the support code to parse and resolve, some functionality was pulled
into headers as required for the templates. This lead to a good opportunity
to unify and simplify the parsing code, with shared implementations of
the token specific consumers now being used by all the numeric types.

A few additional related changes made:
- Remove now unused ValueRange parameter from the parser options.
- Remove already unused NegativePercentagePolicy from the parser options.
- Used CSS::Range throughout calc code to ensure proper clamping.
- Removed support for unitless <time> values, which were only being
  used internally by the marquee element code (but was easily fixable).

Adopted spec'd range values in position, gradient and font code. Of
particular note is the font code, where we were able to remove quite
a bit of custom validation code for complex ranges types like:

    <number [1,1000]>

and

    <angle [-90deg,90deg]>

* Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/css/CSSFilterFunctionDescriptor.h:
* Source/WebCore/css/CSSFontFaceSet.cpp:
* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/calc/CSSCalcTree+CalculationValue.cpp:
* Source/WebCore/css/calc/CSSCalcTree+Parser.cpp:
* Source/WebCore/css/calc/CSSCalcTree+Parser.h:
* Source/WebCore/css/calc/CSSCalcTree+Serialization.cpp:
* Source/WebCore/css/calc/CSSCalcTree.h:
* Source/WebCore/css/calc/CSSCalcValue.cpp:
* Source/WebCore/css/calc/CSSCalcValue.h:
* Source/WebCore/css/color/CSSColorConversion+Normalize.h:
* Source/WebCore/css/color/CSSColorConversion+ToTypedColor.h:
* Source/WebCore/css/color/CSSColorDescriptors.h:
* Source/WebCore/css/color/CSSColorMixResolver.cpp:
* Source/WebCore/css/color/CSSColorMixResolver.h:
* Source/WebCore/css/color/CSSColorMixSerialization.cpp:
* Source/WebCore/css/color/CSSColorMixSerialization.h:
* Source/WebCore/css/color/CSSUnresolvedColor.h:
* Source/WebCore/css/color/CSSUnresolvedColorMix.cpp:
* Source/WebCore/css/color/CSSUnresolvedColorMix.h:
* Source/WebCore/css/color/StyleColorMix.h:
* Source/WebCore/css/parser/CSSParserFastPaths.cpp:
* Source/WebCore/css/parser/CSSParserFastPaths.h:
* Source/WebCore/css/parser/CSSPropertyParser.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Angle.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Angle.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+AngleDefinitions.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+AnglePercentage.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+AnglePercentage.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+AnglePercentageDefinitions.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+CSSPrimitiveValueResolver.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Color.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+FlexDefinitions.h: Copied from Source/WebCore/css/parser/CSSPropertyParserConsumer+Integer.h.
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Font.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Font.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+FrequencyDefinitions.h: Copied from Source/WebCore/style/values/StylePosition.h.
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Image.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Integer.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Integer.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+IntegerDefinitions.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Length.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Length.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+LengthDefinitions.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+LengthPercentage.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+LengthPercentage.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+LengthPercentageDefinitions.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+MetaConsumer.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+MetaConsumerDefinitions.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Number.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Number.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+NumberDefinitions.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Percentage.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+PercentageDefinitions.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Position.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Position.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Primitives.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Primitives.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Resolution.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Resolution.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+ResolutionDefinitions.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Time.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Time.h:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+TimeDefinitions.h:
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
* Source/WebCore/css/parser/CSSPropertyParserOptions.h:
* Source/WebCore/css/process-css-properties.py:
* Source/WebCore/css/typedom/CSSNumericValue.cpp:
* Source/WebCore/css/typedom/CSSUnitValue.cpp:
* Source/WebCore/css/typedom/numeric/CSSMathValue.cpp:
* Source/WebCore/css/values/CSSGradient.cpp:
* Source/WebCore/css/values/CSSGradient.h:
* Source/WebCore/css/values/CSSPosition.cpp:
* Source/WebCore/css/values/CSSPosition.h:
* Source/WebCore/css/values/CSSPrimitiveNumericTypes+ComputedStyleDependencies.cpp:
* Source/WebCore/css/values/CSSPrimitiveNumericTypes+ComputedStyleDependencies.h:
* Source/WebCore/css/values/CSSPrimitiveNumericTypes+SymbolReplacement.cpp:
* Source/WebCore/css/values/CSSPrimitiveNumericTypes+SymbolReplacement.h:
* Source/WebCore/css/values/CSSPrimitiveNumericTypes.cpp: Added.
* Source/WebCore/css/values/CSSPrimitiveNumericTypes.h:
* Source/WebCore/html/HTMLInputElement.cpp:
* Source/WebCore/html/HTMLMarqueeElement.cpp:
* Source/WebCore/platform/Length.cpp:
* Source/WebCore/platform/calc/CalculationTree.h:
* Source/WebCore/platform/calc/CalculationValue.cpp:
* Source/WebCore/platform/calc/CalculationValue.h:
* Source/WebCore/rendering/style/StyleGradientImage.cpp:
* Source/WebCore/style/StyleResolveForFont.cpp:
* Source/WebCore/style/values/StyleGradient.cpp:
* Source/WebCore/style/values/StyleGradient.h:
* Source/WebCore/style/values/StylePosition.cpp:
* Source/WebCore/style/values/StylePosition.h:
* Source/WebCore/style/values/StylePrimitiveNumericTypes+Conversions.cpp:
* Source/WebCore/style/values/StylePrimitiveNumericTypes+Conversions.h:
* Source/WebCore/style/values/StylePrimitiveNumericTypes.cpp: Removed.
* Source/WebCore/style/values/StylePrimitiveNumericTypes.h:

Canonical link: https://commits.webkit.org/285128@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list