Skip to content

Commit bc0b013

Browse files
committed
(c)
1 parent ef6daa7 commit bc0b013

File tree

9 files changed

+26
-38
lines changed

9 files changed

+26
-38
lines changed

org/w3c/css/properties/css3/CssTabSize.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// $Id$
1+
//
22
// Author: Yves Lafon <ylafon@w3.org>
33
//
4-
// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
4+
// (c) COPYRIGHT World Wide Web Consortium, 2024.
55
// Please first read the full copyright statement in file COPYRIGHT.html
66
package org.w3c.css.properties.css3;
77

org/w3c/css/properties/css3/CssTextWrap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Author: Yves Lafon <ylafon@w3.org>
33
//
4-
// (c) COPYRIGHT MIT, ERCIM, Keio University, Beihang, 2012.
4+
// (c) COPYRIGHT World Wide Web Consortium, 2024.
55
// Please first read the full copyright statement in file COPYRIGHT.html
66
package org.w3c.css.properties.css3;
77

org/w3c/css/properties/css3/CssTextWrapMode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Author: Yves Lafon <ylafon@w3.org>
33
//
4-
// (c) COPYRIGHT MIT, ERCIM, Keio University, Beihang, 2012.
4+
// (c) COPYRIGHT World Wide Web Consortium, 2024.
55
// Please first read the full copyright statement in file COPYRIGHT.html
66
package org.w3c.css.properties.css3;
77

org/w3c/css/properties/css3/CssTextWrapStyle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Author: Yves Lafon <ylafon@w3.org>
33
//
4-
// (c) COPYRIGHT MIT, ERCIM, Keio University, Beihang, 2012.
4+
// (c) COPYRIGHT World Wide Web Consortium, 2024.
55
// Please first read the full copyright statement in file COPYRIGHT.html
66
package org.w3c.css.properties.css3;
77

org/w3c/css/properties/css3/CssWhiteSpaceTrim.java

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,23 @@
1818
import static org.w3c.css.values.CssOperator.SPACE;
1919

2020
/**
21-
* @spec https://www.w3.org/TR/2024/WD-css-text-4-20240219/#propdef-text-transform
21+
* @spec https://www.w3.org/TR/2024/WD-css-text-4-20240219/#propdef-white-space-trim
2222
*/
23-
public class CssWhiteSpaceTrim extends org.w3c.css.properties.css.CssTextTransform {
24-
25-
private static CssIdent[] allowed_action_values;
26-
private static CssIdent fullWidth, fullSizeKana;
23+
public class CssWhiteSpaceTrim extends org.w3c.css.properties.css.CssWhiteSpaceTrim {
2724

25+
private final static CssIdent[] allowed_values;
2826

2927
static {
30-
fullWidth = CssIdent.getIdent("full-width");
31-
fullSizeKana = CssIdent.getIdent("full-size-kana");
32-
33-
String id_values[] = {"capitalize", "uppercase", "lowercase"};
34-
allowed_action_values = new CssIdent[id_values.length];
28+
String[] id_values = {"discard-before", "discard-after", "discard-inner"};
29+
allowed_values = new CssIdent[id_values.length];
3530
int i = 0;
3631
for (String s : id_values) {
37-
allowed_action_values[i++] = CssIdent.getIdent(s);
32+
allowed_values[i++] = CssIdent.getIdent(s);
3833
}
3934
}
4035

41-
public static CssIdent getMatchingActionIdent(CssIdent ident) {
42-
for (CssIdent id : allowed_action_values) {
36+
public static CssIdent getAllowedIdent(CssIdent ident) {
37+
for (CssIdent id : allowed_values) {
4338
if (id.equals(ident)) {
4439
return id;
4540
}
@@ -48,28 +43,25 @@ public static CssIdent getMatchingActionIdent(CssIdent ident) {
4843
}
4944

5045
/**
51-
* Create a new CssTextTransform
46+
* Create a new CssWhiteSpaceTrim
5247
*/
5348
public CssWhiteSpaceTrim() {
5449
value = initial;
5550
}
5651

5752
/**
58-
* Creates a new CssTextTransform
53+
* Creates a new CssWhiteSpaceTrim
5954
*
6055
* @param expression The expression for this property
61-
* @throws InvalidParamException
62-
* Expressions are incorrect
56+
* @throws InvalidParamException Expressions are incorrect
6357
*/
6458
public CssWhiteSpaceTrim(ApplContext ac, CssExpression expression, boolean check)
6559
throws InvalidParamException {
6660
setByUser();
6761
CssValue val = expression.getValue();
62+
CssIdent id;
6863
char op;
6964
ArrayList<CssValue> values = new ArrayList<>();
70-
boolean got_action = false;
71-
boolean got_full_width = false;
72-
boolean got_full_size_kana = false;
7365

7466
if (check && expression.getCount() > 3) {
7567
throw new InvalidParamException("unrecognize", ac);
@@ -99,19 +91,14 @@ public CssWhiteSpaceTrim(ApplContext ac, CssExpression expression, boolean check
9991
getPropertyName(), ac);
10092
}
10193
values.add(val);
102-
} else if (fullWidth.equals(val.getIdent()) && !got_full_width) {
103-
got_full_width = true;
104-
values.add(val);
105-
} else if (fullSizeKana.equals(val.getIdent()) && !got_full_size_kana) {
106-
got_full_size_kana = true;
107-
values.add(val);
108-
} else if (!got_action) {
109-
if (getMatchingActionIdent(val.getIdent()) == null) {
94+
} else if ((id = getAllowedIdent(val.getIdent())) != null) {
95+
// check for duplicates.
96+
// TODO Should it be a warning instead?
97+
if (values.contains(id)) {
11098
throw new InvalidParamException("value",
11199
expression.getValue(),
112100
getPropertyName(), ac);
113101
}
114-
got_action = true;
115102
values.add(val);
116103
} else {
117104
throw new InvalidParamException("value",
@@ -125,6 +112,7 @@ public CssWhiteSpaceTrim(ApplContext ac, CssExpression expression, boolean check
125112
expression.next();
126113
}
127114
value = (values.size() == 1) ? values.get(0) : new CssValueList(values);
115+
128116
}
129117

130118
public CssWhiteSpaceTrim(ApplContext ac, CssExpression expression)

org/w3c/css/properties/css3/CssWordSpaceTransform.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Author: Yves Lafon <ylafon@w3.org>
33
//
4-
// (c) COPYRIGHT MIT, ERCIM, Keio University, Beihang, 2012.
4+
// (c) COPYRIGHT World Wide Web Consortium, 2024.
55
// Please first read the full copyright statement in file COPYRIGHT.html
66
package org.w3c.css.properties.css3;
77

org/w3c/css/properties/css3/CssWrapAfter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Author: Yves Lafon <ylafon@w3.org>
33
//
4-
// (c) COPYRIGHT MIT, ERCIM, Keio University, Beihang, 2012.
4+
// (c) COPYRIGHT World Wide Web Consortium, 2024.
55
// Please first read the full copyright statement in file COPYRIGHT.html
66
package org.w3c.css.properties.css3;
77

org/w3c/css/properties/css3/CssWrapBefore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Author: Yves Lafon <ylafon@w3.org>
33
//
4-
// (c) COPYRIGHT MIT, ERCIM, Keio University, Beihang, 2012.
4+
// (c) COPYRIGHT World Wide Web Consortium, 2024.
55
// Please first read the full copyright statement in file COPYRIGHT.html
66
package org.w3c.css.properties.css3;
77

org/w3c/css/properties/css3/CssWrapInside.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Author: Yves Lafon <ylafon@w3.org>
33
//
4-
// (c) COPYRIGHT MIT, ERCIM, Keio University, Beihang, 2012.
4+
// (c) COPYRIGHT World Wide Web Consortium, 2024.
55
// Please first read the full copyright statement in file COPYRIGHT.html
66
package org.w3c.css.properties.css3;
77

0 commit comments

Comments
 (0)