W3C home > Mailing lists > Public > www-validator-cvs@w3.org > March 2009

2002/css-validator/org/w3c/css/values RGBA.java,1.5,1.6

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 05 Mar 2009 22:45:01 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1LfMJJ-00018z-EF@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/values
In directory hutz:/tmp/cvs-serv4361

Modified Files:
	RGBA.java 
Log Message:
better output


Index: RGBA.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/values/RGBA.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- RGBA.java	5 Mar 2009 18:00:21 -0000	1.5
+++ RGBA.java	5 Mar 2009 22:44:59 -0000	1.6
@@ -13,6 +13,8 @@
  */
 package org.w3c.css.values;
 
+import org.w3c.css.util.Util;
+
 public class RGBA {
     String output = null;
     int r,g,b;
@@ -36,6 +38,7 @@
 
     public final void setRed(int r) {
 	this.r = r;
+	this.fr = r;
     }
     public final void setRed(float fr) {
 	this.fr = fr;
@@ -43,13 +46,15 @@
 
     public final void setGreen(int g) {
 	this.g = g;
+	this.fg = g;
     }
-    public final void setGreen(float gr) {
+    public final void setGreen(float fg) {
 	this.fg = fg;
     }
 
     public final void setBlue(int b) {
 	this.b = b;
+	this.fb = b;
     }
     public final void setBlue(float fb) {
 	this.fb = fb;
@@ -116,15 +121,15 @@
 	if (output == null) {
 	    StringBuilder sb = new StringBuilder("rgba(");
 	    if (isPercent()) {
-		sb.append(fr).append("%, ");
-		sb.append(fg).append("%, ");
-		sb.append(fb).append("%, ");
+		sb.append(Util.displayFloat(fr)).append("%, ");
+		sb.append(Util.displayFloat(fg)).append("%, ");
+		sb.append(Util.displayFloat(fb)).append("%, ");
 	    } else {
 		sb.append(r).append(", ");
 		sb.append(g).append(", ");
 		sb.append(b).append(", ");
 	    }
-	    sb.append(a).append(')');
+	    sb.append(Util.displayFloat(a)).append(')');
 	    output = sb.toString();
 	} 
 	return output;
Received on Thursday, 5 March 2009 22:45:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:02:34 UTC