Skip to content

Transform 2 #438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions org/w3c/css/properties/CSS3Properties.properties
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,12 @@ transform-style: org.w3c.css.properties.css3.CssTransform
backface-visibility: org.w3c.css.properties.css3.CssBackfaceVisibility
perspective: org.w3c.css.properties.css3.CssPerspective
perspective-origin: org.w3c.css.properties.css3.CssPerspectiveOrigin
rotate: org.w3c.css.properties.css3.CssRotate
scale: org.w3c.css.properties.css3.CssScale
transform-origin: org.w3c.css.properties.css3.CssTransformOrigin
transform-box: org.w3c.css.properties.css3.CssTransformBox
transform: org.w3c.css.properties.css3.CssTransform
translate: org.w3c.css.properties.css3.CssTranslate

# image
object-fit: org.w3c.css.properties.css3.CssObjectFit
Expand Down
113 changes: 113 additions & 0 deletions org/w3c/css/properties/css/CssRotate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
//
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT World Wide Web Consortium, 2025.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css3.Css3Style;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;

/**
* @since CSS3
*/
public class CssRotate extends CssProperty {

/**
* Create a new CssRotate
*/
public CssRotate() {
}

/**
* Creates a new CssRotate
*
* @param expression The expression for this property
* @throws InvalidParamException
* Expressions are incorrect
*/
public CssRotate(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
throw new InvalidParamException("value",
expression.getValue().toString(),
getPropertyName(), ac);
}

public CssRotate(ApplContext ac, CssExpression expression)
throws InvalidParamException {
this(ac, expression, false);
}

/**
* Returns the value of this property
*/
public Object get() {
return value;
}


/**
* Returns the name of this property
*/
public final String getPropertyName() {
return "rotate";
}

/**
* Returns true if this property is "softly" inherited
* e.g. his value is equals to inherit
*/
public boolean isSoftlyInherited() {
return value.equals(inherit);
}

/**
* Returns a string representation of the object.
*/
public String toString() {
return value.toString();
}

/**
* Add this property to the CssStyle.
*
* @param style The CssStyle
*/
public void addToStyle(ApplContext ac, CssStyle style) {
Css3Style s = (Css3Style) style;
if (s.cssRotate != null) {
style.addRedefinitionWarning(ac, this);
}
s.cssRotate = this;
}


/**
* Compares two properties for equality.
*
* @param property The other property.
*/
public boolean equals(CssProperty property) {
return (property instanceof CssRotate &&
value.equals(((CssRotate) property).value));
}


/**
* Get this property in the style.
*
* @param style The style where the property is
* @param resolve if true, resolve the style to find this property
*/
public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
if (resolve) {
return ((Css3Style) style).getRotate();
} else {
return ((Css3Style) style).cssRotate;
}
}
}

113 changes: 113 additions & 0 deletions org/w3c/css/properties/css/CssScale.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
//
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT World Wide Web Consortium, 2025.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css3.Css3Style;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;

/**
* @since CSS3
*/
public class CssScale extends CssProperty {

/**
* Create a new CssScale
*/
public CssScale() {
}

/**
* Creates a new CssScale
*
* @param expression The expression for this property
* @throws InvalidParamException
* Expressions are incorrect
*/
public CssScale(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
throw new InvalidParamException("value",
expression.getValue().toString(),
getPropertyName(), ac);
}

public CssScale(ApplContext ac, CssExpression expression)
throws InvalidParamException {
this(ac, expression, false);
}

/**
* Returns the value of this property
*/
public Object get() {
return value;
}


/**
* Returns the name of this property
*/
public final String getPropertyName() {
return "scale";
}

/**
* Returns true if this property is "softly" inherited
* e.g. his value is equals to inherit
*/
public boolean isSoftlyInherited() {
return value.equals(inherit);
}

/**
* Returns a string representation of the object.
*/
public String toString() {
return value.toString();
}

/**
* Add this property to the CssStyle.
*
* @param style The CssStyle
*/
public void addToStyle(ApplContext ac, CssStyle style) {
Css3Style s = (Css3Style) style;
if (s.cssScale != null) {
style.addRedefinitionWarning(ac, this);
}
s.cssScale = this;
}


/**
* Compares two properties for equality.
*
* @param property The other property.
*/
public boolean equals(CssProperty property) {
return (property instanceof CssScale &&
value.equals(((CssScale) property).value));
}


/**
* Get this property in the style.
*
* @param style The style where the property is
* @param resolve if true, resolve the style to find this property
*/
public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
if (resolve) {
return ((Css3Style) style).getScale();
} else {
return ((Css3Style) style).cssScale;
}
}
}

113 changes: 113 additions & 0 deletions org/w3c/css/properties/css/CssTranslate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
//
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT World Wide Web Consortium, 2025.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css3.Css3Style;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;

/**
* @since CSS3
*/
public class CssTranslate extends CssProperty {

/**
* Create a new CssTranslate
*/
public CssTranslate() {
}

/**
* Creates a new CssTranslate
*
* @param expression The expression for this property
* @throws InvalidParamException
* Expressions are incorrect
*/
public CssTranslate(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
throw new InvalidParamException("value",
expression.getValue().toString(),
getPropertyName(), ac);
}

public CssTranslate(ApplContext ac, CssExpression expression)
throws InvalidParamException {
this(ac, expression, false);
}

/**
* Returns the value of this property
*/
public Object get() {
return value;
}


/**
* Returns the name of this property
*/
public final String getPropertyName() {
return "translate";
}

/**
* Returns true if this property is "softly" inherited
* e.g. his value is equals to inherit
*/
public boolean isSoftlyInherited() {
return value.equals(inherit);
}

/**
* Returns a string representation of the object.
*/
public String toString() {
return value.toString();
}

/**
* Add this property to the CssStyle.
*
* @param style The CssStyle
*/
public void addToStyle(ApplContext ac, CssStyle style) {
Css3Style s = (Css3Style) style;
if (s.cssTranslate != null) {
style.addRedefinitionWarning(ac, this);
}
s.cssTranslate = this;
}


/**
* Compares two properties for equality.
*
* @param property The other property.
*/
public boolean equals(CssProperty property) {
return (property instanceof CssTranslate &&
value.equals(((CssTranslate) property).value));
}


/**
* Get this property in the style.
*
* @param style The style where the property is
* @param resolve if true, resolve the style to find this property
*/
public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
if (resolve) {
return ((Css3Style) style).getTranslate();
} else {
return ((Css3Style) style).cssTranslate;
}
}
}

Loading