|
19 | 19 | import org.idpf.epubcheck.util.css.CssGrammar.CssSelector; |
20 | 20 | import org.idpf.epubcheck.util.css.CssGrammar.CssURI; |
21 | 21 | import org.idpf.epubcheck.util.css.CssLocation; |
22 | | -import org.w3c.epubcheck.core.references.URLChecker; |
23 | 22 | import org.w3c.epubcheck.core.references.Reference; |
| 23 | +import org.w3c.epubcheck.core.references.URLChecker; |
24 | 24 |
|
25 | 25 | import com.adobe.epubcheck.api.EPUBLocation; |
26 | 26 | import com.adobe.epubcheck.api.Report; |
@@ -82,6 +82,13 @@ private EPUBLocation getCorrectedEPUBLocation(int lineNumber, int columnNumber, |
82 | 82 | return EPUBLocation.of(context).at(lineNumber, columnNumber).context(details); |
83 | 83 | } |
84 | 84 |
|
| 85 | + private EPUBLocation getCorrectedEPUBLocation(CssConstruct construct) |
| 86 | + { |
| 87 | + int line = correctedLineNumber(construct.getLocation().getLine()); |
| 88 | + int col = correctedColumnNumber(line, construct.getLocation().getColumn()); |
| 89 | + return EPUBLocation.of(context).at(line, col).context(construct.toCssString()); |
| 90 | + } |
| 91 | + |
85 | 92 | private int correctedLineNumber(int lineNumber) |
86 | 93 | { |
87 | 94 | return startingLineNumber + lineNumber; |
@@ -274,21 +281,15 @@ public void declaration(CssDeclaration declaration) |
274 | 281 | String value = cns.toCssString(); |
275 | 282 | if (value != null && value.equalsIgnoreCase("fixed")) |
276 | 283 | { |
277 | | - report.message(MessageId.CSS_006, |
278 | | - getCorrectedEPUBLocation(declaration.getLocation().getLine(), |
279 | | - declaration.getLocation().getColumn(), declaration.toCssString())); |
| 284 | + report.message(MessageId.CSS_006, getCorrectedEPUBLocation(declaration)); |
280 | 285 | } |
281 | 286 | } |
282 | 287 | } |
283 | 288 | if (version == EPUBVersion.VERSION_3) |
284 | 289 | { |
285 | 290 | if (propertyName.equals("direction") || propertyName.equals("unicode-bidi")) |
286 | 291 | { |
287 | | - report |
288 | | - .message(MessageId.CSS_001, |
289 | | - getCorrectedEPUBLocation(declaration.getLocation().getLine(), |
290 | | - declaration.getLocation().getColumn(), declaration.toCssString()), |
291 | | - propertyName); |
| 292 | + report.message(MessageId.CSS_001, getCorrectedEPUBLocation(declaration), propertyName); |
292 | 293 | } |
293 | 294 | } |
294 | 295 |
|
@@ -340,10 +341,8 @@ else if (version == EPUBVersion.VERSION_3) |
340 | 341 | } |
341 | 342 | if (!blessed) |
342 | 343 | { |
343 | | - report.message(MessageId.CSS_007, |
344 | | - getCorrectedEPUBLocation(declaration.getLocation().getLine(), |
345 | | - declaration.getLocation().getColumn(), declaration.toCssString()), |
346 | | - fontURL, fontMimeType); |
| 344 | + report.message(MessageId.CSS_007, getCorrectedEPUBLocation(declaration), fontURL, |
| 345 | + fontMimeType); |
347 | 346 | } |
348 | 347 | } |
349 | 348 |
|
|
0 commit comments