Skip to content

Commit 44e734d

Browse files
authored
Merge pull request #438 from w3c/transform-2
Transform 2
2 parents 94d9c0b + 03198dd commit 44e734d

13 files changed

+811
-7
lines changed

org/w3c/css/properties/CSS3Properties.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,12 @@ transform-style: org.w3c.css.properties.css3.CssTransform
294294
backface-visibility: org.w3c.css.properties.css3.CssBackfaceVisibility
295295
perspective: org.w3c.css.properties.css3.CssPerspective
296296
perspective-origin: org.w3c.css.properties.css3.CssPerspectiveOrigin
297+
rotate: org.w3c.css.properties.css3.CssRotate
298+
scale: org.w3c.css.properties.css3.CssScale
297299
transform-origin: org.w3c.css.properties.css3.CssTransformOrigin
298300
transform-box: org.w3c.css.properties.css3.CssTransformBox
299301
transform: org.w3c.css.properties.css3.CssTransform
302+
translate: org.w3c.css.properties.css3.CssTranslate
300303

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

0 commit comments

Comments
 (0)