WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
222231
Be more deliberate with what is required for CSS parsing
https://bugs.webkit.org/show_bug.cgi?id=222231
Summary
Be more deliberate with what is required for CSS parsing
Sam Weinig
Reported
2021-02-20 12:06:37 PST
Currently, a lot of CSS related parsing is pretty adhoc with regard to what context is required to parse CSS (and CSS-ish), with some parsing functions requiring CSSParserContexts, some not, and some passing in CSSParserContexts that don't contain the correct information (e.g. any that doesn't construct their CSSParserContext with a document are not getting correct Settings values). With more CSS parsing being needed in workers for OffscreenCanvas and various worklets, I think we should take a moment to clean this up and be as deliberate and clear as we can with the interfaces we expose for this. Specifically, I think we should require a fully initialized CSSParserContext for all parsing, and remove the default values that currently allow some parsing to get away with what is essentially a dummy one. Since a fully initialized CSSParserContext currently requires a Document, the first step might be to enumerate the cases where CSS parsing is needed and a Document and Page (needed for useSystemAppearance(), though perhaps we should move this somewhere else) is not available and figure out the appropriate ways to get the information in those cases. Enumerating these right now is kinda tricky, due to default initialization of CSSParserContext to a dummy one in many cases, so I think a first pass here would be remove the existing constructor not taking a document, and add new ones that require passing in a new enum that we can create that that will have values for all the reasons. e.g. enum class CSSParsingReason { Inspector, UserAgentStyleSheet, StyleRuleWithoutAPointerToADocument, etc... }; And also switch CSSParser away from using static functions to require bottlenecking through the
Attachments
Add attachment
proposed patch, testcase, etc.
Antti Koivisto
Comment 1
2021-02-21 00:23:38 PST
Good idea
Radar WebKit Bug Importer
Comment 2
2021-02-27 12:07:12 PST
<
rdar://problem/74828679
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug