Skip to content

Commit 591ce2a

Browse files
committed
added zoom per... editor's copy dated 2025-12-15 of https://drafts.csswg.org/css-viewport/
removed 'zoom' from the non-std properties added in 4be52de
1 parent d58bdf8 commit 591ce2a

File tree

5 files changed

+203
-6
lines changed

5 files changed

+203
-6
lines changed

org/w3c/css/parser/CssPropertyFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
public class CssPropertyFactory implements Cloneable {
3737

3838
private static final String[] NONSTANDARD_PROPERTIES = //
39-
{"zoom"};
39+
{ };
4040

4141
private static boolean isNonstandardProperty(String property) {
4242
if (property.charAt(0) == '-' || property.charAt(0) == '_') {

org/w3c/css/properties/CSS3Properties.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,8 @@ flood-color: org.w3c.css.properties.css3.CssFloodColo
533533
flood-opacity: org.w3c.css.properties.css3.CssFloodOpacity
534534
lighting-color: org.w3c.css.properties.css3.CssLightingColor
535535

536+
zoom: org.w3c.css.properties.css3.CssZoom
537+
536538
@font-face.ascent-override: org.w3c.css.properties.css3.fontface.CssAscentOverride
537539
@font-face.descent-override: org.w3c.css.properties.css3.fontface.CssDescentOverride
538540
@font-face.font-display: org.w3c.css.properties.css3.fontface.CssFontDisplay
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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+
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 CssZoom extends CssProperty {
18+
19+
20+
/**
21+
* Create a new CssZoom
22+
*/
23+
public CssZoom() {
24+
}
25+
26+
/**
27+
* Creates a new CssZoom
28+
*
29+
* @param expression The expression for this property
30+
* @throws InvalidParamException
31+
* Expressions are incorrect
32+
*/
33+
public CssZoom(ApplContext ac, CssExpression expression, boolean check)
34+
throws InvalidParamException {
35+
throw new InvalidParamException("value",
36+
expression.getValue().toString(),
37+
getPropertyName(), ac);
38+
}
39+
40+
public CssZoom(ApplContext ac, CssExpression expression)
41+
throws InvalidParamException {
42+
this(ac, expression, false);
43+
}
44+
45+
/**
46+
* Returns the value of this property
47+
*/
48+
public Object get() {
49+
return value;
50+
}
51+
52+
53+
/**
54+
* Returns the name of this property
55+
*/
56+
public final String getPropertyName() {
57+
return "zoom";
58+
}
59+
60+
/**
61+
* Returns true if this property is "softly" inherited
62+
* e.g. his value is equals to inherit
63+
*/
64+
public boolean isSoftlyInherited() {
65+
return inherit.equals(value);
66+
}
67+
68+
/**
69+
* Returns a string representation of the object.
70+
*/
71+
public String toString() {
72+
return value.toString();
73+
}
74+
75+
/**
76+
* Add this property to the CssStyle.
77+
*
78+
* @param style The CssStyle
79+
*/
80+
public void addToStyle(ApplContext ac, CssStyle style) {
81+
if (((Css3Style) style).cssZoom != null)
82+
style.addRedefinitionWarning(ac, this);
83+
((Css3Style) style).cssZoom = this;
84+
}
85+
86+
/**
87+
* Compares two properties for equality.
88+
*
89+
* @param property The other property.
90+
*/
91+
public boolean equals(CssProperty property) {
92+
return (property instanceof CssZoom &&
93+
value.equals(((CssZoom) property).value));
94+
}
95+
96+
97+
/**
98+
* Get this property in the style.
99+
*
100+
* @param style The style where the property is
101+
* @param resolve if true, resolve the style to find this property
102+
*/
103+
public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
104+
if (resolve) {
105+
return ((Css3Style) style).getZoom();
106+
} else {
107+
return ((Css3Style) style).cssZoom;
108+
}
109+
}
110+
}
111+

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,16 @@ public class Css3Style extends ATSCStyle {
747747
public CssTextSpacing cssTextSpacing;
748748
public CssTranslate cssTranslate;
749749
public CssRotate cssRotate;
750+
public org.w3c.css.properties.css.CssZoom cssZoom;
751+
752+
public org.w3c.css.properties.css.CssZoom getZoom() {
753+
if (cssZoom == null) {
754+
cssZoom =
755+
(org.w3c.css.properties.css.CssZoom) style.CascadingOrder(new CssZoom(),
756+
style, selector);
757+
}
758+
return cssZoom;
759+
}
750760

751761
public CssRotate getRotate() {
752762
if (cssRotate == null) {
@@ -765,7 +775,7 @@ public CssTranslate getTranslate() {
765775
}
766776
return cssTranslate;
767777
}
768-
778+
769779
public CssScale getScale() {
770780
if (cssScale == null) {
771781
cssScale =
@@ -774,7 +784,7 @@ public CssScale getScale() {
774784
}
775785
return cssScale;
776786
}
777-
787+
778788
public CssTextSpacing getTextSpacing() {
779789
if (cssTextSpacing == null) {
780790
cssTextSpacing =
@@ -792,7 +802,7 @@ public CssTextSpacingTrim getTextSpacingTrim() {
792802
}
793803
return cssTextSpacingTrim;
794804
}
795-
805+
796806
public CssTextAutospace getTextAutospace() {
797807
if (cssTextAutospace == null) {
798808
cssTextAutospace =
@@ -801,7 +811,7 @@ public CssTextAutospace getTextAutospace() {
801811
}
802812
return cssTextAutospace;
803813
}
804-
814+
805815
public CssLinePadding getLinePadding() {
806816
if (cssLinePadding == null) {
807817
cssLinePadding =
@@ -810,7 +820,7 @@ public CssLinePadding getLinePadding() {
810820
}
811821
return cssLinePadding;
812822
}
813-
823+
814824
public CssTextGroupAlign getTextGroupAlign() {
815825
if (cssTextGroupAlign == null) {
816826
cssTextGroupAlign =
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
package org.w3c.css.properties.css3;
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.CssIdent;
12+
import org.w3c.css.values.CssTypes;
13+
import org.w3c.css.values.CssValue;
14+
15+
/**
16+
* @spec https://drafts.csswg.org/css-viewport/#zoom-property dated 2025-12-15
17+
*/
18+
public class CssZoom extends org.w3c.css.properties.css.CssZoom {
19+
20+
/**
21+
* Create a new CssZoom
22+
*/
23+
public CssZoom() {
24+
value = initial;
25+
}
26+
27+
/**
28+
* Creates a new CssZoom
29+
*
30+
* @param expression The expression for this property
31+
* @throws InvalidParamException Expressions are incorrect
32+
*/
33+
public CssZoom(ApplContext ac, CssExpression expression, boolean check)
34+
throws InvalidParamException {
35+
setByUser();
36+
if (check && expression.getCount() > 1) {
37+
throw new InvalidParamException("unrecognize", ac);
38+
}
39+
setByUser();
40+
41+
CssValue val;
42+
char op;
43+
44+
val = expression.getValue();
45+
op = expression.getOperator();
46+
47+
switch (val.getType()) {
48+
case CssTypes.CSS_NUMBER:
49+
case CssTypes.CSS_PERCENTAGE:
50+
val.getCheckableValue().checkPositiveness(ac, this);
51+
value = val;
52+
break;
53+
case CssTypes.CSS_IDENT:
54+
// TODO handle 'normal' and 'reset' per https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/zoom#values
55+
// deprecated? warning? error with specific message?
56+
if (CssIdent.isCssWide(val.getIdent())) {
57+
value = val;
58+
}
59+
break;
60+
default:
61+
throw new InvalidParamException("value", expression.getValue(),
62+
getPropertyName(), ac);
63+
}
64+
expression.next();
65+
}
66+
67+
public CssZoom(ApplContext ac, CssExpression expression)
68+
throws InvalidParamException {
69+
this(ac, expression, false);
70+
}
71+
72+
73+
}
74+

0 commit comments

Comments
 (0)