Skip to content

Commit d32f852

Browse files
committed
Avoid using CSSStyleDeclarationRule
1 parent 1cc9068 commit d32f852

File tree

4 files changed

+62
-99
lines changed

4 files changed

+62
-99
lines changed

ci/io/github/css4j/ci/BaseSiteErrorReporter.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
import io.sf.carte.doc.style.css.nsac.Selector;
3636
import io.sf.carte.doc.style.css.nsac.SelectorList;
3737
import io.sf.carte.doc.style.css.om.AbstractCSSStyleSheet;
38-
import io.sf.carte.doc.style.css.om.CSSStyleDeclarationRule;
3938
import io.sf.carte.doc.style.css.om.DefaultSheetErrorHandler;
4039
import io.sf.carte.doc.style.css.om.DefaultStyleDeclarationErrorHandler;
4140
import io.sf.carte.doc.style.css.om.RuleParseException;
41+
import io.sf.carte.doc.style.css.om.StyleRule;
4242
import io.sf.carte.doc.style.css.property.CSSPropertyValueException;
4343

4444
abstract public class BaseSiteErrorReporter implements SiteErrorReporter {
@@ -123,9 +123,7 @@ public void sideComparison(String message) {
123123
public void leftHasMoreSheets(List<CSSStyleSheet<? extends CSSRule>> missingSheets, int smallerCount) {
124124
writeError(leftSide + " has more style sheets, " + (missingSheets.size() + smallerCount) + " instead of "
125125
+ smallerCount);
126-
Iterator<CSSStyleSheet<? extends CSSRule>> it = missingSheets.iterator();
127-
while (it.hasNext()) {
128-
CSSStyleSheet<? extends CSSRule> sheet = it.next();
126+
for (CSSStyleSheet<? extends CSSRule> sheet : missingSheets) {
129127
StringBuilder sb = new StringBuilder(128);
130128
sb.append("The sheet is not in ").append(rightSide).append(", href ").append(sheet.getHref());
131129
Node owner = sheet.getOwnerNode();
@@ -141,9 +139,7 @@ public void leftHasMoreSheets(List<CSSStyleSheet<? extends CSSRule>> missingShee
141139
public void rightHasMoreSheets(List<CSSStyleSheet<? extends CSSRule>> missingSheets, int smallerCount) {
142140
writeError(rightSide + " has more style sheets, " + (missingSheets.size() + smallerCount) + " instead of "
143141
+ smallerCount);
144-
Iterator<CSSStyleSheet<? extends CSSRule>> it = missingSheets.iterator();
145-
while (it.hasNext()) {
146-
CSSStyleSheet<? extends CSSRule> sheet = it.next();
142+
for (CSSStyleSheet<? extends CSSRule> sheet : missingSheets) {
147143
StringBuilder sb = new StringBuilder(128);
148144
sb.append("The sheet is not in ").append(leftSide).append(", href ").append(sheet.getHref());
149145
Node owner = sheet.getOwnerNode();
@@ -198,7 +194,7 @@ public void presentationalHintError(DOMElement element, Throwable ex) {
198194
}
199195

200196
@Override
201-
public void ruleSelectorError(CSSStyleDeclarationRule stylerule, SelectorList selist, SelectorList otherSelist,
197+
public void ruleSelectorError(StyleRule stylerule, SelectorList selist, SelectorList otherSelist,
202198
String selectorText, int sheetIndex, int ruleIndex, AbstractCSSStyleSheet parent) {
203199
writeSerializationError("Selector reparse error in rule: " + ruleIndex + " in sheet " + parent.getHref() + ":");
204200
writeSerializationError("List 1 (CSSOM): " + stylerule.getSelectorText());
@@ -436,14 +432,6 @@ public void omIssues(CSSStyleSheet<? extends CSSRule> sheet, int sheetIndex, She
436432
writeError("Rule parsing error: " + it.next().toString());
437433
}
438434
}
439-
LinkedList<String> emptyRules = dseh.getEmptyStyleRules();
440-
if (emptyRules != null) {
441-
selectWarningTargetSheet(sheet, sheetIndex);
442-
Iterator<String> it = emptyRules.iterator();
443-
while (it.hasNext()) {
444-
writeWarning("Empty style rule with selector: " + it.next());
445-
}
446-
}
447435
}
448436
}
449437

0 commit comments

Comments
 (0)