Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3f84cb0e5e030791bc3c6efbd7af3bfcca73b3b7
      
https://github.com/WebKit/WebKit/commit/3f84cb0e5e030791bc3c6efbd7af3bfcca73b3b7
  Author: Darin Adler <[email protected]>
  Date:   2023-02-05 (Sun, 05 Feb 2023)

  Changed paths:
    M Source/WebCore/css/CSSFontFace.cpp
    M Source/WebCore/css/CSSPrimitiveValue.h
    M Source/WebCore/css/CSSPrimitiveValueMappings.h
    M Source/WebCore/css/CSSToStyleMap.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.h
    M Source/WebCore/css/process-css-properties.py
    M Source/WebCore/editing/ios/EditorIOS.mm
    M Source/WebCore/html/HTMLTextFormControlElement.cpp
    M Source/WebCore/rendering/style/RenderStyleConstants.cpp
    M Source/WebCore/rendering/style/RenderStyleConstants.h
    M Source/WebCore/style/StyleBuilderConverter.h
    M Source/WebCore/style/StyleBuilderCustom.h
    M Source/WebCore/svg/SVGElement.cpp

  Log Message:
  -----------
  Move implicit mapping out of CSSPrimitiveValue
https://bugs.webkit.org/show_bug.cgi?id=251567
rdar://104946191

Reviewed by Tim Nguyen.

Our automatically generated style building code depends on implicitly
converting CSSValue objects to various destination types. That was done
by a conversion operator in CSSPrimitiveValue, but it's better if the
conversion operator is separate, so the conversion can't be done by
accident in normal uses of CSSPrimitiveValue. At the very least, such
unintentional conversions can lead to confusing compiler errors.

* Source/WebCore/css/CSSFontFace.cpp:
(WebCore::CSSFontFace::setDisplay): Use fromCSSValue.

* Source/WebCore/css/CSSPrimitiveValue.h: Deleted all the conversion
operators, including the ones for numeric types, and the template.

* Source/WebCore/css/CSSPrimitiveValueMappings.h:
(WebCore::fromCSSValue): Added.
(WebCore::TypeDeducingCSSValueMapper::TypeDeducingCSSValueMapper): Added.
(WebCore::TypeDeducingCSSValueMapper::operator TargetType const): Added.
(WebCore::TypeDeducingCSSValueMapper::operator const CSSPrimitiveValue& const): 
Added.
(WebCore::TypeDeducingCSSValueMapper::operator unsigned short const): Added.
(WebCore::TypeDeducingCSSValueMapper::operator int const): Added.
(WebCore::TypeDeducingCSSValueMapper::operator unsigned const): Added.
(WebCore::TypeDeducingCSSValueMapper::operator float const): Added.
(WebCore::TypeDeducingCSSValueMapper::operator double const): Added.
(WebCore::TypeDeducingCSSValueMapper::numericValue const): Added.
(WebCore::fromCSSValueDeducingType): Added.
(WebCore::fromCSSValue): Replaced CSSPrimitiveValue specialization for 
LineClampValue with
fromCSSValue specialization.
(WebCore::CSSPrimitiveValue::operator ColumnSpan const): Deleted. This was not 
needed because we
no longer allow a number for column-span; when we removed support in the parser 
we missed this.
(WebCore::fromCSSValueID): Remove unneeded specializations for 
OptionSet<HangingPunctuation>,
OptionSet<TextDecorationLine>, and OptionSet<TouchAction>, using
DEFINE_TO_FROM_CSS_VALUE_ID_FUNCTIONS instead.

* Source/WebCore/css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapFillClip): Use fromCSSValue.
(WebCore::CSSToStyleMap::mapFillComposite): Ditto.
(WebCore::CSSToStyleMap::mapFillBlendMode): Ditto.
(WebCore::CSSToStyleMap::mapFillOrigin): Ditto.
(WebCore::CSSToStyleMap::mapFillXPosition): Ditto.
(WebCore::CSSToStyleMap::mapFillYPosition): Ditto.

* Source/WebCore/css/parser/CSSPropertyParserHelpers.h: Updated since the 
underlying
type for BoxOrient is bool instead of uint8_t.

* Source/WebCore/css/process-css-properties.py:
(GenerationContext.generate_heading): Tweak comment.
(GenerateCSSPropertyNames): Use fromCSSValueDeducingType.

* Source/WebCore/editing/ios/EditorIOS.mm:
(WebCore::Editor::setTextAlignmentForChangedBaseWritingDirection): Use 
propertyAsValueID,
CSSValueID, and nameString.

* Source/WebCore/html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const): Use 
propertyAsValueID
and fromCSSValueID.

* Source/WebCore/rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<): Removed support for HangingPunctuation::None.

* Source/WebCore/rendering/style/RenderStyleConstants.h: Converted all 
two-value enumerations
to be based on bool instead of uint8_t. Removed HangingPunctuation::None.

* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertTextDecorationLine): Use fromCSSValue.
(WebCore::Style::BuilderConverter::convertTextAlign): Ditto.
(WebCore::Style::BuilderConverter::convertTextAlignLast): Ditto.
(WebCore::Style::BuilderConverter::convertPathOperation): Ditto.
(WebCore::Style::BuilderConverter::convertResize): Ditto.
(WebCore::Style::BuilderConverter::convertTextUnderlinePosition): Ditto.
(WebCore::Style::BuilderConverter::convertReflection): Ditto.
(WebCore::Style::BuilderConverter::convertShapeValue): Ditto.
(WebCore::Style::BuilderConverter::convertScrollSnapType): Ditto.
(WebCore::Style::BuilderConverter::convertScrollSnapAlign): Ditto.
(WebCore::Style::BuilderConverter::convertScrollSnapStop): Ditto.
(WebCore::Style::BuilderConverter::convertTouchAction): Ditto.
(WebCore::Style::BuilderConverter::convertSelfOrDefaultAlignmentData): Ditto.
(WebCore::Style::BuilderConverter::convertSpeakAs): Ditto.
(WebCore::Style::BuilderConverter::convertHangingPunctuation): Ditto.

* Source/WebCore/style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueDirection): Ditto.
(WebCore::Style::BuilderCustom::applyValueVerticalAlign): Ditto.
(WebCore::Style::BuilderCustom::applyValueListStyleType): Ditto.
(WebCore::Style::BuilderCustom::applyValueOutlineStyle): Ditto.
(WebCore::Style::BuilderCustom::applyValueWritingMode): Ditto.
(WebCore::Style::BuilderCustom::applyValueTextOrientation): Ditto.
(WebCore::Style::BuilderCustom::applyValueDisplay): Ditto.
(WebCore::Style::BuilderCustom::applyValueTextEmphasisStyle): Ditto.
(WebCore::Style::BuilderCustom::applyValueCursor): Ditto.

* Source/WebCore/svg/SVGElement.cpp:
(WebCore::SVGElement::colorInterpolation const): Ditto.

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to