Repository navigation
Commit 3d05e51
authored
[vector_graphics_compiler] Ignore unrecognized font-weight values (flutter#12199)
Fixes flutter#186933
`SvgParser.parseFontWeight` throws on any value outside the recognized CSS
keywords and numeric weights. That makes the whole SVG fail to compile for
non-standard values such as `font-weight="regular"`.
This change treats an unrecognized value as an invalid declaration: it emits a
warning and returns no parsed value, so normal style inheritance still applies.
An unstyled root therefore keeps the initial normal weight, while an invalid
child declaration no longer overrides a bold parent. Strict
`warningsAsErrors` builds continue to throw.
Tests cover an unrecognized root value, inheritance from a bold parent, and the
warnings-as-errors path. `flutter analyze` and the full 333-test
`vector_graphics_compiler` suite pass locally.
## Pre-Review Checklist
[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.1 parent cd39027 commit 3d05e51
4 files changed
Lines changed: 58 additions & 2 deletions
File tree
- packages/vector_graphics_compiler
- lib/src/svg
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
1 | 9 | | |
2 | 10 | | |
3 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1295 | 1295 | | |
1296 | 1296 | | |
1297 | 1297 | | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
1298 | 1302 | | |
1299 | 1303 | | |
1300 | 1304 | | |
| |||
1325 | 1329 | | |
1326 | 1330 | | |
1327 | 1331 | | |
1328 | | - | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
1329 | 1338 | | |
1330 | 1339 | | |
1331 | 1340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
417 | 456 | | |
418 | 457 | | |
419 | 458 | | |
| |||
0 commit comments