| 235 | } |
| 236 | |
| 237 | CssFontWeight CssParser::interpretFontWeight(std::string_view val) { |
| 238 | val = trimCssWhitespace(val); |
| 239 | |
| 240 | // Named values |
| 241 | if (iequalsAscii(val, "bold") || iequalsAscii(val, "bolder")) return CssFontWeight::Bold; |
| 242 | if (iequalsAscii(val, "normal") || iequalsAscii(val, "lighter")) return CssFontWeight::Normal; |
| 243 | |
| 244 | // Numeric values: 100-900 |
| 245 | // CSS spec: 400 = normal, 700 = bold |
| 246 | // We use: 0-400 = normal, 700+ = bold, 500-600 = normal (conservative) |
| 247 | long numericWeight = 0; |
| 248 | if (tryParseNumber(val, numericWeight)) { |
| 249 | return numericWeight >= 700 ? CssFontWeight::Bold : CssFontWeight::Normal; |
| 250 | } |
| 251 | return CssFontWeight::Normal; |
| 252 | } |
| 253 | |
| 254 | CssTextDecoration CssParser::interpretDecoration(std::string_view val) { |
| 255 | // text-decoration can have multiple space-separated values |
nothing calls this directly
no test coverage detected