Bug 248036

Summary: Data driven CSS property parsing
Product: WebKit Reporter: Sam Weinig <sam>
Component: CSSAssignee: Sam Weinig <sam>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, commit-queue, Hironori.Fujii, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 248164    
Bug Blocks:    
Attachments:
Description Flags
CSSPropertyParsing.h
none
CSSPropertyParsing.cpp none

Description Sam Weinig 2022-11-17 08:24:45 PST
Introduce the initial infrastructure for data/grammar driven parsing of CSS properties, starting with parsing of keyword only property values.
Comment 1 Radar WebKit Bug Importer 2022-11-17 08:24:59 PST
<rdar://problem/102467693>
Comment 2 Sam Weinig 2022-11-17 08:38:56 PST
Pull request: https://github.com/WebKit/WebKit/pull/6592
Comment 3 Sam Weinig 2022-11-18 15:28:06 PST
Created attachment 463614 [details]
CSSPropertyParsing.h
Comment 4 Sam Weinig 2022-11-18 15:28:55 PST
Created attachment 463615 [details]
CSSPropertyParsing.cpp
Comment 5 EWS 2022-11-18 19:00:06 PST
Committed 256867@main (33e16a60b9c5): <https://commits.webkit.org/256867@main>

Reviewed commits have been landed. Closing PR #6592 and removing active labels.
Comment 6 Chris Dumez 2022-11-20 15:47:12 PST
There are a few assertion hits on the bots that look like they could be related to this change:
SHOULD NEVER BE REACHED
/Volumes/Data/worker/Apple-Ventura-Debug-Build/build/WebKitBuild/Debug/DerivedSources/WebCore/CSSPropertyParsing.cpp(2408) : static RefPtr<WebCore::CSSValue> WebCore::CSSPropertyParsing::parse(WebCore::CSSParserTokenRange &, WebCore::CSSPropertyID, WebCore::CSSPropertyID, const WebCore::CSSParserContext &)
1   0x14244eba4 WTFCrash
2   0x105af2ee0 WebCore::JSBeforeUnloadEvent::createPrototype(JSC::VM&, WebCore::JSDOMGlobalObject&)
3   0x1059bcc34 WebCore::CSSPropertyParsing::parse(WebCore::CSSParserTokenRange&, WebCore::CSSPropertyID, WebCore::CSSPropertyID, WebCore::CSSParserContext const&)
4   0x108aa9074 WebCore::CSSPropertyParser::parseSingleValue(WebCore::CSSPropertyID, WebCore::CSSPropertyID)
5   0x108aa8c44 WebCore::CSSPropertyParser::parseValueStart(WebCore::CSSPropertyID, bool)
6   0x108aa82a8 WebCore::CSSPropertyParser::parseValue(WebCore::CSSPropertyID, bool, WebCore::CSSParserTokenRange const&, WebCore::CSSParserContext const&, WTF::Vector<WebCore::CSSProperty, 256ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&, WebCore::StyleRuleType)
7   0x108a82010 WebCore::CSSParserImpl::consumeDeclarationValue(WebCore::CSSParserTokenRange, WebCore::CSSPropertyID, bool, WebCore::StyleRuleType)
8   0x108a84664 WebCore::CSSParserImpl::consumeDeclaration(WebCore::CSSParserTokenRange, WebCore::StyleRuleType)
9   0x108a82460 WebCore::CSSParserImpl::consumeDeclarationList(WebCore::CSSParserTokenRange, WebCore::StyleRuleType)
10  0x108a7f0c0 WebCore::CSSParserImpl::parseDeclarationList(WebCore::MutableStyleProperties*, WTF::String const&, WebCore::CSSParserContext const&)
11  0x108a7eff0 WebCore::CSSParser::parseDeclaration(WebCore::MutableStyleProperties&, WTF::String const&)
12  0x108a2cfa8 WebCore::MutableStyleProperties::parseDeclaration(WTF::String const&, WebCore::CSSParserContext)
13  0x1089fdacc WebCore::PropertySetCSSStyleDeclaration::setCssText(WTF::String const&)
14  0x105ca56e8 WebCore::setJSCSSStyleDeclaration_cssTextSetter(JSC::JSGlobalObject&, WebCore::JSCSSStyleDeclaration&, JSC::JSValue)::'lambda'()::operator()() const
15  0x105ca5644 void WebCore::invokeFunctorPropagatingExceptionIfNecessary<WebCore::setJSCSSStyleDeclaration_cssTextSetter(JSC::JSGlobalObject&, WebCore::JSCSSStyleDeclaration&, JSC::JSValue)::'lambda'()>(JSC::JSGlobalObject&, JSC::ThrowScope&, WebCore::setJSCSSStyleDeclaration_cssTextSetter(JSC::JSGlobalObject&, WebCore::JSCSSStyleDeclaration&, JSC::JSValue)::'lambda'()&&)
16  0x105ca55d0 WebCore::setJSCSSStyleDeclaration_cssTextSetter(JSC::JSGlobalObject&, WebCore::JSCSSStyleDeclaration&, JSC::JSValue)
17  0x105bf842c bool WebCore::IDLAttribute<WebCore::JSCSSStyleDeclaration>::set<&(WebCore::setJSCSSStyleDeclaration_cssTextSetter(JSC::JSGlobalObject&, WebCore::JSCSSStyleDeclaration&, JSC::JSValue)), (WebCore::CastedThisErrorBehavior)0>(JSC::JSGlobalObject&, long long, long long, JSC::PropertyName)
18  0x105bf8308 WebCore::setJSCSSStyleDeclaration_cssText(JSC::JSGlobalObject*, long long, long long, JSC::PropertyName)
19  0x144282bb0 WTF::FunctionPtr<(WTF::PtrTag)30177, bool (JSC::JSGlobalObject*, long long, long long, JSC::PropertyName), (WTF::FunctionAttributes)1>::operator()(JSC::JSGlobalObject*, long long, long long, JSC::PropertyName) const
20  0x1442823bc JSC::JSObject::putInlineSlow(JSC::JSGlobalObject*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&)
21  0x143765f0c JSC::JSObject::putInlineForJSObject(JSC::JSCell*, JSC::JSGlobalObject*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&)
22  0x1443b69d8 JSC::JSCell::putInline(JSC::JSGlobalObject*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&)
23  0x143d77f50 JSC::JSValue::putInline(JSC::JSGlobalObject*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&)
24  0x143d77310 llint_slow_path_put_by_id
Comment 7 Fujii Hironori 2022-11-20 16:15:03 PST
Buildbot: builder Apple-Monterey-Debug-WK2-Tests build 6481
https://build.webkit.org/#/builders/369/builds/6481

  fast/css/local_font_invalid.html [ Crash ]
  fast/css/url-format-non-string.html [ Crash ]
  fast/text/font-display/parse.html [ Crash ]
  imported/w3c/web-platform-tests/css/cssom/property-accessors.html [ Crash ]
Comment 8 WebKit Commit Bot 2022-11-20 23:13:09 PST
Re-opened since this is blocked by bug 248164
Comment 9 Sam Weinig 2022-11-22 18:50:00 PST
Pull request: https://github.com/WebKit/WebKit/pull/6751
Comment 10 EWS 2022-11-22 20:29:13 PST
Committed 256963@main (ee33925018a1): <https://commits.webkit.org/256963@main>

Reviewed commits have been landed. Closing PR #6751 and removing active labels.