Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a10c81dcc8fb22521e0999dc7e119a94c92c7520
      
https://github.com/WebKit/WebKit/commit/a10c81dcc8fb22521e0999dc7e119a94c92c7520
  Author: Darin Adler <da...@apple.com>
  Date:   2022-11-02 (Wed, 02 Nov 2022)

  Changed paths:
    M Source/WebCore/animation/CSSPropertyAnimation.cpp
    M Source/WebCore/animation/CSSTransition.cpp
    M Source/WebCore/animation/CSSTransition.h
    M Source/WebCore/animation/KeyframeEffect.cpp
    M Source/WebCore/css/CSSBackgroundRepeatValue.cpp
    M Source/WebCore/css/CSSComputedStyleDeclaration.cpp
    M Source/WebCore/css/CSSCustomPropertyValue.cpp
    M Source/WebCore/css/CSSFunctionValue.cpp
    M Source/WebCore/css/CSSGridAutoRepeatValue.cpp
    M Source/WebCore/css/CSSPrimitiveValue.cpp
    M Source/WebCore/css/CSSStyleDeclaration.cpp
    M Source/WebCore/css/CSSValuePool.cpp
    M Source/WebCore/css/ComputedStyleExtractor.cpp
    M Source/WebCore/css/DOMCSSNamespace.cpp
    M Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
    M Source/WebCore/css/PropertySetCSSStyleDeclaration.h
    M Source/WebCore/css/StyleColor.cpp
    M Source/WebCore/css/StyleProperties.cpp
    M Source/WebCore/css/makeprop.pl
    M Source/WebCore/css/makevalues.pl
    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/typedom/ComputedStylePropertyMapReadOnly.cpp
    M Source/WebCore/css/typedom/MainThreadStylePropertyMapReadOnly.cpp
    M Source/WebCore/css/typedom/StylePropertyMap.cpp
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/html/CustomPaintImage.cpp
    M Source/WebCore/inspector/InspectorStyleSheet.cpp
    M Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp
    M Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
    M Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
    M Source/WebCore/platform/HashTools.h
    M Source/WebCore/platform/animation/Animation.cpp
    M Source/WebCore/rendering/style/RenderStyleConstants.cpp
    M Source/WebCore/style/PropertyCascade.cpp
    M Source/WebCore/style/StyleBuilderCustom.h

  Log Message:
  -----------
  Style and performance tweaks to CSS property name and keyword value tables
https://bugs.webkit.org/show_bug.cgi?id=247244
rdar://101730654

Reviewed by Sam Weinig.

* Source/WebCore/animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
Use nameLiteral, numCSSPRoperties instead of lastCSSProperty, and
allCSSProperties.

* Source/WebCore/animation/CSSTransition.cpp:
(WebCore::CSSTransition::createEvent): Use nameString.

* Source/WebCore/animation/CSSTransition.h: Use const AtomString& for the
return value of transitionProperty to cut down on reference count churn.
Use nameString, moved isCSSTransition to private.

* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::CSSPropertyIDToIDLAttributeName): Use nameForIDL.
(WebCore::processKeyframeLikeObject): Use isExposed.

* Source/WebCore/css/CSSBackgroundRepeatValue.cpp:
(WebCore::CSSBackgroundRepeatValue::customCSSText const): Use nameString.
* Source/WebCore/css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::item const): Ditto.
* Source/WebCore/css/CSSCustomPropertyValue.cpp:
(WebCore::CSSCustomPropertyValue::customCSSText const): Ditto.

* Source/WebCore/css/CSSFunctionValue.cpp:
(WebCore::CSSFunctionValue::customCSSText const): Use nameLiteral.
* Source/WebCore/css/CSSGridAutoRepeatValue.cpp:
(WebCore::CSSGridAutoRepeatValue::customCSSText const): Ditto.

* Source/WebCore/css/CSSPrimitiveValue.cpp:
(WebCore::propertyName): Deleted.
(WebCore::valueName): Deleted.
(WebCore::CSSPrimitiveValue::stringValue const): Use nameString.
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): Ditto.
(WebCore::CSSPrimitiveValue::equals const): Compare property and value
IDs rather than converting to strings and comparing the strings.

* Source/WebCore/css/CSSStyleDeclaration.cpp:
(WebCore::parseJavaScriptCSSPropertyName): Use AtomString for the
map keys for better performance. Don't add a trailing NUL character,
since it's not required any more. Use findCSSProperty.
(WebCore::lookupCSSPropertyFromIDLAttribute): Don't add a trailing
NUL character since it's not required any more. Use findCSSProperty.
(WebCore::CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName):
Merged propertyIDFromJavaScriptCSSPropertyName in here, we don't need
two separate functions. Use isExposed.

* Source/WebCore/css/CSSValuePool.cpp:
(WebCore::StaticCSSValuePool::StaticCSSValuePool): Use allCSSValueKeywords.
(WebCore::CSSValuePool::createIdentifierValue): Do the assertion without
using firstCSSValueKeyword and lastCSSValueKeyword.

* Source/WebCore/css/ComputedStyleExtractor.cpp:
(WebCore::createTransitionPropertyValue): Use nameString.
(WebCore::ComputedStyleExtractor::propertyValue): Use isExposed.
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Ditto.
(WebCore::ComputedStyleExtractor::copyProperties): Use allLonghandCSSProperties.

* Source/WebCore/css/DOMCSSNamespace.cpp:
(WebCore::DOMCSSNamespace::supports): Use isExposed.

* Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp:
(WebCore::PropertySetCSSStyleDeclaration::length const): Use isExposed.
(WebCore::PropertySetCSSStyleDeclaration::item const): Ditto.
(WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue): Ditto.
(WebCore::PropertySetCSSStyleDeclaration::getPropertyValue): Ditto.
(WebCore::PropertySetCSSStyleDeclaration::getPropertyPriority): Ditto.
(WebCore::PropertySetCSSStyleDeclaration::getPropertyShorthand): Ditto.
(WebCore::PropertySetCSSStyleDeclaration::isPropertyImplicit): Ditto.
(WebCore::PropertySetCSSStyleDeclaration::setProperty): Ditto.
(WebCore::PropertySetCSSStyleDeclaration::removeProperty): Ditto.
(WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal): Ditto.
(WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal): Ditto.
(WebCore::PropertySetCSSStyleDeclaration::isExposed const): Renamed from
isCSSPropertyExposed and added the check for CSSPropertyInvalid here so
we don't need to repeat it at all callers.
* Source/WebCore/css/PropertySetCSSStyleDeclaration.h: Updated for above.

* Source/WebCore/css/StyleColor.cpp:
(WebCore::StyleColor::colorFromAbsoluteKeyword): Use nameLiteral.

* Source/WebCore/css/StyleProperties.cpp:
(WebCore::StyleProperties::fontValue const): Use nameString and nameLiteral.
(WebCore::StyleProperties::get2Values const): Use nameString.
(WebCore::StyleProperties::get4Values const): Use nameString.
(WebCore::StyleProperties::getLayeredShorthandValue const): Use nameLiteral.
(WebCore::StyleProperties::getPropertyShorthand const): Use nameString.
(WebCore::StyleProperties::asTextInternal const): Use isLonghand and 
nameLiteral.
(WebCore::MutableStyleProperties::setProperty): Use isExposed and isInternal.
(WebCore::StyleProperties::PropertyReference::cssName const): Use nameString.

* Source/WebCore/css/makeprop.pl: Removed support for runtime-flag. We don't 
need it any more.
Moved the computedPropertyIDs array out of the header. Moved the hash table 
structure in here
from HashTools.h. Set the %7bit flag since all the clients already forbid 
non-ASCII characters.
Removed unneeded custom lookup-function-name, hash-function-name, and 
word-array-name since
class-name already prevents collisions. Added isLonghand. Renamed 
isInternalCSSProperty to just
isInternal since the argument is a strongly typed CSSPRopertyID. Similarly 
renamed
isCSSPropertyExposed to isExposed. Replaced the findProperty function with one 
named
findCSSProperty that returns a CSSPropertyID insted of a pointer into the hash 
table. Renamed
getPropertyName to nameLiteral. Renamed getPropertyNameAtomString to 
nameString. Use a
NeverDestroyed instead of allocating the array of AtomString on the heap. Got 
rid of
getPropertyNameString. Renamed getJSPropertyName to nameForIDL. Made some 
tables constexpr.
Renamed getRelatedPropertyID to relatedProperty. Made the property index 
constants use uint16_t
and the string length constant use unsigned instead of size_t. Use constexpr 
for them. Changed
computedPropertyIDs to be a std::array. Removed convertToCSSPropertyID. Added 
CSSPropertiesRange
class template to help us implement range-based for statements. Added 
allCSSProperties and
allLonghandCSSProperties.

* Source/WebCore/css/makevalues.pl: Moved the hash table structure in here
from HashTools.h. Set the %7bit flag since all the clients already forbid
non-ASCII characters. Removed unneeded custom lookup-function-name,
hash-function-name, and word-array-name since class-name already prevents 
collisions.
Replaced the findValue function with one named findCSSValueKeyword that returns
a CSSValueID instead of a pointer into the hash table. Renamed getValueName
to nameLiteral. Renamed getValueNameAtomString to nameString. Got rid of
getValueNameString. Made the index constants use uint16_t and the string length
constant use unsigned instead of size_t. Added AllCSSValueKeywordsRange class 
template
to help us implement range-based for statements. Added allCSSValueKeywords.

* Source/WebCore/css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::maybeParseValue): Use isExposed.

* Source/WebCore/css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeDeclaration): Use isExposed.

* Source/WebCore/css/parser/CSSPropertyParser.cpp: Removed include of
HashTools.h.
(WebCore::cssPropertyID): Removed unneeded extra characters in buffer. Removed
code that adds a trailing NUL character. Use findCSSProperty.
(WebCore::isAppleLegacyCSSValueKeyword): Removed unnecessarily complex handling
of "-apple-wireless" prefix, simplifying making it match the other cases. Also
tweaked the logic to do less excess checking.
(WebCore::cssValueKeywordID): Removed code that adds a trailing NUL character.
SImplified the isAppleLegacyCSSValueKeyword section a little and removed a
misplaced comment. Use findCSSValueKeyword.
(WebCore::CSSPropertyParser::addProperty): Use isExposed.
(WebCore::consumeWillChange): Use isExposed.
(WebCore::CSSPropertyParser::parseSingleValue): Use isExposed.
(WebCore::CSSPropertyParser::parseCounterStyleDescriptor): Use isExposed.
(WebCore::CSSPropertyParser::parseFontFaceDescriptor): Use isExposed.
(WebCore::CSSPropertyParser::parseFontPaletteValuesDescriptor): Use isExposed.
(WebCore::CSSPropertyParser::consumeContainIntrinsicSizeShorthand): Use 
isExposed.

* Source/WebCore/css/typedom/ComputedStylePropertyMapReadOnly.cpp:
(WebCore::ComputedStylePropertyMapReadOnly::get const): Use isExposed.
(WebCore::ComputedStylePropertyMapReadOnly::getAll const): Use isExposed.
(WebCore::ComputedStylePropertyMapReadOnly::entries const): Use nameString.

* Source/WebCore/css/typedom/MainThreadStylePropertyMapReadOnly.cpp:
(WebCore::MainThreadStylePropertyMapReadOnly::get const): Use isExposed.
(WebCore::MainThreadStylePropertyMapReadOnly::getAll const): Use isExposed.

* Source/WebCore/css/typedom/StylePropertyMap.cpp:
(WebCore::StylePropertyMap::remove): Use isExposed.

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::exposedComputedCSSPropertyIDs): Tweaked code since
computedPropertyIDs is now a std::array. Also decreased copying a little
using std::optional::emplace. We could do even better if we made a FixedVector
constructor that took a pair of iterators or a Span. Use isExposed.
(WebCore::Document::detachFromFrame): Fixed comment typo.

* Source/WebCore/html/CustomPaintImage.cpp: Use nameString.

* Source/WebCore/inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyle::collectProperties const): Use allCSSProperties and 
isExposed.
Fixes a bug where we would not iterate over the last CSS property. Use 
nameString.
(WebCore::InspectorStyle::styleWithProperties const): Use isExposed and 
nameString.

* Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp:
(WebCore::buildObjectForKeyframes): Use nameString.

* Source/WebCore/inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::getSupportedCSSProperties): Use allCSSProperties,
isExposed, nameString, and allCSSValueKeywords.

* Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::captionsWindowCSS const): Use 
nameLiteral.
(WebCore::appendCSS): Turned this into a template to cut down on temporary 
strings.
(WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const):
Reorder arguments and stop using nameString when calling appendCSS.
(WebCore::CaptionUserPreferencesMediaAF::colorPropertyCSS const): Ditto.
(WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS const): Ditto.
Also got rid of NeverDestroyed<const String> because we are appending these 
strings,
so we can just use literals.

* Source/WebCore/platform/HashTools.h: Remove Property, Value, findProperty, 
and findValue.

* Source/WebCore/platform/animation/Animation.cpp:
(WebCore::operator<<): Use nameLiteral.
* Source/WebCore/rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<): Ditto.

* Source/WebCore/style/PropertyCascade.cpp:
(WebCore::Style::PropertyCascade::lastDeferredPropertyResolvingRelated const):
Use relatedProperty.

* Source/WebCore/style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyValueWillChange): Use isExposed.

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to