Skip to content

Commit 6ebbcd1

Browse files
committed
streamline and test 'inherit' implementation
1 parent 669ed20 commit 6ebbcd1

4 files changed

Lines changed: 2458 additions & 2429 deletions

File tree

src/main/java/org/htmlunit/cssparser/dom/CSSValueImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,14 @@ public String getStringValue() throws DOMException {
465465
if ((lu.getLexicalUnitType() == LexicalUnitType.IDENT)
466466
|| (lu.getLexicalUnitType() == LexicalUnitType.STRING_VALUE)
467467
|| (lu.getLexicalUnitType() == LexicalUnitType.URI)
468-
|| (lu.getLexicalUnitType() == LexicalUnitType.INHERIT)
469468
|| (lu.getLexicalUnitType() == LexicalUnitType.ATTR)) {
470469
return lu.getStringValue();
471470
}
472471

472+
if (lu.getLexicalUnitType() == LexicalUnitType.INHERIT) {
473+
return "inherit";
474+
}
475+
473476
// for rgba values we are using this type
474477
if (lu.getLexicalUnitType() == LexicalUnitType.FUNCTION
475478
|| lu.getLexicalUnitType() == LexicalUnitType.FUNCTION_CALC) {

src/main/java/org/htmlunit/cssparser/parser/LexicalUnitImpl.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,14 @@ public static LexicalUnit createComma(final LexicalUnit prev) {
11301130
return new LexicalUnitImpl(prev, LexicalUnitType.OPERATOR_COMMA);
11311131
}
11321132

1133+
/**
1134+
* @param prev the previous LexicalUnit
1135+
* @return lexical unit with type comma
1136+
*/
1137+
public static LexicalUnit createInherit(final LexicalUnit prev) {
1138+
return new LexicalUnitImpl(prev, LexicalUnitType.INHERIT);
1139+
}
1140+
11331141
/**
11341142
* @param prev the previous LexicalUnit
11351143
* @return lexical unit with type slash

0 commit comments

Comments
 (0)