MCPcopy Create free account
hub / github.com/dillo-browser/dillo / parseDeclaration

Method parseDeclaration

src/cssparser.cc:1251–1408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1249}
1250
1251void CssParser::parseDeclaration(CssPropertyList *props,
1252 CssPropertyList *importantProps)
1253{
1254 CssPropertyInfo pi = {NULL, {CSS_TYPE_UNUSED}, NULL}, *pip;
1255 CssShorthandInfo *sip;
1256 CssValueType type = CSS_TYPE_UNUSED;
1257
1258 CssPropertyName prop;
1259 CssPropertyValue val, dir_vals[4];
1260 CssValueType dir_types[4];
1261 bool found, weight;
1262 int sh_index, i, j, n;
1263 int dir_set[4][4] = {
1264 /* 1 value */ {0, 0, 0, 0},
1265 /* 2 values */ {0, 0, 1, 1},
1266 /* 3 values */ {0, 2, 1, 1},
1267 /* 4 values */ {0, 2, 3, 1}
1268 };
1269
1270 if (ttype == CSS_TK_SYMBOL) {
1271 pi.symbol = tval;
1272 pip =
1273 (CssPropertyInfo *) bsearch(&pi, Css_property_info,
1274 CSS_NUM_PARSED_PROPERTIES,
1275 sizeof(CssPropertyInfo),
1276 Css_property_info_cmp);
1277 if (pip) {
1278 prop = (CssPropertyName) (pip - Css_property_info);
1279 nextToken();
1280 if (ttype == CSS_TK_CHAR && tval[0] == ':') {
1281 nextToken();
1282 if (tokenMatchesProperty (prop, &type) &&
1283 parseValue(prop, type, &val)) {
1284 weight = parseWeight();
1285 if (weight && importantProps)
1286 importantProps->set(prop, type, val);
1287 else
1288 props->set(prop, type, val);
1289 }
1290 }
1291 } else {
1292 /* Try shorthands. */
1293 sip =
1294 (CssShorthandInfo *) bsearch(&pi, Css_shorthand_info,
1295 CSS_SHORTHAND_NUM,
1296 sizeof(CssShorthandInfo),
1297 Css_shorthand_info_cmp);
1298 if (sip) {
1299 sh_index = sip - Css_shorthand_info;
1300 nextToken();
1301 if (ttype == CSS_TK_CHAR && tval[0] == ':') {
1302 nextToken();
1303
1304 switch (Css_shorthand_info[sh_index].type) {
1305
1306 case CssShorthandInfo::CSS_SHORTHAND_FONT:
1307 /* \todo Implement details. */
1308 case CssShorthandInfo::CSS_SHORTHAND_MULTIPLE:

Callers 1

parseDeclarationBlockMethod · 0.80

Calls 1

setMethod · 0.45

Tested by

no test coverage detected