- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 27 Sep 2011 08:15:48 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css3
In directory hutz:/tmp/cvs-serv13381/org/w3c/css/properties/css3
Modified Files:
Css3Style.java
Added Files:
CssHeight.java CssWidth.java
Removed Files:
CssHeightCSS3.java CssWidthCSS3.java
Log Message:
width and height, including css3 value initial
--- CssHeightCSS3.java DELETED ---
--- NEW FILE: CssHeight.java ---
// $Id: CssHeight.java,v 1.1 2011/09/27 08:15:46 ylafon Exp $
//
// (c) COPYRIGHT MIT, ERCIM and Keio University
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css3;
import org.w3c.css.properties.css.CssProperty;
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.CssLength;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssPercentage;
import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;
/**
* @version $Revision: 1.1 $
* @spec http://www.w3.org/TR/2007/WD-css3-box-20070809/#height
*/
public class CssHeight extends org.w3c.css.properties.css.CssHeight {
CssLength lenVal;
CssPercentage perVal;
CssIdent identVal;
/**
* Create a new CssHeight
*/
public CssHeight() {
}
/**
* Create a new CssHeight.
*
* @param expression The expression for this property
* @throws org.w3c.css.util.InvalidParamException Values are incorrect
*/
public CssHeight(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
if (check && expression.getCount() > 1) {
throw new InvalidParamException("unrecognize", ac);
}
CssValue val = expression.getValue();
setByUser();
switch (val.getType()) {
case CssTypes.CSS_IDENT:
CssIdent ident = (CssIdent) val;
if (inherit.equals(val)) {
identVal = inherit;
} else if (initial.equals(val)) {
identVal = initial;
} else if (auto.equals(val)) {
identVal = auto;
} else {
throw new InvalidParamException("unrecognize", ac);
}
break;
case CssTypes.CSS_NUMBER:
val = ((CssNumber) val).getLength();
case CssTypes.CSS_LENGTH:
lenVal = (CssLength) val;
if (lenVal.floatValue() < 0.) {
throw new InvalidParamException("negative-value",
val.toString(), ac);
}
break;
case CssTypes.CSS_PERCENTAGE:
perVal = (CssPercentage) val;
if (perVal.floatValue() < 0.) {
throw new InvalidParamException("negative-value",
val.toString(), ac);
}
break;
default:
throw new InvalidParamException("value", val, getPropertyName(), ac);
}
expression.next();
}
public CssHeight(ApplContext ac, CssExpression expression)
throws InvalidParamException {
this(ac, expression, false);
}
/**
* Returns the value of this property.
*/
public Object get() {
if (identVal != null) {
return identVal;
}
if (perVal != null) {
return perVal;
}
return lenVal;
}
/**
* Returns true if this property is "softly" inherited
* e.g. his value equals inherit
*/
public boolean isSoftlyInherited() {
return identVal == inherit;
}
/**
* Returns a string representation of the object.
*/
public String toString() {
if (identVal != null) {
return identVal.toString();
}
if (perVal != null) {
return perVal.toString();
}
if (lenVal != null) {
return lenVal.toString();
}
// the default
return auto.toString();
}
/**
* Compares two properties for equality.
*
* @param property The other property.
*/
public boolean equals(CssProperty property) {
try {
CssHeight h = (CssHeight) property;
return (identVal == h.identVal) &&
((perVal == null && h.perVal == null) ||
(perVal != null && perVal.equals(h.perVal))) &&
((lenVal == null && h.lenVal == null) ||
(lenVal != null && lenVal.equals(h.lenVal)));
} catch (ClassCastException ex) {
return false;
}
}
/**
* Is the value of this property is a default value.
* It is used by all macro for the function <code>print</code>
*/
public boolean isDefault() {
return ((identVal == auto) || (identVal == initial));
}
}
--- CssWidthCSS3.java DELETED ---
--- NEW FILE: CssWidth.java ---
// $Id: CssWidth.java,v 1.1 2011/09/27 08:15:46 ylafon Exp $
//
// (c) COPYRIGHT MIT, ERCIM and Keio University
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css3;
import org.w3c.css.properties.css.CssProperty;
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.CssLength;
import org.w3c.css.values.CssNumber;
import org.w3c.css.values.CssPercentage;
import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;
/**
* @version $Revision: 1.1 $
* @spec http://www.w3.org/TR/2007/WD-css3-box-20070809/#width
*/
public class CssWidth extends org.w3c.css.properties.css.CssWidth {
CssLength lenVal;
CssPercentage perVal;
CssIdent identVal;
/**
* Create a new CssWidth
*/
public CssWidth() {
}
/**
* Create a new CssWidth.
*
* @param expression The expression for this property
* @throws org.w3c.css.util.InvalidParamException Values are incorrect
*/
public CssWidth(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
if (check && expression.getCount() > 1) {
throw new InvalidParamException("unrecognize", ac);
}
CssValue val = expression.getValue();
setByUser();
switch (val.getType()) {
case CssTypes.CSS_IDENT:
CssIdent ident = (CssIdent) val;
if (inherit.equals(val)) {
identVal = inherit;
} else if (initial.equals(val)) {
identVal = initial;
} else if (auto.equals(val)) {
identVal = auto;
} else {
throw new InvalidParamException("unrecognize", ac);
}
break;
case CssTypes.CSS_NUMBER:
val = ((CssNumber) val).getLength();
case CssTypes.CSS_LENGTH:
lenVal = (CssLength) val;
if (lenVal.floatValue() < 0.) {
throw new InvalidParamException("negative-value",
val.toString(), ac);
}
break;
case CssTypes.CSS_PERCENTAGE:
perVal = (CssPercentage) val;
if (perVal.floatValue() < 0.) {
throw new InvalidParamException("negative-value",
val.toString(), ac);
}
break;
default:
throw new InvalidParamException("value", val, getPropertyName(), ac);
}
expression.next();
}
public CssWidth(ApplContext ac, CssExpression expression)
throws InvalidParamException {
this(ac, expression, false);
}
/**
* Returns the value of this property.
*/
public Object get() {
if (identVal != null) {
return identVal;
}
if (perVal != null) {
return perVal;
}
return lenVal;
}
/**
* Returns true if this property is "softly" inherited
* e.g. his value equals inherit
*/
public boolean isSoftlyInherited() {
return identVal == inherit;
}
/**
* Returns a string representation of the object.
*/
public String toString() {
if (identVal != null) {
return identVal.toString();
}
if (perVal != null) {
return perVal.toString();
}
if (lenVal != null) {
return lenVal.toString();
}
// the default
return auto.toString();
}
/**
* Compares two properties for equality.
*
* @param property The other property.
*/
public boolean equals(CssProperty property) {
try {
CssWidth w = (CssWidth) property;
return (identVal == w.identVal) &&
((perVal == null && w.perVal == null) ||
(perVal != null && perVal.equals(w.perVal))) &&
((lenVal == null && w.lenVal == null) ||
(lenVal != null && lenVal.equals(w.lenVal)));
} catch (ClassCastException ex) {
return false;
}
}
/**
* Is the value of this property is a default value.
* It is used by all macro for the function <code>print</code>
*/
public boolean isDefault() {
return ((identVal == auto) || (identVal == initial));
}
}
Index: Css3Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css3/Css3Style.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Css3Style.java 9 Sep 2011 12:16:45 -0000 1.11
+++ Css3Style.java 27 Sep 2011 08:15:46 -0000 1.12
@@ -185,8 +185,6 @@
CssPaddingTopCSS3 cssPaddingTopCSS3;
CssPaddingLeftCSS3 cssPaddingLeftCSS3;
CssPaddingRightCSS3 cssPaddingRightCSS3;
- CssHeightCSS3 cssHeightCSS3;
- CssWidthCSS3 cssWidthCSS3;
CssMarquee cssMarquee;
CssMarqueeDirection cssMarqueeDirection;
CssMarqueeRepetition cssMarqueeRepetition;
@@ -1604,24 +1602,6 @@
return cssPaddingRightCSS3;
}
- public CssHeightCSS3 getHeightCSS3() {
- if (cssHeightCSS3 == null) {
- cssHeightCSS3 =
- (CssHeightCSS3) style.CascadingOrder(
- new CssHeightCSS3(), style, selector);
- }
- return cssHeightCSS3;
- }
-
- public CssWidthCSS3 getWidthCSS3() {
- if (cssWidthCSS3 == null) {
- cssWidthCSS3 =
- (CssWidthCSS3) style.CascadingOrder(
- new CssWidthCSS3(), style, selector);
- }
- return cssWidthCSS3;
- }
-
public CssMarquee getMarquee() {
if (cssMarquee == null) {
cssMarquee =
Received on Tuesday, 27 September 2011 08:15:53 UTC