[webkit-changes] [WebKit/WebKit] d8f83b: CSSValuePool can be used more efficiently

Darin Adler noreply at github.com
Sun Jan 15 11:16:32 PST 2023


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

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/contentextensions/ContentExtensionParser.cpp
    M Source/WebCore/css/BasicShapeFunctions.cpp
    M Source/WebCore/css/CSSBackgroundRepeatValue.cpp
    M Source/WebCore/css/CSSBasicShapes.cpp
    M Source/WebCore/css/CSSContentDistributionValue.cpp
    M Source/WebCore/css/CSSContentDistributionValue.h
    M Source/WebCore/css/CSSFontFace.cpp
    M Source/WebCore/css/CSSFontFaceSet.cpp
    R Source/WebCore/css/CSSFontFamily.h
    M Source/WebCore/css/CSSFontFeatureValuesRule.cpp
    M Source/WebCore/css/CSSFontSelector.cpp
    M Source/WebCore/css/CSSFontVariantLigaturesParser.h
    M Source/WebCore/css/CSSFontVariantNumericParser.h
    M Source/WebCore/css/CSSOffsetRotateValue.cpp
    M Source/WebCore/css/CSSOffsetRotateValue.h
    M Source/WebCore/css/CSSPrimitiveValue.cpp
    M Source/WebCore/css/CSSPrimitiveValue.h
    M Source/WebCore/css/CSSPrimitiveValueMappings.h
    M Source/WebCore/css/CSSProperties.json
    M Source/WebCore/css/CSSValueList.h
    M Source/WebCore/css/CSSValuePool.cpp
    M Source/WebCore/css/CSSValuePool.h
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/css/FontFace.cpp
    M Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/parser/CSSParserContext.cpp
    M Source/WebCore/css/parser/CSSParserFastPaths.cpp
    M Source/WebCore/css/parser/CSSParserImpl.cpp
    M Source/WebCore/css/parser/CSSPropertyParser.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
    M Source/WebCore/css/parser/CSSPropertyParserHelpers.h
    M Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp
    M Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.h
    M Source/WebCore/css/process-css-properties.py
    M Source/WebCore/css/typedom/CSSKeywordValue.cpp
    M Source/WebCore/css/typedom/CSSStyleValueFactory.cpp
    M Source/WebCore/dom/StyledElement.cpp
    M Source/WebCore/editing/ApplyStyleCommand.cpp
    M Source/WebCore/editing/EditingStyle.cpp
    M Source/WebCore/editing/FontAttributeChanges.cpp
    M Source/WebCore/editing/mac/EditorMac.mm
    M Source/WebCore/html/HTMLElement.cpp
    M Source/WebCore/html/HTMLInputElement.cpp
    M Source/WebCore/html/HTMLTableElement.cpp
    M Source/WebCore/html/OffscreenCanvas.cpp
    M Source/WebCore/html/OffscreenCanvas.h
    M Source/WebCore/html/shadow/TextControlInnerElements.cpp
    M Source/WebCore/page/Frame.cpp
    M Source/WebCore/rendering/style/StyleCrossfadeImage.cpp
    M Source/WebCore/rendering/style/StyleFilterImage.cpp
    M Source/WebCore/style/StyleBuilder.cpp
    M Source/WebCore/style/StyleBuilderConverter.h
    M Source/WebCore/style/StyleBuilderCustom.h
    M Source/WebCore/style/UserAgentStyle.cpp
    M Source/WebCore/svg/SVGLengthValue.cpp

  Log Message:
  -----------
  CSSValuePool can be used more efficiently
https://bugs.webkit.org/show_bug.cgi?id=250514
rdar://problem/104170378

Reviewed by Sam Weinig.

CSSValuePool was not being used consistently. Because we left the ways to create CSS values
without using the pool accessible some callers just weren't using it. Also, the static CSS
value pool can be used safely on any thread once it has been initialized, so in the vast majority
of cases we don't need to call CSSValuePool::singleton. To solve these problems, built the use of
the static pool into the CSSPrimitiveValue class itself, and only left functions in CSSValuePool
for the cases that really ned a separate per-thread pool. Also made some things private and deleted
in CSSPrimitiveValue so we can't bypass the pool by accident without a compile error.

One major thing that remains is changing CSSPrimitiveValueMappings.h so it takes advantage of
the pool. Including that here would have made this patch too big, but it's a logical next step.

As part of this, removed CSSFontFamily since a font family name is really just a string that
serializes with a special rule. We have not been using a separate boolean along with the string
for some time now, but the code was still hanging around.

* Source/WebCore/Headers.cmake: Removed CSSFontFamily.h.
* Source/WebCore/WebCore.xcodeproj/project.pbxproj: Removed CSSFontFamily.h and made
CSSValuePool.h private instead of project so it can be included outside WebCore.

* Source/WebCore/contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::isValidCSSSelector): Removed unneeded redundant initialization
that repeats what is already in ProcessWarming::initializeNames. Stumbled on this while working
on initialization of StaticCSSValuePool.

* Source/WebCore/css/BasicShapeFunctions.cpp:
(WebCore::valueForCenterCoordinate): Removed pool arguments and use CSSPrimitiveValue directly.
(WebCore::basicShapeRadiusToCSSValue): Ditto.
(WebCore::valueForBasicShape): Ditto.
* Source/WebCore/css/CSSBackgroundRepeatValue.cpp:
(WebCore::CSSBackgroundRepeatValue::CSSBackgroundRepeatValue): Ditto.
* Source/WebCore/css/CSSBasicShapes.cpp:
(WebCore::buildSerializablePositionOffset): Ditto.

* Source/WebCore/css/CSSContentDistributionValue.cpp:
(WebCore::CSSContentDistributionValue::customCSSText const): Rewrote serialization so it does not
use CSSValueList unnecessarily.

* Source/WebCore/css/CSSContentDistributionValue.h: Use CSSPrimitiveValue directly.

* Source/WebCore/css/CSSFontFace.cpp:
(WebCore::CSSFontFace::family const): Use stringValue for font family string.
* Source/WebCore/css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::familyNameFromPrimitive): Ditto. Also remove unneeded isValueID check.

* Source/WebCore/css/CSSFontFamily.h: Removed.

* Source/WebCore/css/CSSFontFeatureValuesRule.cpp:
(WebCore::CSSFontFeatureValuesRule::cssText const): ASCIILiteral instead of String for efficiency.

* Source/WebCore/css/CSSFontSelector.cpp: Removed include of CSSFontFamily.h.

* Source/WebCore/css/CSSFontVariantLigaturesParser.h:
(WebCore::CSSFontVariantLigaturesParser::finalizeValue): Use CSSPrimitiveValue directly.
* Source/WebCore/css/CSSFontVariantNumericParser.h:
(WebCore::CSSFontVariantNumericParser::finalizeValue): Ditto.

* Source/WebCore/css/CSSPrimitiveValue.cpp:
(WebCore::isStringType): Return true for CSS_FONT_FAMILY.
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Removed CSSValueID constructor since we only
use the StaticCSSValue version. Updated the ImplicitInitialValue constructor for that change.
(WebCore::CSSPrimitiveValue::cleanup): Make CSS_FONT_FAMILY clean up the string.
(WebCore::CSSPrimitiveValue::create): Renamed from CSSValuePool::createValue and moved here.
Use Ref for thevalue type in the hash map and also call the CSSPrimitiveValue constructor rather
than create since this is now the create function and it can't call itself. Also made this handle
negative zero properly by using memcmp to check if floating point values are identical, not just
equal. The old function wasn't called with negative zero because the code implementing calc() did
not use CSSValuePool.
(WebCore::CSSPrimitiveValue::stringValue const): Use string case for CSS_FONT_FAMILY.
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): Use m_value.string
for CSS_FONT_FAMILY.
(WebCore::CSSPrimitiveValue::equals const): Use the string case for CSS_FONT_FAMILY.

* Source/WebCore/css/CSSPrimitiveValue.h: Renamed createIdentifier to create, using overloading
instead of function name. Made create(CSSValueID) an inline function that is defined in the
CSSValuePool.h header. Added createCustomIdent. Made create(double, CSSUnitType) a function
that is defined in CSSValuePool.cpp. Added implicitInitialValue, also an inline function defined in
the CSSValuePool.h header. Removed fontFamily. Made many constructors explicit. Added compile time
guards for AtomString, Color, and String, to make a compile time error if someone tries to call
CSSPrimitiveValue::create with one of those types. Removed isResolution and m_value.fontFamily.

* Source/WebCore/css/CSSPrimitiveValueMappings.h: Removed CSSFontFamily code.

* Source/WebCore/css/CSSProperties.json: Removed parser-function-requires-value-pool from
consumeFontStyle, consumeFontStretchRange, consumeFontStyleRange, consumeFontWeightAbsoluteRange,
and consumeFontWeightAbsolute. It's now no longer used for anything, but might need to be in the
future.

* Source/WebCore/css/CSSValueList.h: Removed the non-const iterator. We don't want to be able
to modify the vector using the iterator.

* Source/WebCore/css/CSSValuePool.cpp:
(WebCore::StaticCSSValuePool::StaticCSSValuePool): Tweaked for loop for clarity.
(WebCore::CSSValuePool::CSSValuePool): Removed call to StaticCSSValuePool::init, since that is
no longer needed here; handled instead where we initialize global HTML names and such.
(WebCore::CSSValuePool::createIdentifierValue): Deleted.
(WebCore::CSSValuePool::createColorValue): Use Ref for the value type in the hash map and also
call the CSSPrimitiveValue constructor since we don't want a CSSPrimitiveValue::create that
callers can use by accident.
(WebCore::CSSValuePool::createFontFamilyValue): Do not take a fromSystemFontID argument, no caller
was passing Yes. Use Ref for the value type in the hash map and also create a string of type
CSS_FONT_FAMILY. In this case, we do not have a simple way to prevent callers from using
CSSPrimitiveValue::create with CSS_FONT_FAMILY directly, but it's less of a risk since it's so
explicit compared to the other simpler cases.
(WebCore::CSSValuePool::createFontFaceValue): Use dynamicDowncast to simplify the code a bit.
Removed a FIXME about a tiny bit of reference count churn.

* Source/WebCore/css/CSSValuePool.h: Removed uneeded includes. Removed FromSystemFontID.
Removed createImplicitInitialValue, createIdentifierValue, createValue, and createCustomIdent.
Changed createFontFamilyValue to take a const AtomString&. Got rid of the type names for the
caches, since they were never used. Put the inline CSSPrimitiveValue function definitions that
use the StaticCSSValuePool here.

* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::OrderedNamedLinesCollector::appendLines const): Use CSSPrimitiveValue::create.
(WebCore::valueForImageSliceSide): Ditto.
(WebCore::valueForNinePieceImageQuad): Ditto.
(WebCore::valueForNinePieceImageRepeat): Ditto.
(WebCore::valueForNinePieceImage): Ditto.
(WebCore::fontSizeAdjustFromStyle): Ditto.
(WebCore::zoomAdjustedPixelValue): Ditto.
(WebCore::zoomAdjustedPixelValueForLength): Ditto.
(WebCore::valueForReflection): Ditto.
(WebCore::createPositionListForLayer): Ditto.
(WebCore::createSingleAxisPositionValueForLayer): Ditto.
(WebCore::positionOffsetValue): Ditto.
(WebCore::percentageOrZoomAdjustedValue): Ditto.
(WebCore::autoOrZoomAdjustedValue): Ditto.
(WebCore::valueForQuotes): Ditto.
(WebCore::borderRadiusCornerValue): Ditto.
(WebCore::matrixTransformValue): Ditto.
(WebCore::transformOperationAsCSSValue): Ditto.
(WebCore::computedTransform): Ditto.
(WebCore::computedTranslate): Ditto.
(WebCore::computedScale): Ditto.
(WebCore::computedRotate): Ditto.
(WebCore::adjustLengthForZoom): Ditto.
(WebCore::ComputedStyleExtractor::valueForShadow): Ditto.
(WebCore::ComputedStyleExtractor::valueForFilter): Ditto.
(WebCore::specifiedValueForGridTrackBreadth): Ditto.
(WebCore::specifiedValueForGridTrackSize): Ditto.
(WebCore::valueForGridTrackList): Ditto.
(WebCore::valueForGridPosition): Ditto.
(WebCore::createTransitionPropertyValue): Ditto.
(WebCore::valueForScrollSnapType): Ditto.
(WebCore::willChangePropertyValue): Ditto.
(WebCore::appendLigaturesValue): Ditto.
(WebCore::fontVariantLigaturesPropertyValue): Ditto.
(WebCore::fontVariantPositionPropertyValue): Ditto.
(WebCore::fontVariantCapsPropertyValue): Ditto.
(WebCore::fontVariantNumericPropertyValue): Ditto.
(WebCore::fontVariantAlternatesPropertyValue): Ditto.
(WebCore::fontVariantEastAsianPropertyValue): Ditto.
(WebCore::valueForAnimationDuration): Ditto.
(WebCore::valueForAnimationDelay): Ditto.
(WebCore::valueForAnimationIterationCount): Ditto.
(WebCore::valueForAnimationDirection): Ditto.
(WebCore::valueForAnimationFillMode): Ditto.
(WebCore::valueForAnimationComposition): Ditto.
(WebCore::valueForAnimationPlayState): Ditto.
(WebCore::valueForAnimationName): Ditto.
(WebCore::valueForAnimationTimingFunction): Ditto.
(WebCore::ComputedStyleExtractor::addValueForAnimationPropertyToList): Ditto.
(WebCore::createLineBoxContainValue): Ditto.
(WebCore::valueForPositionOrAuto): Ditto.
(WebCore::valueForPathOperation): Ditto.
(WebCore::valueForContainIntrinsicSize): Ditto.
(WebCore::ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword): Ditto.
(WebCore::valueForFamily): Ditto.
(WebCore::touchActionFlagsToCSSValue): Ditto.
(WebCore::renderTextDecorationLineFlagsToCSSValue): Ditto.
(WebCore::renderTextDecorationStyleFlagsToCSSValue): Ditto.
(WebCore::renderTextDecorationSkipToCSSValue): Ditto.
(WebCore::textUnderlineOffsetToCSSValue): Ditto.
(WebCore::textDecorationThicknessToCSSValue): Ditto.
(WebCore::renderEmphasisPositionFlagsToCSSValue): Ditto.
(WebCore::valueForTextEmphasisStyle): Ditto.
(WebCore::speakAsToCSSValue): Ditto.
(WebCore::hangingPunctuationToCSSValue): Ditto.
(WebCore::fillRepeatToCSSValue): Ditto.
(WebCore::maskSourceTypeToCSSValue): Ditto.
(WebCore::maskModeToCSSValue): Ditto.
(WebCore::fillSizeToCSSValue): Ditto.
(WebCore::altTextToCSSValue): Ditto.
(WebCore::contentToCSSValue): Ditto.
(WebCore::counterToCSSValue): Ditto.
(WebCore::optionalLineHeight): Ditto.
(WebCore::lineHeight): Ditto.
(WebCore::fontPalette): Ditto.
(WebCore::fontWeight): Ditto.
(WebCore::fontStretch): Ditto.
(WebCore::fontStyle): Ditto.
(WebCore::ComputedStyleExtractor::fontVariantShorthandValue): Ditto.
(WebCore::fontSynthesis): Ditto.
(WebCore::fontSynthesisLonghandToCSSValue): Ditto.
(WebCore::shapePropertyValue): Ditto.
(WebCore::valueForItemPositionWithOverflowAlignment): Ditto.
(WebCore::valueForContentPositionAndDistributionWithOverflowAlignment): Ditto.
(WebCore::valueForOffsetRotate): Ditto.
(WebCore::valueForOffsetShorthand): Ditto.
(WebCore::paintOrder): Ditto.
(WebCore::fontShorthandValue) Ditto.:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Ditto.
(WebCore::ComputedStyleExtractor::getFillLayerPropertyShorthandValue): Ditto.

* Source/WebCore/css/FontFace.cpp:
(WebCore::FontFace::setFamily): Convert to AtomString.

* Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::strokeDashArrayToCSSValueList): Use CSSPrimitiveValue::create.
(WebCore::ComputedStyleExtractor::adjustSVGPaint const): Ditto.
(WebCore::ComputedStyleExtractor::svgPropertyValue): Ditto.
* Source/WebCore/css/StyleProperties.cpp:
(WebCore::MutableStyleProperties::setProperty): Ditto.

* Source/WebCore/css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::CSSParserContext): Call StaticCSSValuePool::init here.
Initialize the pool with an approach similar to the one for ProcessWarming::initializeNames,
rather than the more costly check for initializing every time a CSSValuePool is created.

* Source/WebCore/css/parser/CSSParserFastPaths.cpp:
(WebCore::parseColor): Use CSSPrimitiveValue::create.
(WebCore::parseKeywordValue): Ditto.
(WebCore::parseColorWithAuto): Ditto.

* Source/WebCore/css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeFontPaletteValuesRule): Simplify the font family code so it doesn't
rely on getPropertyCSSValue.

* Source/WebCore/css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::addProperty): Use CSSPrimitiveValue::implicitInitialValue.
(WebCore::maybeConsumeCSSWideKeyword): Don't pass CSSValuePool. Use CSSPrimitiveValue::create.
(WebCore::CSSPropertyParser::consumeFont): Ditto.
(WebCore::CSSPropertyParser::consumeTextDecorationSkip): Ditto.
(WebCore::CSSPropertyParser::consumeFontSynthesis): Ditto.
(WebCore::CSSPropertyParser::consumeColumns): Ditto.
(WebCore::initialCSSValueForAnimationLonghand): Ditto.
(WebCore::CSSPropertyParser::consumeFlex): Ditto.
(WebCore::CSSPropertyParser::consumeLegacyBreakProperty): Ditto.
(WebCore::CSSPropertyParser::consumeLegacyTextOrientation): Ditto.
(WebCore::CSSPropertyParser::consumeBackgroundShorthand): Ditto.
(WebCore::CSSPropertyParser::consumeOverflowShorthand): Ditto.
(WebCore::CSSPropertyParser::consumeGridItemPositionShorthand): Ditto.
(WebCore::CSSPropertyParser::consumeGridAreaShorthand): Ditto.
(WebCore::CSSPropertyParser::consumeGridTemplateRowsAndAreasAndColumns): Ditto.
(WebCore::CSSPropertyParser::consumeGridTemplateShorthand): Ditto.
(WebCore::CSSPropertyParser::consumeGridShorthand): Ditto.
(WebCore::CSSPropertyParser::consumeListStyleShorthand): Ditto.
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::CalcParser::CalcParser): Ditto.
(WebCore::CSSPropertyParserHelpers::CalcParser::consumeValue): Ditto.
(WebCore::CSSPropertyParserHelpers::CalcParser::consumeValueIfCategory): Ditto.
(WebCore::CSSPropertyParserHelpers::IntegerTypeKnownTokenTypeFunctionConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::IntegerTypeKnownTokenTypeNumberConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::NumberCSSPrimitiveValueWithCalcWithKnownTokenTypeFunctionConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::NumberCSSPrimitiveValueWithCalcWithKnownTokenTypeNumberConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::PercentCSSPrimitiveValueWithCalcWithKnownTokenTypeFunctionConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::PercentCSSPrimitiveValueWithCalcWithKnownTokenTypePercentConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::LengthCSSPrimitiveValueWithCalcWithKnownTokenTypeFunctionConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::LengthCSSPrimitiveValueWithCalcWithKnownTokenTypeDimensionConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::LengthCSSPrimitiveValueWithCalcWithKnownTokenTypeNumberConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::AngleCSSPrimitiveValueWithCalcWithKnownTokenTypeFunctionConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::AngleCSSPrimitiveValueWithCalcWithKnownTokenTypeDimensionConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::AngleCSSPrimitiveValueWithCalcWithKnownTokenTypeNumberConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::TimeCSSPrimitiveValueWithCalcWithKnownTokenTypeFunctionConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::TimeCSSPrimitiveValueWithCalcWithKnownTokenTypeDimensionConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::TimeCSSPrimitiveValueWithCalcWithKnownTokenTypeNumberConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::ResolutionCSSPrimitiveValueWithCalcWithKnownTokenTypeFunctionConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::ResolutionCSSPrimitiveValueWithCalcWithKnownTokenTypeDimensionConsumer::consume): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeIntegerType): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeInteger): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeNonNegativeInteger): Ditto.
(WebCore::CSSPropertyParserHelpers::consumePositiveInteger): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeNumber): Ditto.
(WebCore::CSSPropertyParserHelpers::consumePercent): Ditto.
(WebCore::CSSPropertyParserHelpers::consumePercentWorkerSafe): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeLength): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeAngle): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeAngleWorkerSafe): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeTime): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeResolution): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeLengthOrPercent): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeNumberOrPercent): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeFontWeightNumberWorkerSafe): Deleted.
(WebCore::CSSPropertyParserHelpers::consumeIdent): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeCustomIdent): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeString): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeURL): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeColor): Ditto.
(WebCore::CSSPropertyParserHelpers::positionFromOneValue): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPointValue): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeCrossFade): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeAspectRatioValue): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeAspectRatio): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeDisplay): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeWillChange): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeFontVariantEastAsian): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeFontVariantAlternates): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeFontWeight): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeMarginTrim): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeClip): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeKeyframesName): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeSingleTransitionPropertyIdent): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeRotate): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeCursor): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeAttr): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeCounterContent): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeBasicShape): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeBorderImageOutset): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeReflect): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeBackgroundSize): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeMasonryAutoFlow): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeTextEmphasisPosition): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeColorScheme): Ditto.
(WebCore::CSSPropertyParserHelpers::consumeIdentWorkerSafe): Deleted.

* Source/WebCore/css/parser/CSSPropertyParserHelpers.h: Removed consumePercentWorkerSafe,
consumeAngleWorkerSafe, consumeFontWeightNumberWorkerSafe, and consumeIdentWorkerSafe.
These are all now worker-safe without having a separate function.

* Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp: Moved declarations of
consumeFontFeatureSettings and consumeFontStretch in here so they don't interfere with the
same-named, same-argument functions generated by the process-css-properties.py script. Later, we
should probably cut down on the number of "worker-safe" functions since only the ones that use
CSSValuePool need a separate worker-safe versions, and unnecessary use of CSSValuePool created the
illusion of non-worker-safety for many functions before these changes.
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceStyle): Don't pass CSSValuePool.
Use CSSPrimitiveValue::create.
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceWeight): Ditto.
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceStretch): Ditto.
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceFeatureSettings): Ditto.
(WebCore::CSSPropertyParserWorkerSafe::parseFontFaceDisplay): Ditto.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStyleAngle): Ditto.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStyleRange): Ditto.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStyle): Ditto.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontWeightAbsoluteKeywordValue): Ditto.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontWeightAbsoluteRange): Ditto.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontWeightAbsolute): Ditto.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStretchKeywordValue): Ditto.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStretch): Ditto.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontStretchRange): Ditto.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFeatureSettings): Ditto.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceFontDisplay): Ditto.

* Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.h: Removed the pool arguments from most
of these functions, and moved consumeFontStretch and consumeFontFeatureSettings out of the header.

* Source/WebCore/css/process-css-properties.py: Use CSSPrimitiveValue::create.
* Source/WebCore/css/typedom/CSSKeywordValue.cpp:
(WebCore::CSSKeywordValue::toCSSValue const): Ditto.
* Source/WebCore/css/typedom/CSSStyleValueFactory.cpp:
(WebCore::CSSStyleValueFactory::constructStyleValueForCustomPropertySyntaxValue): Ditto.
* Source/WebCore/dom/StyledElement.cpp:
(WebCore::StyledElement::setInlineStyleProperty): Ditto.
(WebCore::StyledElement::addPropertyToPresentationalHintStyle): Ditto.
* Source/WebCore/editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): Ditto.
* Source/WebCore/editing/EditingStyle.cpp:
(WebCore::HTMLElementEquivalent::HTMLElementEquivalent): Ditto.
(WebCore::HTMLFontSizeEquivalent::attributeValueAsCSSValue const): Ditto.
(WebCore::EditingStyle::styleWithResolvedTextDecorations const): Ditto.
(WebCore::EditingStyle::overrideTypingStyleAt): Ditto.
(WebCore::EditingStyle::conflictsWithInlineStyleOfElement const): Ditto.
(WebCore::mergeTextDecorationValues): Ditto.
(WebCore::familyNameFromCSSPrimitiveValue): Deleted.
(WebCore::loneFontFamilyName): Use CSSPrimitiveValue::stringValue.
(WebCore::EditingStyle::convertPositionStyle): Use CSSPrimitiveValue::create.
(WebCore::EditingStyle::isFloating): Ditto.
(WebCore::StyleChange::StyleChange): Ditto.

* Source/WebCore/editing/FontAttributeChanges.cpp:
(WebCore::FontChanges::createStyleProperties const): Use AtomString for createFontFamilyValue.
(WebCore::cssValueListForShadow): Use CSSPrimitiveValue::create.
(WebCore::FontAttributeChanges::createEditingStyle const): Use CSSValuePool::createColorValue.

* Source/WebCore/editing/mac/EditorMac.mm:
(WebCore::Editor::platformPasteFont): Use CSSValuePool::createColorValue.

* Source/WebCore/html/HTMLElement.cpp:
(WebCore::HTMLElement::addParsedWidthAndHeightToAspectRatioList): Use CSSPrimitiveValue::create.
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::autoFillStrongPasswordMaskImage): Ditto.
* Source/WebCore/html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::createSharedCellStyle const): Ditto.

* Source/WebCore/html/shadow/TextControlInnerElements.cpp:
(WebCore::TextControlInnerElement::resolveCustomStyle): Fix function name in comment.

* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::Frame): Call StaticCSSValuePool::init here. Initialize the pool with an approach
similar to the one for ProcessWarming::initializeNames, rather than the more costly check for
initializing every time a CSSValuePool is created.

* Source/WebCore/rendering/style/StyleCrossfadeImage.cpp:
(WebCore::StyleCrossfadeImage::computedStyleValue const): Use CSSPrimitiveValue::create.
* Source/WebCore/rendering/style/StyleFilterImage.cpp:
(WebCore::StyleFilterImage::computedStyleValue const): Ditto.
* Source/WebCore/style/StyleBuilder.cpp:
(WebCore::Style::Builder::resolveVariableReferences): Ditto.
* Source/WebCore/style/StyleBuilderConverter.h:
(WebCore::Style::BuilderConverter::convertTextStrokeWidth): Ditto.

* Source/WebCore/style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::mmLength): Streamline by eliminating local variable.
(WebCore::Style::BuilderCustom::inchLength): Ditto.
(WebCore::Style::BuilderCustom::applyValueFontFamily): Use Vector::from for efficiency. Use
stringValue to get the font family name. Added WTFMove for efficiency. Moved empty vector check
to take advantage of the fact that the single element vector can never be empty.

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




More information about the webkit-changes mailing list