Commit ef82a01
committed
Refactoring font-face src parsing
https://bugs.webkit.org/show_bug.cgi?id=250471
rdar://104135235
Reviewed by Myles C. Maxfield.
Refactoring font-face src parsing such that we parse each component
separated by commas, individually.
If all components can't be parsed, then the src descriptor is
invalidated. This was already done before, but now each component parser,
such as consumeFontFaceSrcURI() and consumeFontFaceSrcLocal() will
receive a subrange, and the whole subrange has to be parsed for the
component to be valid. This will fix test failures we had when parsing
format() in a URI component.
The optional format() token can optionally follow a url() token. Before,
if garbage was following the url() token, we would ignore it and still
validate the component with an empty format. However, we would not
consume the range being parsed, and if the next token was not a Comma,
we would invalidate the whole descriptor.
* LayoutTests/fast/css/font-face-src-parsing-expected.txt:
Update on which src descriptors are valid.
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-list-expected.txt:
Missing failures should pass now.
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-tech-expected.txt:
We don't support tech() yet but we need to rebaseline here. Increment
tests will pass now.
* Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp:
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcURI):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcLocal):
Component is invalidated if the whole range is not consumed.
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrc):
* LayoutTests/fast/css/font-face-src-parsing-expected.txt:
* LayoutTests/fast/css/font-face-src-parsing.html:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-format-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-list-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-fonts/parsing/font-face-src-tech-expected.txt:
* Source/WebCore/css/parser/CSSPropertyParserWorkerSafe.cpp:
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcURI):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrcLocal):
(WebCore::CSSPropertyParserHelpersWorkerSafe::consumeFontFaceSrc):
Canonical link: https://commits.webkit.org/258870@main1 parent 4ecc989 commit ef82a01
File tree
6 files changed
+40
-29
lines changed- LayoutTests
- fast/css
- imported/w3c/web-platform-tests/css/css-fonts/parsing
- Source/WebCore/css/parser
6 files changed
+40
-29
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | | - | |
26 | | - | |
27 | 27 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
Lines changed: 21 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
226 | 228 | | |
227 | 229 | | |
228 | 230 | | |
| |||
232 | 234 | | |
233 | 235 | | |
234 | 236 | | |
235 | | - | |
| 237 | + | |
236 | 238 | | |
237 | 239 | | |
238 | 240 | | |
239 | 241 | | |
240 | 242 | | |
241 | | - | |
| 243 | + | |
242 | 244 | | |
243 | 245 | | |
244 | 246 | | |
| |||
249 | 251 | | |
250 | 252 | | |
251 | 253 | | |
252 | | - | |
| 254 | + | |
253 | 255 | | |
254 | | - | |
| 256 | + | |
| 257 | + | |
255 | 258 | | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
260 | 269 | | |
261 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
262 | 274 | | |
263 | 275 | | |
264 | 276 | | |
| |||
0 commit comments