Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: ee33925018a17d16e025b7f6f3954be1c34f7ffa https://github.com/WebKit/WebKit/commit/ee33925018a17d16e025b7f6f3954be1c34f7ffa Author: Sam Weinig <wei...@apple.com> Date: 2022-11-22 (Tue, 22 Nov 2022)
Changed paths: M Source/WebCore/CMakeLists.txt M Source/WebCore/DerivedSources-output.xcfilelist M Source/WebCore/DerivedSources.make M Source/WebCore/Headers.cmake M Source/WebCore/Sources.txt M Source/WebCore/WebCore.xcodeproj/project.pbxproj A Source/WebCore/css/CSSFontVariantLigaturesParser.h A Source/WebCore/css/CSSFontVariantNumericParser.h M Source/WebCore/css/CSSProperties.json M Source/WebCore/css/CSSTimingFunctionValue.cpp M Source/WebCore/css/ComputedStyleExtractor.cpp M Source/WebCore/css/parser/CSSAtRuleID.h M Source/WebCore/css/parser/CSSParserFastPaths.cpp M Source/WebCore/css/parser/CSSParserFastPaths.h M Source/WebCore/css/parser/CSSParserIdioms.cpp M Source/WebCore/css/parser/CSSParserImpl.cpp M Source/WebCore/css/parser/CSSPropertyParser.cpp M Source/WebCore/css/parser/CSSPropertyParser.h 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/css/typedom/StylePropertyMap.cpp M Tools/Scripts/webkitpy/style/checkers/jsonchecker.py Log Message: ----------- Data driven CSS property parsing https://bugs.webkit.org/show_bug.cgi?id=248036 rdar://102467693 Reviewed by Darin Adler. Introduce the initial infrastructure for data/grammar driven parsing of CSS properties, starting with parsing of keyword only property values. The long term goal is to add enough information in CSSProperties.json to generate the property parsers and ASTs, but this initial change just puts in place enough to generate the boilerplate for CSSPropertyParser::parseSingleValue() (e.g. we now generate the big switch statement) with most of the parsing still being done by hand written "consume" functions. To make inclusion easier and simplify where to look for the consume functions, the existing consume functions in CSSPropertyParser.cpp were moved to CSSPropertyParserHelpers, where most of the other consume functions already lived. In addition to generating the core switch statement, this change also generates the consume functions for properties that support taking a single keyword CSSValue as their input. This utilized the existing "values" arrays CSSProperties.json, updated as needed to match the current status in WebCore. The same data is also used to generate implementations for the CSSParserFastPaths' `isValidKeywordPropertyAndValue` and `isKeywordPropertyID`. In the future, more properties that allow single keywords can be automatically added based on their grammar, with no additional work needed by the person adding them. To aid the transition to generated parsing, a number of new attributes were added to the "codegen-properties" dictionaries in CSSProperties.json for specifying custom consume functions and optionally passing additional arguments. * Source/WebCore/CMakeLists.txt: * Source/WebCore/DerivedSources-output.xcfilelist: * Source/WebCore/DerivedSources.make: * Source/WebCore/Headers.cmake: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: Added new files. * Source/WebCore/css/CSSFontVariantLigaturesParser.h: Added. * Source/WebCore/css/CSSFontVariantNumericParser.h: Added. Moved here from CSSPropertyParser.cpp so it can be used in multiple files. * Source/WebCore/css/CSSProperties.json: Update properties to indicate where a custom parser is needed and if any additional parameterization of that custom parser is required. Also updates the "values" arrays where they were out of sync with the engine as they are now used if no custom parser is requested. * Source/WebCore/css/CSSTimingFunctionValue.cpp: Add a missing newline. * Source/WebCore/css/ComputedStyleExtractor.cpp: (WebCore::ComputedStyleExtractor::propertyValue): (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): Use the new reference overload of isExposed to avoid a null check. * Source/WebCore/css/parser/CSSAtRuleID.h: Add a missing newline. * Source/WebCore/css/parser/CSSParserFastPaths.h: * Source/WebCore/css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): (WebCore::CSSParserFastPaths::isKeywordPropertyID): Replace implementations with calls to generated versions. (WebCore::CSSParserFastPaths::isPartialKeywordPropertyID): Deleted. No longer needed, as the one caller now can handle this in generated code. * Source/WebCore/css/parser/CSSParserIdioms.cpp: Add a missing newline. * Source/WebCore/css/parser/CSSParserImpl.cpp: (WebCore::CSSParserImpl::CSSParserImpl): Remove an extraneous newline and fix an includes's style. * Source/WebCore/css/parser/CSSPropertyParser.cpp: * Source/WebCore/css/parser/CSSPropertyParser.h: Move lots of things out. Generate parseSingleValue. * Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp: * Source/WebCore/css/parser/CSSPropertyParserHelpers.h: Move all the loose consume functions in from CSSPropertyParser.cpp so they can used in multiple files (including the new generated ones). * Source/WebCore/css/process-css-properties.py: Generates new files CSSPropertyParsing.h/cpp which contain the base switch for parsing single longhand values as well as the keyword only checking and consumer functions. * Source/WebCore/css/typedom/StylePropertyMap.cpp: (WebCore::StylePropertyMap::set): (WebCore::StylePropertyMap::remove): Use the new reference overload of isExposed to avoid a null check. Canonical link: https://commits.webkit.org/256963@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes