Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2ba07c2f90a77ef03bdf17f7760d8e79851afb67
      
https://github.com/WebKit/WebKit/commit/2ba07c2f90a77ef03bdf17f7760d8e79851afb67
  Author: Sam Weinig <[email protected]>
  Date:   2024-11-22 (Fri, 22 Nov 2024)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/css/CSSGradientValue.cpp
    M Source/WebCore/css/calc/CSSCalcTree+Copy.h
    M Source/WebCore/css/color/CSSColorConversion+Normalize.h
    M Source/WebCore/css/color/CSSColorDescriptors.h
    M Source/WebCore/css/color/CSSColorMixSerialization.cpp
    M Source/WebCore/css/color/CSSRelativeColorResolver.h
    M Source/WebCore/css/color/CSSUnresolvedRelativeColor.h
    M 
Source/WebCore/css/parser/CSSPropertyParserConsumer+CSSPrimitiveValueResolver.h
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Color.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Font.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Image.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Integer.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+IntegerDefinitions.h
    M Source/WebCore/css/values/images/CSSGradient.cpp
    M Source/WebCore/css/values/primitives/CSSPosition.cpp
    M 
Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes+CSSValueCreation.h
    M 
Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes+CSSValueVisitation.h
    M 
Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes+ComputedStyleDependencies.h
    M 
Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes+EvaluateCalc.h
    M 
Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes+Serialization.h
    M Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes.cpp
    M Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes.h
    M Source/WebCore/platform/calc/CalculationValue.h
    M Source/WebCore/style/StyleResolveForFont.cpp
    M 
Source/WebCore/style/values/primitives/StylePrimitiveNumericTypes+Conversions.h

  Log Message:
  -----------
  Pack CSS::PrimitiveNumeric
https://bugs.webkit.org/show_bug.cgi?id=283507

Reviewed by Darin Adler.

Packs CSS::PrimitiveNumeric so that it takes 16 bytes instead of 24 bytes.

The old structure was:

     CSS::PrimitiveNumeric {
         std::variant<
             RawPrimitive           // { CSSUnitType type; double value; } // 
16 bytes (including padding)
             CSSUnevaluatedCalc<T>  // { CSSCalcValue* calc;             } // 8 
bytes
         >
     }

With the std::variant's tag value and padding, this leads to waste.

The new structure is:

     CSS::PrimitiveNumeric {
         CSSUnitType type;  // 8 bytes (including padding)
         union {
             CSSCalcValue* calc;                // 8 bytes
             RawPrimitive::ValueType number;    // 8 bytes
         } value;
    }

We then use the following schema to ensure the correct alternative is used.

    When type == CSSUnitType::CSS_CALC, value is calc.
    When type == CSSUnitType::CSS_UNKNOWN, value is empty (used by Markable).
    When type == anything else, value is number.

* Source/WebCore/css/calc/CSSCalcTree+Copy.h:
    - Remove unnecessary forward.

* Source/WebCore/css/color/CSSColorConversion+Normalize.h:
    - Use direct WTF::switchOn.

* Source/WebCore/css/color/CSSColorDescriptors.h:
* Source/WebCore/css/color/CSSUnresolvedRelativeColor.h:
    - Add needed #include.

* Source/WebCore/css/color/CSSColorMixSerialization.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Color.cpp:
    - Use new interface rather than std::variant functions.

* Source/WebCore/css/color/CSSRelativeColorResolver.h:
    - Fix sorting.

* 
Source/WebCore/css/parser/CSSPropertyParserConsumer+CSSPrimitiveValueResolver.h:
    - Update for swapped order of CSS::Integer template arguments
    - Use direct WTF::switchOn.

* Source/WebCore/css/parser/CSSPropertyParserConsumer+Font.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Image.cpp:
* Source/WebCore/css/values/images/CSSGradient.cpp:
* Source/WebCore/css/values/primitives/CSSPosition.cpp:
* 
Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes+CSSValueCreation.h:
* 
Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes+CSSValueVisitation.h:
* 
Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes+ComputedStyleDependencies.h:
* Source/WebCore/style/StyleResolveForFont.cpp:
    - Use direct WTF::switchOn.

* Source/WebCore/css/parser/CSSPropertyParserConsumer+Integer.cpp:
* Source/WebCore/css/parser/CSSPropertyParserConsumer+IntegerDefinitions.h:
    - Update for swapped order of CSS::Integer template arguments

* Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes+EvaluateCalc.h:
    - Move more calc functions here
    - Use direct WTF::switchOn.

* Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes+Serialization.h:
    - Remove unnecessary `inline` usage.
    - Use direct WTF::switchOn.

* Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes.cpp:
    - Add supported unit for assertions.

* Source/WebCore/css/values/primitives/CSSPrimitiveNumericTypes.h:
    - Switch order of template arguments for CSS::Integer/CSS::IntegerRaw to 
have Range first.
    - Give each raw type a ValueType type definition, used by PrimitiveNumeric.
    - Replace std::variant based implementation of PrimitiveNumeric with a 
union + CSSUnitType
      based one.
    - Overload WTF::switchOn() for PrimitiveNumeric so it can continue to be 
used with minimal
      changes for callers.

* Source/WebCore/platform/calc/CalculationValue.h:
    - Export operator==, now used by WebKit, previously calc equality was done 
incorrectly via
      pointers.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to