Changes between Version 2 and Version 3 of ImplementingCSSProperty
- Timestamp:
- Aug 27, 2015, 8:35:58 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ImplementingCSSProperty
v2 v3 7 7 Next up, we have to parse the syntax for the new property. This is the syntax for the property which is described in the CSS spec. 8 8 9 In WebKit, we parse CSS this in two pieces. The first step involves a Bison parser which doesn’t know anything about the particular syntax of each individual property. Instead, it simply understands the syntax of CSS itself (like what the {} characters mean, the difference between strings and idents, what an @-rule is, etc.). The language this Bison parser accepts is defined in CSSGrammar.y.in.9 In WebKit, we parse CSS in two steps. The first step involves a Bison parser which doesn’t know anything about the particular syntax of each individual property. Instead, it simply understands the syntax of CSS itself (like what the {} characters mean, the difference between strings and idents, what an @-rule is, etc.). The language this Bison parser accepts is defined in CSSGrammar.y.in. 10 10 11 11 Bison parsers work by issuing callbacks every time they apply a rule in their grammar. We implement these callbacks in CSSParser.cpp. Whenever the Bison parser invokes the grammar rule which represents a new CSS value, the callback constructs a CSSParserValue (This is actually done inside the Bison grammar directly). When the parser invokes the grammar rule which represents a collection of values for a particular property, the callback constructs a CSSParserValueList. These data structures are retained by CSSParser.