[PATCH] cssparser.cpp, move towards more CSS1 compliance

Alex Zepeda zipzippy at sonic.net
Mon Oct 14 10:11:34 BST 2002


See:
http://www.w3.org/Style/CSS/Test/CSS1/current/sec71.htm

Find:
The text of this paragraph should be normal (that is, it should not be 
underlined, overlined, stricken, or bold), because diagonal is not a valid 
keyword, making the text-decoration invalid. In addition, highlighted is 
not a valid part of the font property, making it invalid. Therefore, this 
paragraph's font should be the UA default, and match the next paragraph. 
If this is not the case, then the font declaration is being improperly 
parsed. 


The text of this paragraph should be normal (that is, it should not be 
underlined, overlined, stricken, or bold), because diagonal is not a valid 
keyword, making the text-decoration invalid. In addition, highlighted is 
not a valid part of the font property, making it invalid. Therefore, this 
paragraph's font should be the UA default, and match the previous 
paragraph. If this is not the case, then the font declaration is being 
improperly parsed. 

Note the text is all of the above.  This patch elminiates the text
decoration bug, but I'm still staring at the font parser to fix that one.

Index: cssparser.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/css/cssparser.cpp,v
retrieving revision 1.224
diff -b -d -u -1 -r1.224 cssparser.cpp
--- cssparser.cpp	2002/10/01 13:27:38	1.224
+++ cssparser.cpp	2002/10/14 09:06:40
@@ -1880,2 +1880,3 @@
 	{
+	    bool is_valid = true;
 	    if (cssval && cssval->id == CSS_VAL_NONE) {
@@ -1895,5 +1896,20 @@
 							     decoration.length());
+		  //cerr << "KEYWORD: " << decoration.lower().left(decoration.length()).latin1() << endl;
 		  if (cssval) {
+		    switch (cssval->id) {
+			case CSS_VAL_NONE:
+			case CSS_VAL_UNDERLINE:
+			case CSS_VAL_OVERLINE:
+			case CSS_VAL_LINE_THROUGH:
+			case CSS_VAL_BLINK:
+			case CSS_VAL_INHERIT:
 		    list->append(new CSSPrimitiveValueImpl(cssval->id));
+			  break;
+			default:
+			  list->append(new CSSPrimitiveValueImpl(cssval->id));
+			  is_valid = false;
 		  }
+		  } else {
+		    is_valid = false;
+		  }
 		  pos = pos2 + 1;
@@ -1902,3 +1918,3 @@
 	      //kdDebug( 6080 ) << "got " << list->length() << "d decorations" << endl;
-	      if(list->length()) {
+	      if(list->length() && is_valid) {
                 parsedValue = list;




More information about the kfm-devel mailing list