| 37 | import com.adobe.epubcheck.opf.ValidationContext; |
| 38 | |
| 39 | public class CSSChecker extends PublicationResourceChecker |
| 40 | { |
| 41 | private final Mode mode; |
| 42 | |
| 43 | // Below only used when checking css strings |
| 44 | private final String value; // css string |
| 45 | private int line; // where css string occurs in host |
| 46 | private final boolean isStyleAttribute; |
| 47 | |
| 48 | enum Mode |
| 49 | { |
| 50 | FILE, |
| 51 | STRING |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Constructor for CSS files. |
| 56 | */ |
| 57 | public CSSChecker(ValidationContext context) |
| 58 | { |
| 59 | this(context, Mode.FILE, null, -1, false); |
| 60 | } |
| 61 | |
| 62 | public CSSChecker(ValidationContext context, String value, int line, boolean isStyleAttribute) |
| 63 | { |
| 64 | this(context, Mode.STRING, value, line, isStyleAttribute); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Constructor for CSS strings (html style attributes and elements) . |
| 69 | */ |
| 70 | private CSSChecker(ValidationContext context, Mode mode, String value, int line, |
| 71 | boolean isStyleAttribute) |
| 72 | { |
| 73 | super(context); |
| 74 | this.mode = mode; |
| 75 | this.value = value; |
| 76 | this.line = line; |
| 77 | this.isStyleAttribute = isStyleAttribute; |
| 78 | } |
| 79 | |
| 80 | @Override |
| 81 | protected boolean checkPublicationBeforeContent() |
| 82 | { |
| 83 | if (this.mode == Mode.FILE) { |
| 84 | return super.checkPublicationBeforeContent(); |
| 85 | } |
| 86 | return true; |
| 87 | } |
| 88 | |
| 89 | @Override |
| 90 | protected boolean checkContent() |
| 91 | { |
| 92 | CssSource source = null; |
| 93 | |
| 94 | try |
| 95 | { |
| 96 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…