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

2002/css-validator/org/w3c/css/properties/css1 Css1Style.java,1.15,1.16

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 09 Mar 2009 21:14:54 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1LgmoI-0002Ej-2V@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/properties/css1
In directory hutz:/tmp/cvs-serv8372

Modified Files:
	Css1Style.java 
Log Message:
small fixes


Index: Css1Style.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/css1/Css1Style.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Css1Style.java	9 Mar 2009 13:02:01 -0000	1.15
+++ Css1Style.java	9 Mar 2009 21:14:51 -0000	1.16
@@ -2569,6 +2569,34 @@
 
     /**
      * Find conflicts in this Style
+     * For the float elements
+     *
+     * @param warnings For warnings reports.
+     * @param allSelectors All contexts is the entire style sheet.
+     */   
+    private void findConflictsFloatElements(ApplContext ac, Warnings warnings, 
+					    CssSelectors selector, 
+					    CssSelectors[] allSelectors) {
+	if(cssWidth == null ) {
+	    String selectorElement =  selector.getElement();
+	    // for null element, or element without intrinsic width
+	    if ( (selectorElement == null) ||
+		 ( !selectorElement.equals("html") &&
+		   !selectorElement.equals("img") && 
+		   !selectorElement.equals("input") &&
+		   !selectorElement.equals("object") && 
+		   !selectorElement.equals("textarea") && 
+		   !selectorElement.equals("select")
+		   ) ) {
+		// float needs a declared width
+		warnings.addWarning(new Warning(cssFloat, "float-no-width",
+						1, ac));                
+	    }
+	}
+    }
+
+    /**
+     * Find conflicts in this Style
      *
      * @param warnings For warnings reports.
      * @param allSelectors All contexts is the entire style sheet.
@@ -2582,33 +2610,20 @@
 	// check conflicts for 'font-family'
 	findConflictsFontFamily(ac, warnings, selector, allSelectors);
 
+	// warning for floats
 	if (cssFloat != null) {
-	    if(cssWidth == null ) {
-		String selectorElement =  selector.getElement();
-		// for null element, or element without intrinsic width
-		if ( (selectorElement == null) ||
-		     ( !selectorElement.equals("html") &&
-		       !selectorElement.equals("img") && 
-		       !selectorElement.equals("input") &&
-		       !selectorElement.equals("object") && 
-		       !selectorElement.equals("textarea") && 
-		       !selectorElement.equals("select")
-		       ) ) {
-		    // float needs a declared width
-		    warnings.addWarning(new Warning(cssFloat, "float-no-width",
-						    1, ac));                
-		}
-	    }
+	    findConflictsFloatElements(ac, warnings, selector, allSelectors);
 	}
 
 	if (cssBackground.getColor() != null) {
 	    CssColor colorCSS3 = cssColor;
 	    // we need to look if there is the same selector elsewhere
 	    // containing a color definition
-	    for (int i=0;(colorCSS3 == null) && (i<allSelectors.length); i++) {
+	    for (int i=0; i<allSelectors.length; i++) {
 		CssSelectors sel = allSelectors[i];	
 		if(sel.toString().equals(selector.toString())) {
 		    colorCSS3 = ((Css1Style) sel.getStyle()).cssColor;
+		    break;
 		}
 	    }
 	    if (colorCSS3 != null) {
@@ -2689,10 +2704,11 @@
 	    CssColorCSS1 colorCSS1 = cssColorCSS1;
 	    // we need to look if there is the same selector elsewhere
 	    // containing a color definition
-	    for (int i=0; (colorCSS1 == null) && i < allSelectors.length; i++) {
+	    for (int i=0; i < allSelectors.length; i++) {
 		CssSelectors sel = allSelectors[i];		
 		if(sel.toString().equals(selector.toString())) {
 		    colorCSS1 = ((Css1Style) sel.getStyle()).cssColorCSS1;
+		    break;
 		}
 	    }
 	    if (colorCSS1 != null) {
@@ -2761,10 +2777,11 @@
 	    CssColorCSS2 colorCSS2 = cssColorCSS2;
 	    // we need to look if there is the same selector elsewhere
 	    // containing a color definition
-	    for (int i=0; (colorCSS2 == null) && (i<allSelectors.length); i++) {
+	    for (int i=0; i<allSelectors.length; i++) {
 		CssSelectors sel = allSelectors[i];		
 		if(sel.toString().equals(selector.toString())) {
 		    colorCSS2 = ((Css1Style) sel.getStyle()).cssColorCSS2;
+		    break;
 		}
 	    }
 	    if (colorCSS2 != null) {
Received on Monday, 9 March 2009 21:15:03 UTC

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