Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
0d31406
Revert "no need to care about inherit in css3 anymore"
ylafon Sep 6, 2021
0329205
more casting issues fixed
ylafon Sep 6, 2021
0ea7224
revert defaults, how can this be fixed properly...
ylafon Sep 6, 2021
4c5ecd4
add way to access the stylesheet from the main context
ylafon Sep 6, 2021
e1dacb0
fix size when expression is not set
ylafon Sep 6, 2021
2772a7e
redo variable resolution, moved to a more global place for all variab…
ylafon Sep 6, 2021
abee1f9
added relevant check functions to delegate value check, proper fix of…
ylafon Sep 6, 2021
8bd4837
more casting issues
ylafon Sep 6, 2021
7e6e994
casting issue + use proper value instead of ident (might use getRawTy…
ylafon Sep 6, 2021
d969b44
cast issue+ updated ref
ylafon Sep 6, 2021
809ab35
cast issue (continuing...) + updated per https://www.w3.org/TR/2020/W…
ylafon Sep 6, 2021
939efde
cast issue (cont.) + ref
ylafon Sep 6, 2021
f088576
casting issue + use proper value instead of ident (might use getRawTy…
ylafon Sep 6, 2021
77b2e24
check based on resolved value
ylafon Sep 6, 2021
d32e2c5
casting issue (cont)
ylafon Sep 6, 2021
31c357f
updated to https://www.w3.org/TR/2020/WD-css-overflow-3-20200603/#pro…
ylafon Sep 6, 2021
2e2cc50
casting issue (cont)
ylafon Sep 6, 2021
f415054
casting issue (cont)
ylafon Sep 6, 2021
e9ac19a
internalize idents at parsing time
ylafon Sep 6, 2021
6c30f3f
regen
ylafon Sep 6, 2021
c89caf4
casting issue (cont)
ylafon Sep 6, 2021
37305d0
casting issue (cont)
ylafon Sep 6, 2021
1eacc41
updated per https://www.w3.org/TR/2021/WD-css-ruby-1-20210310/#propde…
ylafon Sep 6, 2021
0cf06af
cast+ref
ylafon Sep 6, 2021
165b843
updated per https://www.w3.org/TR/2021/WD-css-ruby-1-20210310/#propde…
ylafon Sep 6, 2021
9057e1f
rewrote entirely ruby-overhang per https://www.w3.org/TR/2021/WD-css-…
ylafon Sep 7, 2021
7f6f00e
cast+ref
ylafon Sep 7, 2021
4b9dfb7
don't forget the value
ylafon Sep 7, 2021
f42b36b
cast+ref
ylafon Sep 7, 2021
c0cee83
cast+ref (on deprecated classes)
ylafon Sep 7, 2021
0693abf
cast+ref
ylafon Sep 7, 2021
1ebfe9c
fix equality when 2nd val is null
ylafon Sep 7, 2021
fa5b752
redid content per https://www.w3.org/TR/2019/WD-css-content-3-2019080…
ylafon Sep 7, 2021
f9d8c09
cast+ref
ylafon Sep 8, 2021
153f369
refs+cast + added 'text' value as obsolete from webcompat spec
ylafon Sep 8, 2021
5a65845
typo in test
ylafon Sep 8, 2021
b06bfa3
getting ident without testing type first is not right
ylafon Sep 8, 2021
018565f
same as b06bfa3a17ddd49946026a314ccdc6d5106d5868
ylafon Sep 8, 2021
905f675
cast (cont)
ylafon Sep 8, 2021
3be827a
use original value
ylafon Sep 8, 2021
a5f7863
cast (cont)
ylafon Sep 8, 2021
3f837bf
cast+mark as deprecated (should be removed at some point)
ylafon Sep 8, 2021
49ef87d
redone font src parsing per https://www.w3.org/TR/2021/WD-css-fonts-4…
ylafon Sep 8, 2021
2c06677
refs+cast (cont)
ylafon Sep 8, 2021
f686ded
handle both css3 and svg based on the profile used, as the css3 versi…
ylafon Sep 8, 2021
665eff8
cast (cont) on deprecated property
ylafon Sep 8, 2021
30b3c3d
cast (cont) + small updates
ylafon Sep 8, 2021
a9a0aaf
ref+cast and mark deprecated
ylafon Sep 8, 2021
dff56ac
ref+cast (cont)
ylafon Sep 8, 2021
7b5a795
updated refs + cast issue (cont)
ylafon Sep 8, 2021
3b182a8
print-color-adjust per https://www.w3.org/TR/2021/WD-css-color-adjust…
ylafon Sep 8, 2021
a736b1a
updated + cast (cont)
ylafon Sep 8, 2021
24ae446
updated per https://www.w3.org/TR/2021/WD-css-color-adjust-1-20210616…
ylafon Sep 8, 2021
499c27a
cast (cont)
ylafon Sep 8, 2021
64a6db6
cast (cont)
ylafon Sep 9, 2021
7908e4c
cast + refs (cont)
ylafon Sep 9, 2021
e63f951
refs+cast (cont)
ylafon Sep 9, 2021
c7eee2f
cast (cont)
ylafon Sep 9, 2021
e1250b6
cast (cont) + marked as deprecated
ylafon Sep 9, 2021
7c590b0
inline-sizing per https://www.w3.org/TR/2020/WD-css-inline-3-20200827…
ylafon Sep 9, 2021
a3e71f3
baseline-source per https://www.w3.org/TR/2020/WD-css-inline-3-202008…
ylafon Sep 9, 2021
f8dcfc7
cast+refs (cont.)
ylafon Sep 9, 2021
c87ee82
cast+refs (cont.)
ylafon Sep 9, 2021
25254da
mark as deprecated
ylafon Sep 9, 2021
f1143be
cast+refs (cont.) + a few updates
ylafon Sep 9, 2021
ecaa943
cast+ref (cont.)
ylafon Sep 9, 2021
f427cbe
cast+ref (cont.)
ylafon Sep 9, 2021
4458367
mark as deprecated
ylafon Sep 9, 2021
39aef5d
cast (cont.)
ylafon Sep 9, 2021
79d2c06
cast (cont.)
ylafon Sep 9, 2021
17f8130
refs+cast (cont.)
ylafon Sep 9, 2021
84c59cb
refs+cast (cont.)
ylafon Sep 9, 2021
dd4fb2e
column now use row to parse, updated ref+cast
ylafon Sep 10, 2021
3023126
aligned all refs
ylafon Sep 10, 2021
f646100
refs+cast (cont.)
ylafon Sep 10, 2021
9ffdf7e
removed overloaded value
ylafon Sep 10, 2021
bbed863
cast+refs (cont.)
ylafon Sep 10, 2021
7931fe1
color accessor
ylafon Sep 10, 2021
d6feb0a
cast+refs (cont.)
ylafon Sep 10, 2021
8247284
Updated all font properties to https://www.w3.org/TR/2021/WD-css-font…
ylafon Sep 12, 2021
10f25a1
remove redundant check
ylafon Sep 12, 2021
f44bf1d
fix remaining CssIdent casts
ylafon Sep 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cast+ref (cont.)
  • Loading branch information
ylafon committed Sep 9, 2021
commit ecaa943d6e629979042fcea3f3d378d4a56b1436
34 changes: 15 additions & 19 deletions org/w3c/css/properties/css3/CssBackgroundAttachment.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@
import static org.w3c.css.values.CssOperator.COMMA;

/**
* @spec http://www.w3.org/TR/2009/CR-css3-background-20091217/#the-background-attachment
* @spec https://www.w3.org/TR/2021/CRD-css-backgrounds-3-20210726/#propdef-background-attachment
*/
public class CssBackgroundAttachment extends org.w3c.css.properties.css.CssBackgroundAttachment {

private static CssIdent[] allowed_values;
private static final CssIdent[] allowed_values;

static {
allowed_values = new CssIdent[3];
allowed_values[0] = CssIdent.getIdent("scroll");
allowed_values[1] = CssIdent.getIdent("fixed");
allowed_values[2] = CssIdent.getIdent("local");
String[] id_values = {"scroll", "fixed", "local"};
allowed_values = new CssIdent[id_values.length];
int i = 0;
for (String s : id_values) {
allowed_values[i++] = CssIdent.getIdent(s);
}
}

public static boolean isMatchingIdent(CssIdent ident) {
Expand Down Expand Up @@ -63,8 +65,7 @@ public CssBackgroundAttachment() {
* @param ac the context
* @param expression The expression for this property
* @param check if some length checking is required
* @throws org.w3c.css.util.InvalidParamException
* Values are incorrect
* @throws org.w3c.css.util.InvalidParamException Values are incorrect
*/
public CssBackgroundAttachment(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
Expand All @@ -82,22 +83,22 @@ public CssBackgroundAttachment(ApplContext ac, CssExpression expression,
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
if (inherit.equals(val)) {
CssIdent id = val.getIdent();
if (CssIdent.isCssWide(id)) {
// if we got inherit after other values, fail
// if we got more than one value... fail
if ((values.size() > 0) || (expression.getCount() > 1)) {
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
values.add(inherit);
values.add(val);
} else {
// check that it's in the allowed values
CssValue new_val = getMatchingIdent((CssIdent) val);
if (new_val == null) {
if (getMatchingIdent(id) == null) {
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
values.add(new_val);
values.add(val);
}
expression.next();
// and check that values are separated by commas
Expand All @@ -106,12 +107,7 @@ public CssBackgroundAttachment(ApplContext ac, CssExpression expression,
Character.toString(op), ac);
}
}

if (values.size() == 1) {
value = values.get(0);
} else {
value = new CssLayerList(values);
}
value = (values.size() == 1) ? values.get(0) : new CssLayerList(values);
}

public CssBackgroundAttachment(ApplContext ac, CssExpression expression)
Expand Down
16 changes: 7 additions & 9 deletions org/w3c/css/properties/css3/CssBackgroundBlendMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ public CssBackgroundBlendMode() {
* Creates a new CssBackgroundBlendMode
*
* @param expression The expression for this property
* @throws org.w3c.css.util.InvalidParamException
* Expressions are incorrect
* @throws org.w3c.css.util.InvalidParamException Expressions are incorrect
*/
public CssBackgroundBlendMode(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
setByUser();

CssValue val;
CssIdent ident, id;
CssIdent ident;
char op;

ArrayList<CssValue> values = new ArrayList<>();
Expand All @@ -52,22 +51,21 @@ public CssBackgroundBlendMode(ApplContext ac, CssExpression expression, boolean
op = expression.getOperator();

if (val.getType() == CssTypes.CSS_IDENT) {
ident = (CssIdent) val;
if (inherit.equals(ident)) {
ident = val.getIdent();
if (CssIdent.isCssWide(ident)) {
if (expression.getCount() > 1) {
throw new InvalidParamException("value",
val.toString(),
getPropertyName(), ac);
}
values.add(inherit);
values.add(val);
} else {
id = CssMixBlendMode.getAllowedIdent(ident);
if (id == null) {
if (CssMixBlendMode.getAllowedIdent(ident) == null) {
throw new InvalidParamException("value",
val.toString(),
getPropertyName(), ac);
}
values.add(id);
values.add(val);
}
} else {
throw new InvalidParamException("value",
Expand Down
14 changes: 8 additions & 6 deletions org/w3c/css/properties/css3/CssBackgroundColor.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssIdent;
import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;

/**
* @spec http://www.w3.org/TR/2009/CR-css3-background-20091217/#the-background-color
* @spec https://www.w3.org/TR/2021/CRD-css-backgrounds-3-20210726/#propdef-background-color
*/
public class CssBackgroundColor extends org.w3c.css.properties.css.CssBackgroundColor {

Expand All @@ -28,8 +30,7 @@ public CssBackgroundColor() {
* Create a new CssBackgroundColor
*
* @param expression The expression for this property
* @throws org.w3c.css.util.InvalidParamException
* Values are incorrect
* @throws org.w3c.css.util.InvalidParamException Values are incorrect
*/
public CssBackgroundColor(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
Expand All @@ -41,8 +42,8 @@ public CssBackgroundColor(ApplContext ac, CssExpression expression,
throw new InvalidParamException("unrecognize", ac);
}

if (inherit.equals(val)) {
value = inherit;
if ((val.getType() == CssTypes.CSS_IDENT) && CssIdent.isCssWide(val.getIdent())) {
value = val;
expression.next();
} else {
try {
Expand All @@ -51,7 +52,7 @@ public CssBackgroundColor(ApplContext ac, CssExpression expression,
CssColor tcolor = new CssColor(ac, expression, check);
// instead of using getColor, we get the value directly
// as we can have idents
value = (tcolor.value == null) ? tcolor.color : tcolor.value;
value = (tcolor.color != null) ? tcolor.color : tcolor.value;
} catch (InvalidParamException e) {
throw new InvalidParamException("value",
expression.getValue(),
Expand All @@ -69,6 +70,7 @@ public CssBackgroundColor(ApplContext ac, CssExpression expression)
* Is the value of this property is a default value.
* It is used by all macro for the function <code>print</code>
*/
@Override
public boolean isDefault() {
return (value == transparent);
}
Expand Down
20 changes: 8 additions & 12 deletions org/w3c/css/properties/css3/CssBackgroundImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static org.w3c.css.values.CssOperator.COMMA;

/**
* @spec http://www.w3.org/TR/2009/CR-css3-background-20091217/#the-background-image
* @spec https://www.w3.org/TR/2021/CRD-css-backgrounds-3-20210726/#propdef-background-image
*/
public class CssBackgroundImage extends org.w3c.css.properties.css.CssBackgroundImage {

Expand All @@ -41,8 +41,7 @@ public CssBackgroundImage() {
* @param ac the context
* @param expression The expression for this property
* @param check boolean
* @throws org.w3c.css.util.InvalidParamException
* Values are incorrect
* @throws org.w3c.css.util.InvalidParamException Values are incorrect
*/
public CssBackgroundImage(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
Expand All @@ -62,17 +61,18 @@ public CssBackgroundImage(ApplContext ac, CssExpression expression,
values.add(val);
break;
case CssTypes.CSS_IDENT:
if (inherit.equals(val)) {
CssIdent id = val.getIdent();
if (CssIdent.isCssWide(id)) {
// if we got inherit after other values, fail
// if we got more than one value... fail
if ((values.size() > 0) || (expression.getCount() > 1)) {
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
values.add(inherit);
values.add(val);
break;
} else if (none.equals(val)) {
values.add(none);
} else if (isMatchingIdent(id)) {
values.add(val);
break;
}
default:
Expand All @@ -85,11 +85,7 @@ public CssBackgroundImage(ApplContext ac, CssExpression expression,
Character.toString(op), ac);
}
}
if (values.size() == 1) {
value = values.get(0);
} else {
value = new CssLayerList(values);
}
value = (values.size() == 1) ? values.get(0) : new CssLayerList(values);
}

public CssBackgroundImage(ApplContext ac, CssExpression expression)
Expand Down
27 changes: 9 additions & 18 deletions org/w3c/css/properties/css3/CssBackgroundOrigin.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static org.w3c.css.values.CssOperator.COMMA;

/**
* @spec http://www.w3.org/TR/2009/CR-css3-background-20091217/#the-background-origin
* @spec https://www.w3.org/TR/2021/CRD-css-backgrounds-3-20210726/#propdef-background-origin
*/

public class CssBackgroundOrigin extends org.w3c.css.properties.css.CssBackgroundOrigin {
Expand Down Expand Up @@ -53,8 +53,7 @@ public CssBackgroundOrigin() {
* Create a new CssBackgroundClip
*
* @param expression The expression for this property
* @throws org.w3c.css.util.InvalidParamException
* Incorrect value
* @throws org.w3c.css.util.InvalidParamException Incorrect value
*/
public CssBackgroundOrigin(ApplContext ac, CssExpression expression,
boolean check) throws InvalidParamException {
Expand All @@ -69,23 +68,19 @@ public CssBackgroundOrigin(ApplContext ac, CssExpression expression,
op = expression.getOperator();
switch (val.getType()) {
case CssTypes.CSS_IDENT:
if (inherit.equals(val)) {
CssIdent id = val.getIdent();
if (CssIdent.isCssWide(id)) {
// if we got inherit after other values, fail
// if we got more than one value... fail
if ((values.size() > 0) || (expression.getCount() > 1)) {
throw new InvalidParamException("value", val,
getPropertyName(), ac);
}
values.add(inherit);
values.add(val);
break;
} else if (border_box.equals(val)) {
values.add(border_box);
break;
} else if (content_box.equals(val)) {
values.add(content_box);
break;
} else if (padding_box.equals(val)) {
values.add(padding_box);
}
if (isMatchingIdent(id)) {
values.add(val);
break;
}
default:
Expand All @@ -98,11 +93,7 @@ public CssBackgroundOrigin(ApplContext ac, CssExpression expression,
Character.toString(op), ac);
}
}
if (values.size() == 1) {
value = values.get(0);
} else {
value = new CssLayerList(values);
}
value = (values.size() == 1) ? values.get(0) : new CssLayerList(values);
}

public CssBackgroundOrigin(ApplContext ac, CssExpression expression)
Expand Down
Loading