[webkit-changes] [WebKit/WebKit] 8e9f9d: Remove some unneeded CSSValue functions and stream...

Darin Adler noreply at github.com
Thu Jan 12 22:07:07 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8e9f9d34d8cfb01b1174c74e39a0fc6effba9343
      https://github.com/WebKit/WebKit/commit/8e9f9d34d8cfb01b1174c74e39a0fc6effba9343
  Author: Darin Adler <darin at apple.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/css/CSSComputedStyleDeclaration.cpp
    M Source/WebCore/css/CSSComputedStyleDeclaration.h
    M Source/WebCore/css/CSSPrimitiveValue.cpp
    M Source/WebCore/css/CSSPrimitiveValue.h
    M Source/WebCore/css/CSSStyleDeclaration.h
    M Source/WebCore/css/CSSToStyleMap.cpp
    M Source/WebCore/css/CSSValue.cpp
    M Source/WebCore/css/CSSValue.h
    M Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.h
    M Source/WebCore/css/DeprecatedCSSOMValue.cpp
    M Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
    M Source/WebCore/css/PropertySetCSSStyleDeclaration.h
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/editing/EditingStyle.cpp
    M Source/WebCore/editing/cocoa/HTMLConverter.mm
    M Source/WebCore/inspector/InspectorOverlay.cpp
    M Source/WebCore/style/ElementRuleCollector.cpp
    M Source/WebCore/style/PropertyCascade.cpp
    M Source/WebCore/style/StyleBuilder.cpp
    M Source/WebCore/style/StyleResolver.cpp
    M Source/WebCore/svg/SVGFontFaceElement.cpp

  Log Message:
  -----------
  Remove some unneeded CSSValue functions and streamline CSS-wide keyword handling
https://bugs.webkit.org/show_bug.cgi?id=250513
rdar://104167575

Reviewed by Tim Nguyen and Oriol Brufau.

Removed some other unneeded things as as well. One benefit of this change is that the CSSValue
class is a little less cluttered. Another is that the new implementations are mostly inlined
so there might be a small performance boost. Other small improvements in specific code paths.

* Source/WebCore/WebCore.xcodeproj/project.pbxproj: Made CSSParserIdioms.h a "private" header
since it's now included indirectly by WebKitLegacy source files. There are other ways to solve
this problem, but I prefer this one since it doesn't reduce inlining.

* Source/WebCore/css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValueInternal): Deleted.
* Source/WebCore/css/CSSComputedStyleDeclaration.h: Removed getPropertyCSSValueInternal.

* Source/WebCore/css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Updated the flag name from m_isImplicit
to m_isImplicitInitialValue.
(WebCore::CSSPrimitiveValue::isCSSWideKeyword const): Deleted.
* Source/WebCore/css/CSSPrimitiveValue.h: Removed isInitialValue, isImplicitInitialValue,
isInheritValue, isUnsetValue, isRevertValue, isRevertLayerValue, and isCSSWideKeyword.

* Source/WebCore/css/CSSStyleDeclaration.h: Removed getPropertyCSSValueInternal.

* Source/WebCore/css/CSSToStyleMap.cpp:
(WebCore::treatAsInitialValue): Added. Replaces CSSValue::treatAsInitialValue.
This was the only place that function was used.
(WebCore::CSSToStyleMap::mapFillAttachment): Use treatAsInitialValue.
(WebCore::CSSToStyleMap::mapFillClip): Ditto.
(WebCore::CSSToStyleMap::mapFillComposite): Ditto.
(WebCore::CSSToStyleMap::mapFillBlendMode): Ditto.
(WebCore::CSSToStyleMap::mapFillOrigin): Ditto.
(WebCore::CSSToStyleMap::mapFillImage): Ditto.
(WebCore::CSSToStyleMap::mapFillRepeat): Ditto.
(WebCore::CSSToStyleMap::mapFillSize): Ditto.
(WebCore::CSSToStyleMap::mapFillXPosition): Ditto.
(WebCore::CSSToStyleMap::mapFillYPosition): Ditto.
(WebCore::CSSToStyleMap::mapFillMaskMode): Ditto.
(WebCore::CSSToStyleMap::mapAnimationDelay): Ditto.
(WebCore::CSSToStyleMap::mapAnimationDirection): Ditto.
(WebCore::CSSToStyleMap::mapAnimationDuration): Ditto.
(WebCore::CSSToStyleMap::mapAnimationFillMode): Ditto.
(WebCore::CSSToStyleMap::mapAnimationIterationCount): Ditto.
(WebCore::CSSToStyleMap::mapAnimationName): Ditto.
(WebCore::CSSToStyleMap::mapAnimationPlayState): Ditto.
(WebCore::CSSToStyleMap::mapAnimationProperty): Ditto.
(WebCore::CSSToStyleMap::mapAnimationTimingFunction): Ditto.
(WebCore::CSSToStyleMap::mapAnimationCompositeOperation): Ditto.

* Source/WebCore/css/CSSValue.cpp:
(WebCore::CSSValue::treatAsInheritedValue const): Deleted.
(WebCore::CSSValue::treatAsInitialValue const): Deleted.
(WebCore::CSSValue::isInitialValue const): Deleted.
(WebCore::CSSValue::isImplicitInitialValue const): Deleted.
(WebCore::CSSValue::isInheritValue const): Deleted.
(WebCore::CSSValue::isUnsetValue const): Deleted.
(WebCore::CSSValue::isRevertValue const): Deleted.
(WebCore::CSSValue::isRevertLayerValue const): Deleted.
(WebCore::CSSValue::isCSSWideKeyword const): Deleted.

* Source/WebCore/css/CSSValue.h: Use the m_isImplicitInitialValue flag to
implement the isImplicitInitialValue function. Removed isInheritValue,
isInitialValue, isUnsetValue, isRevertValue, isRevertLayerValue,
isCSSWideKeyword, treatAsInitialValue, and treatAsInheritedValue.

* Source/WebCore/css/DeprecatedCSSOMPrimitiveValue.h: Use isCSSWideKeyword from CSSParserIdioms.

* Source/WebCore/css/DeprecatedCSSOMValue.cpp:
(WebCore::DeprecatedCSSOMComplexValue::cssValueType const): Use valueID
instead of separate getters.

* Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue): Call
the underlying getPropertyCSSValue directly instead of through getPropertyCSSValueInternal.
(WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal): Deleted.

* Source/WebCore/css/PropertySetCSSStyleDeclaration.h: Removed getPropertyCSSValueInternal.

* Source/WebCore/css/StyleProperties.cpp:
(WebCore::StyleProperties::commonShorthandChecks const): Use isCSSWideKeyword from CSSParserIdioms.

* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::initialValueTextForLonghand): Removed unneeded std::monostate case.

* Source/WebCore/editing/EditingStyle.cpp:
(WebCore::fontWeightValueIsBold): Use isCSSWideKeyword from CSSParserIdioms.

* Source/WebCore/editing/cocoa/HTMLConverter.mm:
(HTMLConverterCaches::propertyValueForNode): Use isValueID.
(HTMLConverterCaches::floatPropertyValueForNode): Ditto.
(HTMLConverterCaches::colorPropertyValueForNode): Ditto.

* Source/WebCore/inspector/InspectorOverlay.cpp:
(WebCore::authoredGridTrackSizes): Get the columns or rows property directly from the inline
style rather than going indirectly through cssomStyle, which does the same thing but is less
efficient because it unnecessarily creates an object as a side effect and requires the
getPropertyCSSValueInternal function, not used anywhere else.

* Source/WebCore/style/ElementRuleCollector.cpp:
(WebCore::Style::ElementRuleCollector::addMatchedProperties): Use isValueID.
* Source/WebCore/style/PropertyCascade.cpp:
(WebCore::Style::PropertyCascade::addMatch): Ditto.

* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::applyProperty): Use valueID, and simplify since traditional properties
and custom properties are now both expressing special values the same way.

* Source/WebCore/style/StyleResolver.cpp:
(WebCore::Style::Resolver::styleForKeyframe): Use isValueID.
* Source/WebCore/svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::parseAttribute): Ditto.

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




More information about the webkit-changes mailing list