diff --git a/src/main/java/com/adobe/epubcheck/css/CSSHandler.java b/src/main/java/com/adobe/epubcheck/css/CSSHandler.java
index 0899ba9e9..fec6c3f16 100644
--- a/src/main/java/com/adobe/epubcheck/css/CSSHandler.java
+++ b/src/main/java/com/adobe/epubcheck/css/CSSHandler.java
@@ -159,7 +159,7 @@ else if (uriOrString.getType() == CssConstruct.Type.STRING)
}
if (uri != null)
{
- resolveAndRegister(uri, line, col, atRule.toCssString(), Reference.Type.GENERIC);
+ resolveAndRegister(uri, line, col, atRule.toCssString(), Reference.Type.STYLESHEET);
}
}
}
@@ -390,7 +390,10 @@ private void resolveAndRegister(String uriString, int line, int col, String cssC
if (url != null && context.referenceRegistry.isPresent())
{
context.referenceRegistry.get().registerReference(url, type, getCorrectedEPUBLocation(line, col, cssContext));
- if (context.isRemote(url))
+ // register that a remote resource was found
+ // no need to register a remote stylesheet, as these are disallowed
+ // and will be reported elsewhere
+ if (type != Reference.Type.STYLESHEET && context.isRemote(url))
{
detectedProperties.add(ITEM_PROPERTIES.REMOTE_RESOURCES);
}
diff --git a/src/main/java/com/adobe/epubcheck/ops/OPSHandler.java b/src/main/java/com/adobe/epubcheck/ops/OPSHandler.java
index dfcf41c5b..1867e05a1 100755
--- a/src/main/java/com/adobe/epubcheck/ops/OPSHandler.java
+++ b/src/main/java/com/adobe/epubcheck/ops/OPSHandler.java
@@ -25,7 +25,10 @@
import java.util.Locale;
import java.util.Stack;
+import org.w3c.epubcheck.constants.MIMEType;
import org.w3c.epubcheck.core.references.Reference;
+import org.w3c.epubcheck.core.references.Reference.Type;
+import org.xml.sax.SAXException;
import com.adobe.epubcheck.api.EPUBLocation;
import com.adobe.epubcheck.css.CSSChecker;
@@ -40,6 +43,8 @@
import com.adobe.epubcheck.xml.model.XMLElement;
import io.mola.galimatias.URL;
+import net.sf.saxon.trans.XPathException;
+import net.sf.saxon.tree.util.ProcInstParser;
public class OPSHandler extends XMLHandler
{
@@ -190,6 +195,10 @@ public void startElement()
Reference.Type resourceType = Reference.Type.GENERIC;
if (ns != null)
{
+ if (name.equals("style"))
+ {
+ textNode = new StringBuilder();
+ }
if (ns.equals("http://www.w3.org/2000/svg"))
{
if (name.equals("lineargradient") || name.equals("radialgradient")
@@ -246,10 +255,6 @@ else if (name.equals("link"))
{
checkLink();
}
- else if (name.equals("style"))
- {
- textNode = new StringBuilder();
- }
else if (name.equals("iframe"))
{
checkIFrame();
@@ -341,20 +346,21 @@ public void endElement()
EPUBLocation currentLocation = elementLocationStack.pop();
- if (EpubConstants.HtmlNamespaceUri.equals(ns))
+ if ("style".equals(name))
{
-
- if ("style".equals(name))
+ String style = textNode.toString();
+ if (style.length() > 0)
{
- String style = textNode.toString();
- if (style.length() > 0)
- {
- this.hasCSS = true;
- new CSSChecker(context, style, currentLocation.getLine(), false).check();
- }
- textNode = null;
+ this.hasCSS = true;
+ new CSSChecker(context, style, currentLocation.getLine(), false).check();
}
- else if ("table".equals(name))
+ textNode = null;
+ }
+
+ if (EpubConstants.HtmlNamespaceUri.equals(ns))
+ {
+
+ if ("table".equals(name))
{
if (tableDepth > 0)
{
@@ -392,4 +398,39 @@ public void characters(char[] chars, int start, int length)
}
}
+ @Override
+ public void processingInstruction(String target, String data)
+ throws SAXException
+ {
+ super.processingInstruction(target, data);
+
+ // for SVG documents, parse 'xml-stylesheet' processing instructions
+ if (MIMEType.SVG.is(context.mimeType) && "xml-stylesheet".equals(target))
+ {
+ checkXMLStylesheetPI(data);
+ }
+ }
+
+ protected void checkXMLStylesheetPI(String data)
+ {
+ assert data != null;
+ try
+ {
+ String type = ProcInstParser.getPseudoAttribute(data, "type");
+ if (type == null || MIMEType.CSS.is(type))
+ {
+ String href = ProcInstParser.getPseudoAttribute(data, "href");
+ URL url = checkURL(href);
+ if (url != null)
+ {
+ hasCSS = true;
+ registerReference(url, Type.STYLESHEET);
+ }
+ }
+ } catch (XPathException e1)
+ {
+ // ignore invalid declaration, must have been reported earlier
+ }
+ }
+
}
diff --git a/src/test/resources/epub3/03-resources/files/file-url-in-svg-content-error.svg b/src/test/resources/epub3/03-resources/files/file-url-in-svg-content-error.svg
new file mode 100644
index 000000000..f16c08964
--- /dev/null
+++ b/src/test/resources/epub3/03-resources/files/file-url-in-svg-content-error.svg
@@ -0,0 +1,10 @@
+
+
+
diff --git a/src/test/resources/epub3/03-resources/files/file-url-in-xhtml-content-error.xhtml b/src/test/resources/epub3/03-resources/files/file-url-in-xhtml-content-error.xhtml
index bc75bc27d..99e377845 100644
--- a/src/test/resources/epub3/03-resources/files/file-url-in-xhtml-content-error.xhtml
+++ b/src/test/resources/epub3/03-resources/files/file-url-in-xhtml-content-error.xhtml
@@ -3,6 +3,9 @@
Minimal EPUB
+
Loomings
diff --git a/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/EPUB/content_001.svg b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/EPUB/content_001.svg
new file mode 100644
index 000000000..beee238e5
--- /dev/null
+++ b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/EPUB/content_001.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/EPUB/nav.xhtml b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/EPUB/nav.xhtml
new file mode 100644
index 000000000..b75e4403d
--- /dev/null
+++ b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/EPUB/nav.xhtml
@@ -0,0 +1,14 @@
+
+
+
+
+ Minimal Nav
+
+
+
+
+
diff --git a/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/EPUB/package.opf b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/EPUB/package.opf
new file mode 100644
index 000000000..97e2cf422
--- /dev/null
+++ b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/EPUB/package.opf
@@ -0,0 +1,16 @@
+
+
+
+ Minimal EPUB 3.0
+ en
+ NOID
+ 2017-06-14T00:00:01Z
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/META-INF/container.xml b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/META-INF/container.xml
new file mode 100644
index 000000000..318782179
--- /dev/null
+++ b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/META-INF/container.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/mimetype b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/mimetype
new file mode 100644
index 000000000..57ef03f24
--- /dev/null
+++ b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-import-error/mimetype
@@ -0,0 +1 @@
+application/epub+zip
\ No newline at end of file
diff --git a/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/EPUB/content_001.svg b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/EPUB/content_001.svg
new file mode 100644
index 000000000..0746bd644
--- /dev/null
+++ b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/EPUB/content_001.svg
@@ -0,0 +1,7 @@
+
+
+
diff --git a/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/EPUB/nav.xhtml b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/EPUB/nav.xhtml
new file mode 100644
index 000000000..b75e4403d
--- /dev/null
+++ b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/EPUB/nav.xhtml
@@ -0,0 +1,14 @@
+
+
+
+
+ Minimal Nav
+
+
+
+
+
diff --git a/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/EPUB/package.opf b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/EPUB/package.opf
new file mode 100644
index 000000000..97e2cf422
--- /dev/null
+++ b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/EPUB/package.opf
@@ -0,0 +1,16 @@
+
+
+
+ Minimal EPUB 3.0
+ en
+ NOID
+ 2017-06-14T00:00:01Z
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/META-INF/container.xml b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/META-INF/container.xml
new file mode 100644
index 000000000..318782179
--- /dev/null
+++ b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/META-INF/container.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/mimetype b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/mimetype
new file mode 100644
index 000000000..57ef03f24
--- /dev/null
+++ b/src/test/resources/epub3/03-resources/files/resources-remote-stylesheet-svg-xmlpi-error/mimetype
@@ -0,0 +1 @@
+application/epub+zip
\ No newline at end of file
diff --git a/src/test/resources/epub3/03-resources/resources.feature b/src/test/resources/epub3/03-resources/resources.feature
index 2bb733b62..c9e49aa70 100644
--- a/src/test/resources/epub3/03-resources/resources.feature
+++ b/src/test/resources/epub3/03-resources/resources.feature
@@ -472,6 +472,18 @@
Then error RSC-006 is reported
And no other errors or warnings are reported
+ @spec @xref:sec-resource-locations
+ Scenario: Report a remote stylesheet declared in SVG XML processing instruction
+ When checking EPUB 'resources-remote-stylesheet-svg-xmlpi-error'
+ Then error RSC-006 is reported
+ And no other errors or warnings are reported
+
+ @spec @xref:sec-resource-locations
+ Scenario: Report a remote stylesheet declared in SVG inline style import
+ When checking EPUB 'resources-remote-stylesheet-svg-import-error'
+ Then error RSC-006 is reported
+ And no other errors or warnings are reported
+
@spec @xref:sec-resource-locations
Scenario: Warn about a remote resource with a non `https` URL
When checking EPUB 'resources-remote-not-https-warning'
@@ -544,9 +556,15 @@
And no other errors or warnings are reported
@spec @xref:sec-file-urls
- Scenario: Report a file URL used in a content document
+ Scenario: Report a file URL used in an XHTML content document
When checking document 'file-url-in-xhtml-content-error.xhtml'
- Then error RSC-030 is reported
+ Then error RSC-030 is reported 2 times
+ And no other errors or warnings are reported
+
+ @spec @xref:sec-file-urls
+ Scenario: Report a file URL used in an SVG content document
+ When checking document 'file-url-in-svg-content-error.svg'
+ Then error RSC-030 is reported 2 times
And no other errors or warnings are reported
@spec @xref:sec-file-urls
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/content_001.mp3 b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/content_001.mp3
new file mode 100644
index 000000000..3f140bbc4
Binary files /dev/null and b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/content_001.mp3 differ
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/content_001.smil b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/content_001.smil
new file mode 100644
index 000000000..6ef3de3d5
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/content_001.smil
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/content_001.svg b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/content_001.svg
new file mode 100644
index 000000000..036ce299b
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/content_001.svg
@@ -0,0 +1,14 @@
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/nav.xhtml b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/nav.xhtml
new file mode 100644
index 000000000..b75e4403d
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/nav.xhtml
@@ -0,0 +1,14 @@
+
+
+
+
+ Minimal Nav
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/package.opf b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/package.opf
new file mode 100644
index 000000000..cc19a573a
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/EPUB/package.opf
@@ -0,0 +1,22 @@
+
+
+
+ Minimal EPUB 3.0
+ en
+ NOID
+ 2017-06-14T00:00:01Z
+ 2.5s
+ 2.5s
+ -epub-media-overlay-active
+ -epub-media-overlay-playing
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/META-INF/container.xml b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/META-INF/container.xml
new file mode 100644
index 000000000..318782179
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/META-INF/container.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/mimetype b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/mimetype
new file mode 100644
index 000000000..57ef03f24
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-inline-style-valid/mimetype
@@ -0,0 +1 @@
+application/epub+zip
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/content_001.mp3 b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/content_001.mp3
new file mode 100644
index 000000000..3f140bbc4
Binary files /dev/null and b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/content_001.mp3 differ
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/content_001.smil b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/content_001.smil
new file mode 100644
index 000000000..6ef3de3d5
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/content_001.smil
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/content_001.svg b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/content_001.svg
new file mode 100644
index 000000000..cb4d2de6e
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/content_001.svg
@@ -0,0 +1,6 @@
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/nav.xhtml b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/nav.xhtml
new file mode 100644
index 000000000..b75e4403d
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/nav.xhtml
@@ -0,0 +1,14 @@
+
+
+
+
+ Minimal Nav
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/package.opf b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/package.opf
new file mode 100644
index 000000000..cc19a573a
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/EPUB/package.opf
@@ -0,0 +1,22 @@
+
+
+
+ Minimal EPUB 3.0
+ en
+ NOID
+ 2017-06-14T00:00:01Z
+ 2.5s
+ 2.5s
+ -epub-media-overlay-active
+ -epub-media-overlay-playing
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/META-INF/container.xml b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/META-INF/container.xml
new file mode 100644
index 000000000..318782179
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/META-INF/container.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/mimetype b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/mimetype
new file mode 100644
index 000000000..57ef03f24
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-style-not-found-error/mimetype
@@ -0,0 +1 @@
+application/epub+zip
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/content_001.mp3 b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/content_001.mp3
new file mode 100644
index 000000000..3f140bbc4
Binary files /dev/null and b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/content_001.mp3 differ
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/content_001.smil b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/content_001.smil
new file mode 100644
index 000000000..6ef3de3d5
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/content_001.smil
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/content_001.svg b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/content_001.svg
new file mode 100644
index 000000000..f19fbaee2
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/content_001.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/nav.xhtml b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/nav.xhtml
new file mode 100644
index 000000000..b75e4403d
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/nav.xhtml
@@ -0,0 +1,14 @@
+
+
+
+
+ Minimal Nav
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/package.opf b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/package.opf
new file mode 100644
index 000000000..05c947ddb
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/package.opf
@@ -0,0 +1,23 @@
+
+
+
+ Minimal EPUB 3.0
+ en
+ NOID
+ 2017-06-14T00:00:01Z
+ 2.5s
+ 2.5s
+ -epub-media-overlay-active
+ -epub-media-overlay-playing
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/styles.css b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/styles.css
new file mode 100644
index 000000000..2062937c2
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/EPUB/styles.css
@@ -0,0 +1,6 @@
+.-epub-media-overlay-active {
+ background-color: yellow;
+}
+.-epub-media-overlay-playing {
+ color: gray;
+}
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/META-INF/container.xml b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/META-INF/container.xml
new file mode 100644
index 000000000..318782179
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/META-INF/container.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/mimetype b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/mimetype
new file mode 100644
index 000000000..57ef03f24
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-import-valid/mimetype
@@ -0,0 +1 @@
+application/epub+zip
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/content_001.mp3 b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/content_001.mp3
new file mode 100644
index 000000000..3f140bbc4
Binary files /dev/null and b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/content_001.mp3 differ
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/content_001.smil b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/content_001.smil
new file mode 100644
index 000000000..6ef3de3d5
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/content_001.smil
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/content_001.svg b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/content_001.svg
new file mode 100644
index 000000000..7bee699b7
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/content_001.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/nav.xhtml b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/nav.xhtml
new file mode 100644
index 000000000..b75e4403d
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/nav.xhtml
@@ -0,0 +1,14 @@
+
+
+
+
+ Minimal Nav
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/package.opf b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/package.opf
new file mode 100644
index 000000000..05c947ddb
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/package.opf
@@ -0,0 +1,23 @@
+
+
+
+ Minimal EPUB 3.0
+ en
+ NOID
+ 2017-06-14T00:00:01Z
+ 2.5s
+ 2.5s
+ -epub-media-overlay-active
+ -epub-media-overlay-playing
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/styles.css b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/styles.css
new file mode 100644
index 000000000..2062937c2
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/EPUB/styles.css
@@ -0,0 +1,6 @@
+.-epub-media-overlay-active {
+ background-color: yellow;
+}
+.-epub-media-overlay-playing {
+ color: gray;
+}
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/META-INF/container.xml b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/META-INF/container.xml
new file mode 100644
index 000000000..318782179
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/META-INF/container.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/mimetype b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/mimetype
new file mode 100644
index 000000000..57ef03f24
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-link-valid/mimetype
@@ -0,0 +1 @@
+application/epub+zip
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/content_001.mp3 b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/content_001.mp3
new file mode 100644
index 000000000..3f140bbc4
Binary files /dev/null and b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/content_001.mp3 differ
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/content_001.smil b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/content_001.smil
new file mode 100644
index 000000000..6ef3de3d5
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/content_001.smil
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/content_001.svg b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/content_001.svg
new file mode 100644
index 000000000..29d2ddff8
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/content_001.svg
@@ -0,0 +1,7 @@
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/nav.xhtml b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/nav.xhtml
new file mode 100644
index 000000000..b75e4403d
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/nav.xhtml
@@ -0,0 +1,14 @@
+
+
+
+
+ Minimal Nav
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/package.opf b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/package.opf
new file mode 100644
index 000000000..05c947ddb
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/package.opf
@@ -0,0 +1,23 @@
+
+
+
+ Minimal EPUB 3.0
+ en
+ NOID
+ 2017-06-14T00:00:01Z
+ 2.5s
+ 2.5s
+ -epub-media-overlay-active
+ -epub-media-overlay-playing
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/styles.css b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/styles.css
new file mode 100644
index 000000000..2062937c2
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/EPUB/styles.css
@@ -0,0 +1,6 @@
+.-epub-media-overlay-active {
+ background-color: yellow;
+}
+.-epub-media-overlay-playing {
+ color: gray;
+}
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/META-INF/container.xml b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/META-INF/container.xml
new file mode 100644
index 000000000..318782179
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/META-INF/container.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/mimetype b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/mimetype
new file mode 100644
index 000000000..57ef03f24
--- /dev/null
+++ b/src/test/resources/epub3/09-media-overlays/files/mediaoverlays-active-class-svg-stylesheet-xml-pi-valid/mimetype
@@ -0,0 +1 @@
+application/epub+zip
\ No newline at end of file
diff --git a/src/test/resources/epub3/09-media-overlays/media-overlays.feature b/src/test/resources/epub3/09-media-overlays/media-overlays.feature
index 472730378..9d63ea91f 100644
--- a/src/test/resources/epub3/09-media-overlays/media-overlays.feature
+++ b/src/test/resources/epub3/09-media-overlays/media-overlays.feature
@@ -202,44 +202,81 @@ Feature: EPUB 3 — Media Overlays
### 9.3.4 Associating style information
-
+
@spec @xref:sec-docs-assoc-style
Scenario: Verify 'media:active-class' and 'media:playback-active-class' properties referring to classes defined in a stylesheet
Given the reporting level is set to USAGE
When checking EPUB 'mediaoverlays-active-class-stylesheet-valid'
- Then usage CSS-029 is reported 0 times
- And no errors or warnings are reported
-
+ Then no errors or warnings are reported
+ And no usages are reported
+
@spec @xref:sec-docs-assoc-style
Scenario: Verify 'media:active-class' and 'media:playback-active-class' properties referring to classes defined inline
+ Given the reporting level is set to USAGE
When checking EPUB 'mediaoverlays-active-class-inline-valid'
Then no errors or warnings are reported
-
+ And no usages are reported
+
+ @spec @xref:sec-docs-assoc-style
+ Scenario: Verify 'media:active-class' and 'media:playback-active-class' properties referring to classes defined inline in SVG
+ Given the reporting level is set to USAGE
+ When checking EPUB 'mediaoverlays-active-class-svg-inline-style-valid'
+ Then no errors or warnings are reported
+ And no usages are reported
+
+ @spec @xref:sec-docs-assoc-style
+ Scenario: Verify 'media:active-class' and 'media:playback-active-class' properties referring to classes defined in stylesheet linked from SVG
+ Given the reporting level is set to USAGE
+ When checking EPUB 'mediaoverlays-active-class-svg-stylesheet-link-valid'
+ Then no errors or warnings are reported
+ And no usages are reported
+
+ @spec @xref:sec-docs-assoc-style
+ Scenario: Verify 'media:active-class' and 'media:playback-active-class' properties referring to classes defined in stylesheet imported from SVG
+ Given the reporting level is set to USAGE
+ When checking EPUB 'mediaoverlays-active-class-svg-stylesheet-import-valid'
+ Then no errors or warnings are reported
+ And no usages are reported
+
+ @spec @xref:sec-docs-assoc-style
+ Scenario: Verify 'media:active-class' and 'media:playback-active-class' properties referring to classes defined in stylesheet linked as processing instruction from SVG
+ Given the reporting level is set to USAGE
+ When checking EPUB 'mediaoverlays-active-class-svg-stylesheet-xml-pi-valid'
+ Then no errors or warnings are reported
+ And no usages are reported
+
Scenario: Report when well-known class names are found in CSS but not declared in the package document
Given the reporting level is set to USAGE
When checking EPUB 'mediaoverlays-active-class-stylesheet-undeclared-valid'
Then usage CSS-029 is reported 2 times
- But no errors or warnings are reported
-
+ But no other usages are reported
+ And no errors or warnings are reported
+
@spec @xref:sec-docs-assoc-style
- Scenario: Report when 'media:active-class' is defined but no CSS was found in the content document
+ Scenario: Report when 'media:active-class' is defined but no CSS was found in the XHTML content document
When checking EPUB 'mediaoverlays-active-class-style-not-found-error'
Then error CSS-030 is reported
And no other errors or warnings are reported
@spec @xref:sec-docs-assoc-style
- Scenario: Report when 'media:playback-active-class' is defined but no CSS was found in the content document
+ Scenario: Report when 'media:playback-active-class' is defined but no CSS was found in the XHTML content document
When checking EPUB 'mediaoverlays-playback-active-class-style-not-found-error'
Then error CSS-030 is reported
And no other errors or warnings are reported
+ @spec @xref:sec-docs-assoc-style
+ Scenario: Report when 'media:active-class' is defined but no CSS was found in the SVG content document
+ When checking EPUB 'mediaoverlays-active-class-svg-style-not-found-error'
+ Then error CSS-030 is reported
+ And no other errors or warnings are reported
+
@spec @xref:sec-docs-assoc-style
Scenario: Report a 'media:active-class' property with a refines attribute
When checking file 'mediaoverlays-active-class-refines-error.opf'
Then error RSC-005 is reported
And the message contains "must not be used with the media:active-class property"
And no other errors or warnings are reported
-
+
@spec @xref:sec-docs-assoc-style
Scenario: Report a 'media:playback-active-class' property with a refines attribute
When checking file 'mediaoverlays-playback-active-class-refines-error.opf'
@@ -260,7 +297,7 @@ Feature: EPUB 3 — Media Overlays
Then error RSC-005 is reported
And the message contains "must define a single class name"
And no other errors or warnings are reported
-
+
#Scenario: Detect when media overlays class are declared in the publication but no CSS is found
### 9.3.5 Media overlays packaging