Commit 545b7f7
committed
feat: improve fallback detection check
This commit updates fallback-related checks and refactors the code used
for checking references to publication resources.
The following checks are introduced or updated:
- `RSC-032` (new): reports foreign resources with no fallback used in
content documents. Replaces `MED-001`, `MED-002`, and `CSS-010`
- `MED-003` now reports when an `img` element child of a `picture` element
is not a core media type.
- `MED-001` is suppressed. It was used to report a video `poster` attribute
did not reference a core image media type. It is now reported as `RSC-032`.
- `MED-002` is suppressed. It was used to report HTML elements referencing
foreign resources without fallback. It is now reported as `RSC-032`.
- `CSS-010` is suppressed. It was used to report references to foreign
stylesheets with no fallback. It is now reported as `RSC-032`.
- `OPF_040` is now reported when the `fallback` attribute of a package
document `item` element does not points to an existing ID. This was
previously implemented as a Schematron check (`RSC-005`) in EPUB 3.x.
- `OPF-013` is now a warning. It is reported when a MIME type declared
inline in content (for instance with an HTML `type` attribute) does
not match the MIME type declared in the package document.
The code is refactored as follows:
- the reference/resource registry functionality of the `XRefChecker`
class is extracted to new top-level classes in the (new) package
`org.w3c.epubcheck.references`.
- `Resource` represents a publication resource
- `ResourceRegistry` is a registry of `Resource` instances
- `Reference` represents a reference (URL) used anywhere in content
- `ReferenceRegistry` is a registry of `Reference` instances
- `XRefChecker` is renamed to `ResourceReferencesChecker`.
- `ValidationContext` contains optional references to `ResourceRegistry`
and `ReferenceRegistry`.
- fallback chain resolution is now done in a new `FallbackChainResolver`
class, when building `OPFItem` instances from the builders created
when parsing the package document.
- `XMLHandler` has convenience methods used to register references
to the `ReferenceRegistry`.
Fix #1304, Fix #1298.1 parent fdf9b22 commit 545b7f7
File tree
351 files changed
+3065
-2960
lines changed- src
- main
- java
- com/adobe/epubcheck
- api
- css
- dict
- dtbook
- messages
- ncx
- ocf
- opf
- ops
- overlay
- tool
- xml/handlers
- org/w3c/epubcheck
- constants
- core
- references
- url
- util/url
- resources/com/adobe/epubcheck
- messages
- schema/30
- test
- java/org/w3c/epubcheck
- test
- url
- resources
- epub2
- epub3
- 03-resources
- files
- content-xhtml-xpgt-implicit-fallback-valid/EPUB
- content-xhtml-xpgt-manifest-fallback-valid/EPUB
- content-xhtml-xpgt-no-fallback-valid/EPUB
- fallback-chain-circular-error
- EPUB
- META-INF
- fallback-chain-n-to-1-valid
- EPUB
- META-INF
- fallback-chain-waterfall-valid
- EPUB
- META-INF
- foreign-exempt-font-valid
- EPUB
- META-INF
- foreign-exempt-unused-valid
- EPUB
- META-INF
- foreign-exempt-xhtml-link-valid
- EPUB
- META-INF
- foreign-exempt-xhtml-link-xpgt-manifest-fallback-valid
- EPUB
- META-INF
- foreign-exempt-xhtml-link-xpgt-no-fallback-valid
- EPUB
- META-INF
- foreign-exempt-xhtml-track-valid
- EPUB
- META-INF
- foreign-exempt-xhtml-video-in-img-valid
- EPUB
- META-INF
- foreign-exempt-xhtml-video-valid
- EPUB
- META-INF
- foreign-xhtml-audio-in-video-no-fallback-error
- EPUB
- META-INF
- foreign-xhtml-audio-manifest-fallback-valid
- EPUB
- META-INF
- foreign-xhtml-audio-no-fallback-error
- EPUB
- META-INF
- foreign-xhtml-audio-no-fallback-with-flow-content-error
- EPUB
- META-INF
- foreign-xhtml-audio-source-fallback-valid
- EPUB
- META-INF
- foreign-xhtml-audio-source-no-fallback-error
- EPUB
- META-INF
- foreign-xhtml-audio-source-remote-fallback-valid
- EPUB
- META-INF
- foreign-xhtml-embed-fallback-valid
- EPUB
- META-INF
- foreign-xhtml-embed-no-fallback-error
- EPUB
- META-INF
- foreign-xhtml-img-manifest-fallback-valid
- EPUB
- META-INF
- foreign-xhtml-img-src-no-manifest-fallback-error
- EPUB
- META-INF
- foreign-xhtml-img-srcset-manifest-fallback-valid
- EPUB
- META-INF
- foreign-xhtml-input-image-no-fallback-error
- EPUB
- META-INF
- foreign-xhtml-math-altimg-no-fallback-error
- EPUB
- META-INF
- foreign-xhtml-object-intrinsic-fallback-valid
- EPUB
- META-INF
- foreign-xhtml-object-no-fallback-error
- EPUB
- META-INF
- foreign-xhtml-picture-img-src-error
- EPUB
- META-INF
- foreign-xhtml-picture-img-srcset-error
- EPUB
- META-INF
- foreign-xhtml-picture-source-no-type-error
- EPUB
- META-INF
- foreign-xhtml-picture-source-with-type-valid
- EPUB
- META-INF
- foreign-xhtml-script-datablock-valid
- EPUB
- META-INF
- foreign-xhtml-video-poster-fallback-valid
- EPUB
- META-INF
- foreign-xhtml-video-poster-no-fallback-error
- EPUB
- META-INF
- type-mismatch-in-audio-warning
- EPUB
- META-INF
- type-mismatch-in-embed-warning
- EPUB
- META-INF
- type-mismatch-in-object-warning
- EPUB
- META-INF
- type-mismatch-in-picture-source-warning
- EPUB
- META-INF
- 04-ocf
- files
- url-xhtml-cite-missing-resource-error
- EPUB
- META-INF
- url-xhtml-iframe-missing-resource-error
- EPUB
- META-INF
- url-xhtml-track-missing-resource-error
- EPUB
- META-INF
- 05-package-document
- files/package-manifest-fallback-non-resolving-error/EPUB
- 06-content-document
- files
- content-xhtml-img-video-valid
- EPUB
- META-INF
- content-xhtml-link-fragment-after-object-valid/EPUB
- type-mismatch-in-audio-warning
- EPUB
- META-INF
- type-mismatch-in-object-warning
- EPUB
- META-INF
- type-mismatch-in-picture-source-warning
- EPUB
- META-INF
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
351 files changed
+3065
-2960
lines changedThis file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
45 | | - | |
46 | 44 | | |
47 | 45 | | |
48 | 46 | | |
| |||
69 | 67 | | |
70 | 68 | | |
71 | 69 | | |
72 | | - | |
73 | 70 | | |
74 | 71 | | |
75 | 72 | | |
| |||
159 | 156 | | |
160 | 157 | | |
161 | 158 | | |
162 | | - | |
| 159 | + | |
163 | 160 | | |
164 | 161 | | |
165 | 162 | | |
| |||
322 | 319 | | |
323 | 320 | | |
324 | 321 | | |
325 | | - | |
| 322 | + | |
326 | 323 | | |
327 | 324 | | |
328 | | - | |
| 325 | + | |
329 | 326 | | |
330 | 327 | | |
331 | 328 | | |
| |||
367 | 364 | | |
368 | 365 | | |
369 | 366 | | |
370 | | - | |
| 367 | + | |
371 | 368 | | |
372 | 369 | | |
373 | 370 | | |
374 | 371 | | |
375 | | - | |
| 372 | + | |
| 373 | + | |
376 | 374 | | |
377 | 375 | | |
378 | 376 | | |
| |||
386 | 384 | | |
387 | 385 | | |
388 | 386 | | |
389 | | - | |
| 387 | + | |
390 | 388 | | |
391 | | - | |
| 389 | + | |
392 | 390 | | |
393 | 391 | | |
394 | 392 | | |
| |||
Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | | - | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 43 | + | |
46 | 44 | | |
47 | 45 | | |
48 | 46 | | |
Lines changed: 13 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
| |||
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
54 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
58 | | - | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| |||
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
71 | | - | |
72 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
| |||
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
89 | | - | |
| 93 | + | |
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
94 | | - | |
| 98 | + | |
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
148 | | - | |
| 147 | + | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| 351 | + | |
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
| 345 | + | |
345 | 346 | | |
346 | 347 | | |
347 | 348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | | - | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
| 82 | + | |
82 | 83 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
79 | | - | |
| 78 | + | |
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
| |||
0 commit comments