Skip to content

Commit d9693ea

Browse files
committed
1 parent c6ba7f9 commit d9693ea

File tree

4 files changed

+194
-0
lines changed

4 files changed

+194
-0
lines changed

org/w3c/css/properties/CSS3Properties.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,7 @@ lighting-color: org.w3c.css.properties.css3.CssLightingC
541541
@font-face.font-variation-settings: org.w3c.css.properties.css3.fontface.CssFontVariationSettings
542542
@font-face.font-weight: org.w3c.css.properties.css3.fontface.CssFontWeight
543543
@font-face.line-gap-override: org.w3c.css.properties.css3.fontface.CssLineGapOverride
544+
@font-face.size-adjust: org.w3c.css.properties.css3.fontface.CssSizeAdjust
544545
@font-face.src: org.w3c.css.properties.css3.fontface.CssSrc
545546
@font-face.unicode-range: org.w3c.css.properties.css3.fontface.CssUnicodeRange
546547

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
//
2+
// Author: Yves Lafon <ylafon@w3.org>
3+
//
4+
// (c) COPYRIGHT W3C, 2026.
5+
// Please first read the full copyright statement in file COPYRIGHT.html
6+
7+
package org.w3c.css.properties.css.fontface;
8+
9+
import org.w3c.css.parser.CssStyle;
10+
import org.w3c.css.properties.css.CssProperty;
11+
import org.w3c.css.properties.css3.Css3Style;
12+
import org.w3c.css.util.ApplContext;
13+
import org.w3c.css.util.InvalidParamException;
14+
import org.w3c.css.values.CssExpression;
15+
import org.w3c.css.values.CssValue;
16+
17+
/**
18+
* @since CSS3
19+
*/
20+
public class CssSizeAdjust extends CssProperty {
21+
22+
public CssValue value;
23+
24+
/**
25+
* Create a new CssSizeAdjust
26+
*/
27+
public CssSizeAdjust() {
28+
}
29+
30+
/**
31+
* Creates a new CssSizeAdjust
32+
*
33+
* @param expression The expression for this property
34+
* @throws InvalidParamException Expressions are incorrect
35+
*/
36+
public CssSizeAdjust(ApplContext ac, CssExpression expression, boolean check)
37+
throws InvalidParamException {
38+
throw new InvalidParamException("value",
39+
expression.getValue().toString(),
40+
getPropertyName(), ac);
41+
}
42+
43+
public CssSizeAdjust(ApplContext ac, CssExpression expression)
44+
throws InvalidParamException {
45+
this(ac, expression, false);
46+
}
47+
48+
/**
49+
* Returns the value of this property
50+
*/
51+
public Object get() {
52+
return value;
53+
}
54+
55+
56+
/**
57+
* Returns the name of this property
58+
*/
59+
public final String getPropertyName() {
60+
return "size-adjust";
61+
}
62+
63+
/**
64+
* Returns true if this property is "softly" inherited
65+
* e.g. his value is equals to inherit
66+
*/
67+
public boolean isSoftlyInherited() {
68+
return value.equals(inherit);
69+
}
70+
71+
/**
72+
* Returns a string representation of the object.
73+
*/
74+
public String toString() {
75+
return value.toString();
76+
}
77+
78+
/**
79+
* Add this property to the CssStyle.
80+
*
81+
* @param style The CssStyle
82+
*/
83+
public void addToStyle(ApplContext ac, CssStyle style) {
84+
Css3Style s = (Css3Style) style;
85+
if (s.fontFaceCssSizeAdjust != null) {
86+
style.addRedefinitionWarning(ac, this);
87+
}
88+
s.fontFaceCssSizeAdjust = this;
89+
}
90+
91+
92+
/**
93+
* Compares two properties for equality.
94+
*
95+
* @param property The other property.
96+
*/
97+
public boolean equals(CssProperty property) {
98+
return (property instanceof CssSizeAdjust &&
99+
value.equals(((CssSizeAdjust) property).value));
100+
}
101+
102+
103+
/**
104+
* Get this property in the style.
105+
*
106+
* @param style The style where the property is
107+
* @param resolve if true, resolve the style to find this property
108+
*/
109+
public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
110+
if (resolve) {
111+
return ((Css3Style) style).getFontFaceCssSizeAdjust();
112+
} else {
113+
return ((Css3Style) style).fontFaceCssSizeAdjust;
114+
}
115+
}
116+
}
117+

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@
337337
import org.w3c.css.properties.css.fontface.CssFontStyle;
338338
import org.w3c.css.properties.css.fontface.CssFontWeight;
339339
import org.w3c.css.properties.css.fontface.CssLineGapOverride;
340+
import org.w3c.css.properties.css.fontface.CssSizeAdjust;
340341
import org.w3c.css.properties.css.fontface.CssUnicodeRange;
341342
import org.w3c.css.properties.css.viewport.CssMaxZoom;
342343
import org.w3c.css.properties.css.viewport.CssMinZoom;
@@ -629,6 +630,7 @@ public class Css3Style extends ATSCStyle {
629630
public org.w3c.css.properties.css.fontface.CssFontFamily fontFaceCssFontFamily;
630631
public org.w3c.css.properties.css.fontface.CssFontFeatureSettings fontFaceCssFontFeatureSettings;
631632
public org.w3c.css.properties.css.fontface.CssFontVariationSettings fontFaceCssFontVariationSettings;
633+
public CssSizeAdjust fontFaceCssSizeAdjust;
632634

633635
public CssColorAdjust cssColorAdjust;
634636
public CssForcedColorAdjust cssForcedColorAdjust;
@@ -1693,6 +1695,15 @@ public CssFontNamedInstance getFontFaceCssFontNamedInstance() {
16931695
return fontFaceCssFontNamedInstance;
16941696
}
16951697

1698+
public CssSizeAdjust getFontFaceCssSizeAdjust() {
1699+
if (fontFaceCssSizeAdjust == null) {
1700+
fontFaceCssSizeAdjust =
1701+
(CssSizeAdjust) style.CascadingOrder(new CssSizeAdjust(),
1702+
style, selector);
1703+
}
1704+
return fontFaceCssSizeAdjust;
1705+
}
1706+
16961707
public CssFontDisplay getFontFaceCssFontDisplay() {
16971708
if (fontFaceCssFontDisplay == null) {
16981709
fontFaceCssFontDisplay =
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//
2+
// Author: Yves Lafon <ylafon@w3.org>
3+
//
4+
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2018.
5+
// Please first read the full copyright statement in file COPYRIGHT.html
6+
package org.w3c.css.properties.css3.fontface;
7+
8+
import org.w3c.css.util.ApplContext;
9+
import org.w3c.css.util.InvalidParamException;
10+
import org.w3c.css.values.CssExpression;
11+
import org.w3c.css.values.CssTypes;
12+
import org.w3c.css.values.CssValue;
13+
14+
/**
15+
* @spec https://www.w3.org/TR/2026/WD-css-fonts-5-20260303/#descdef-font-face-size-adjust
16+
*/
17+
public class CssSizeAdjust extends org.w3c.css.properties.css.fontface.CssSizeAdjust {
18+
19+
/**
20+
* Create a new CssSizeAdjust
21+
*/
22+
public CssSizeAdjust() {
23+
value = initial;
24+
}
25+
26+
/**
27+
* Creates a new CssSizeAdjust
28+
*
29+
* @param expression The expression for this property
30+
* @throws InvalidParamException Expressions are incorrect
31+
*/
32+
public CssSizeAdjust(ApplContext ac, CssExpression expression, boolean check)
33+
throws InvalidParamException {
34+
if (check && expression.getCount() > 1) {
35+
throw new InvalidParamException("unrecognize", ac);
36+
}
37+
38+
setByUser();
39+
40+
char op;
41+
CssValue val;
42+
43+
val = expression.getValue();
44+
op = expression.getOperator();
45+
46+
switch (val.getType()) {
47+
case CssTypes.CSS_PERCENTAGE:
48+
val.getCheckableValue().checkPositiveness(ac, this);
49+
value = val;
50+
break;
51+
default:
52+
throw new InvalidParamException("value",
53+
val.toString(),
54+
getPropertyName(), ac);
55+
}
56+
expression.next();
57+
}
58+
59+
public CssSizeAdjust(ApplContext ac, CssExpression expression)
60+
throws InvalidParamException {
61+
this(ac, expression, false);
62+
}
63+
64+
}
65+

0 commit comments

Comments
 (0)