|
9 | 9 | import org.idpf.epubcheck.util.css.CssContentHandler; |
10 | 10 | import org.idpf.epubcheck.util.css.CssErrorHandler; |
11 | 11 | import org.idpf.epubcheck.util.css.CssExceptions.CssException; |
| 12 | +import org.idpf.epubcheck.util.css.CssGrammar; |
12 | 13 | import org.idpf.epubcheck.util.css.CssGrammar.CssAtRule; |
| 14 | +import org.idpf.epubcheck.util.css.CssGrammar.CssComposedConstruct; |
13 | 15 | import org.idpf.epubcheck.util.css.CssGrammar.CssConstruct; |
14 | 16 | import org.idpf.epubcheck.util.css.CssGrammar.CssDeclaration; |
15 | 17 | import org.idpf.epubcheck.util.css.CssGrammar.CssSelector; |
@@ -201,6 +203,43 @@ public void endAtRule(String name) |
201 | 203 | @Override |
202 | 204 | public void selectors(List<CssSelector> selectors) |
203 | 205 | { |
| 206 | + for (CssSelector selector : selectors) |
| 207 | + { |
| 208 | + if (!context.featureReport.hasFeature(FeatureEnum.MEDIA_OVERLAYS_ACTIVE_CLASS) |
| 209 | + && findClassName(selector, ".-epub-media-overlay-active")) |
| 210 | + { |
| 211 | + report.message(MessageId.CSS_029, |
| 212 | + getCorrectedEPUBLocation(selector.getLocation().getLine(), |
| 213 | + selector.getLocation().getColumn(), selector.toCssString()), |
| 214 | + "-epub-media-overlay-active", "media:active-class"); |
| 215 | + } |
| 216 | + if (!context.featureReport.hasFeature(FeatureEnum.MEDIA_OVERLAYS_PLAYBACK_ACTIVE_CLASS) |
| 217 | + && findClassName(selector, ".-epub-media-overlay-playing")) |
| 218 | + { |
| 219 | + report.message(MessageId.CSS_029, |
| 220 | + getCorrectedEPUBLocation(selector.getLocation().getLine(), |
| 221 | + selector.getLocation().getColumn(), selector.toCssString()), |
| 222 | + "-epub-media-overlay-playing", "media:playback-active-class"); |
| 223 | + } |
| 224 | + } |
| 225 | + } |
| 226 | + |
| 227 | + private boolean findClassName(CssConstruct construct, String name) |
| 228 | + { |
| 229 | + if (construct.getType() == CssGrammar.CssConstruct.Type.CLASSNAME |
| 230 | + && name.equals(construct.toCssString())) |
| 231 | + { |
| 232 | + return true; |
| 233 | + |
| 234 | + } |
| 235 | + else if (construct instanceof CssComposedConstruct) |
| 236 | + { |
| 237 | + for (CssConstruct component : ((CssComposedConstruct) construct).getComponents()) |
| 238 | + { |
| 239 | + if (findClassName(component, name)) return true; |
| 240 | + } |
| 241 | + } |
| 242 | + return false; |
204 | 243 | } |
205 | 244 |
|
206 | 245 | @Override |
|
0 commit comments