diff --git a/src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java b/src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java index 7b6e56ed7..e636de7b7 100644 --- a/src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java +++ b/src/main/java/com/adobe/epubcheck/messages/DefaultSeverities.java @@ -76,7 +76,7 @@ private void initialize() severities.put(MessageId.CSS_007, Severity.INFO); severities.put(MessageId.CSS_008, Severity.ERROR); severities.put(MessageId.CSS_009, Severity.USAGE); - severities.put(MessageId.CSS_010, Severity.ERROR); + severities.put(MessageId.CSS_010, Severity.SUPPRESSED); severities.put(MessageId.CSS_011, Severity.SUPPRESSED); severities.put(MessageId.CSS_012, Severity.USAGE); severities.put(MessageId.CSS_013, Severity.USAGE); diff --git a/src/main/java/com/adobe/epubcheck/ops/OPSHandler.java b/src/main/java/com/adobe/epubcheck/ops/OPSHandler.java index d57d11d11..e52c07098 100755 --- a/src/main/java/com/adobe/epubcheck/ops/OPSHandler.java +++ b/src/main/java/com/adobe/epubcheck/ops/OPSHandler.java @@ -86,8 +86,6 @@ int getColumnNumber() protected boolean hasTh = false; protected boolean hasThead = false; protected boolean hasCaption = false; - protected Optional nonStandardStylesheetLink = Optional.absent(); - protected boolean hasCss = false; protected boolean epubTypeInUse = false; protected boolean checkedUnsupportedXMLVersion = false; protected StringBuilder textNode; @@ -147,36 +145,6 @@ protected void checkLink(XMLElement e, String attrNS, String attr) href = PathUtil.resolveRelativeReference(base, href); xrefChecker.get().registerReference(path, parser.getLineNumber(), parser.getColumnNumber(), href, XRefChecker.Type.STYLESHEET); - - // Check the mimetype to record possible non-standard stylesheets - // with no fallback - String mimetype = xrefChecker.get().getMimeType(href); - if (mimetype != null) - { - if (OPFChecker.isBlessedStyleType(mimetype) - || OPFChecker.isDeprecatedBlessedStyleType(mimetype)) - { - hasCss = true; - } - else - { - nonStandardStylesheetLink = Optional.of( - EPUBLocation.create(path, parser.getLineNumber(), parser.getColumnNumber(), href)); - } - } - } - } - - protected void checkStylesheetFallback() - { - // stylesheet is considered as having "built-in" fallback if - // at least one is found with a blessed CMT (i.e. text/css). - // Implem note: xrefChecker is necessarily present if - // nonStandardStylesheetLink is present. - if (nonStandardStylesheetLink.isPresent() && !hasCss && !xrefChecker.get() - .hasValidFallback(nonStandardStylesheetLink.get().getContext().get()).or(false)) - { - report.message(MessageId.CSS_010, nonStandardStylesheetLink.get()); } } @@ -522,10 +490,6 @@ public void endElement() } textNode = null; } - else if ("head".equals(name)) - { - checkStylesheetFallback(); - } else if ("table".equals(name)) { if (tableDepth > 0) diff --git a/src/test/resources/epub3/content-publication.feature b/src/test/resources/epub3/content-publication.feature index 6432e2d82..2205f3175 100644 --- a/src/test/resources/epub3/content-publication.feature +++ b/src/test/resources/epub3/content-publication.feature @@ -125,7 +125,10 @@ Feature: EPUB 3 ▸ Content Documents ▸ Full Publication Checks Then error RSC-014 is reported Then no other errors or warnings are reported - + Scenario: Verify a linked resource without a fallback + When checking EPUB 'content-xhtml-link-no-fallback-valid' + And no errors or warnings are reported + ##### iframes Scenario: Verify that an `iframe` can reference another XHTML document @@ -243,8 +246,7 @@ Feature: EPUB 3 ▸ Content Documents ▸ Full Publication Checks Scenario: Report an xpgt style sheet without a fallback See issues #271, #241 - When checking EPUB 'content-xhtml-xpgt-no-fallback-error' - Then error CSS-010 is reported + When checking EPUB 'content-xhtml-link-no-fallback-valid' And no other errors or warnings are reported diff --git a/src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/EPUB/content_001.xhtml b/src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/EPUB/content_001.xhtml similarity index 78% rename from src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/EPUB/content_001.xhtml rename to src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/EPUB/content_001.xhtml index bf2bf7f4d..03936f8d6 100644 --- a/src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/EPUB/content_001.xhtml +++ b/src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/EPUB/content_001.xhtml @@ -3,7 +3,7 @@ Minimal EPUB - +

Loomings

diff --git a/src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-error/EPUB/nav.xhtml b/src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/EPUB/nav.xhtml similarity index 100% rename from src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-error/EPUB/nav.xhtml rename to src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/EPUB/nav.xhtml diff --git a/src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/EPUB/package.opf b/src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/EPUB/package.opf similarity index 91% rename from src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/EPUB/package.opf rename to src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/EPUB/package.opf index 2b5705126..2b3bb300f 100644 --- a/src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/EPUB/package.opf +++ b/src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/EPUB/package.opf @@ -9,7 +9,7 @@ - + diff --git a/src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/EPUB/test.txt b/src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/EPUB/test.txt new file mode 100644 index 000000000..30d74d258 --- /dev/null +++ b/src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/EPUB/test.txt @@ -0,0 +1 @@ +test \ No newline at end of file diff --git a/src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/META-INF/container.xml b/src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/META-INF/container.xml similarity index 50% rename from src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/META-INF/container.xml rename to src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/META-INF/container.xml index 2ca12eff7..318782179 100644 --- a/src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/META-INF/container.xml +++ b/src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/META-INF/container.xml @@ -1,5 +1,5 @@ - - + + diff --git a/src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-error/mimetype b/src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/mimetype similarity index 100% rename from src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-error/mimetype rename to src/test/resources/epub3/files/epub/content-xhtml-link-no-fallback-valid/mimetype diff --git a/src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-error/EPUB/content_001.xhtml b/src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-valid/EPUB/content_001.xhtml similarity index 100% rename from src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-error/EPUB/content_001.xhtml rename to src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-valid/EPUB/content_001.xhtml diff --git a/src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/EPUB/nav.xhtml b/src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-valid/EPUB/nav.xhtml similarity index 100% rename from src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/EPUB/nav.xhtml rename to src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-valid/EPUB/nav.xhtml diff --git a/src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-error/EPUB/package.opf b/src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-valid/EPUB/package.opf similarity index 100% rename from src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-error/EPUB/package.opf rename to src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-valid/EPUB/package.opf diff --git a/src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-error/EPUB/page-template.xpgt b/src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-valid/EPUB/page-template.xpgt similarity index 100% rename from src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-error/EPUB/page-template.xpgt rename to src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-valid/EPUB/page-template.xpgt diff --git a/src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-error/META-INF/container.xml b/src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-valid/META-INF/container.xml similarity index 100% rename from src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-error/META-INF/container.xml rename to src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-valid/META-INF/container.xml diff --git a/src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/mimetype b/src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-valid/mimetype similarity index 100% rename from src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/mimetype rename to src/test/resources/epub3/files/epub/content-xhtml-xpgt-no-fallback-valid/mimetype diff --git a/src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/EPUB/style.css b/src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/EPUB/style.css deleted file mode 100644 index 0823b7849..000000000 --- a/src/test/resources/epub3/files/epub/package-manifest-css-wrong-media-type-error/EPUB/style.css +++ /dev/null @@ -1,6 +0,0 @@ -body { - margin-left : 6em; - margin-right : 16em; - color:black; - font-family: arial, helvetica, sans-serif; -} \ No newline at end of file diff --git a/src/test/resources/epub3/package-publication.feature b/src/test/resources/epub3/package-publication.feature index 1a69146ff..3f557f760 100644 --- a/src/test/resources/epub3/package-publication.feature +++ b/src/test/resources/epub3/package-publication.feature @@ -78,11 +78,6 @@ Feature: EPUB 3 ▸ Packages ▸ Full Publication Checks Then error RSC-001 is reported 3 times And no other errors or warnings are reported - Scenario: Report a CSS file declared with an invalid media type and no fallback - When checking EPUB 'package-manifest-css-wrong-media-type-error' - Then error CSS-010 is reported - And no errors or warnings are reported - #### 3.4.4.3 Manifest Fallbacks