r9543 tlsa - in /trunk/netsurf: !NetSurf/Resources/CSS, f79 css/select.c

netsurf at semichrome.net netsurf at semichrome.net
Sat Sep 5 16:49:09 BST 2009


Author: tlsa
Date: Sat Sep  5 10:49:09 2009
New Revision: 9543

URL: http://source.netsurf-browser.org?rev=9543&view=rev
Log:
Fix defualt table cell border width and move border style from default css to code.

Modified:
    trunk/netsurf/!NetSurf/Resources/CSS,f79
    trunk/netsurf/css/select.c

Modified: trunk/netsurf/!NetSurf/Resources/CSS,f79
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/CSS%2Cf79?rev=9543&r1=9542&r2=9543&view=diff
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/CSS,f79 (original)
+++ trunk/netsurf/!NetSurf/Resources/CSS,f79 Sat Sep  5 10:49:09 2009
@@ -70,8 +70,7 @@
 
 table { display: table; border-spacing: 2px; }
 
-table[border] { border-style: outset; border-color: grey; }
-table[border] td, table[border] tr { border-style: inset; border-color: grey; }
+table[border], table[border] td, table[border] tr { border-color: grey; }
 
 caption { display: table-caption; }
 

Modified: trunk/netsurf/css/select.c
URL: http://source.netsurf-browser.org/trunk/netsurf/css/select.c?rev=9543&r1=9542&r2=9543&view=diff
==============================================================================
--- trunk/netsurf/css/select.c (original)
+++ trunk/netsurf/css/select.c Sat Sep  5 10:49:09 2009
@@ -17,6 +17,7 @@
  */
 
 #include <assert.h>
+#include <stdbool.h>
 #include <string.h>
 #include <strings.h>
 
@@ -444,8 +445,8 @@
  * \return CSS_OK on success,
  *         CSS_NOMEM on memory exhaustion.
  *
- * \note The returned array will be destroyed by libcss. Therefore, it must 
- *       be allocated using the same allocator as used by libcss during style 
+ * \note The returned array will be destroyed by libcss. Therefore, it must
+ *       be allocated using the same allocator as used by libcss during style
  *       selection.
  */
 css_error node_classes(void *pw, void *node,
@@ -497,7 +498,7 @@
 		}
 		result = temp;
 
-		lerror = lwc_context_intern(dict, start, p - start, 
+		lerror = lwc_context_intern(dict, start, p - start,
 				&result[items]);
 		switch (lerror) {
 		case lwc_error_oom:
@@ -920,7 +921,7 @@
 {
 	xmlNode *n = node;
 	xmlAttr *attr;
-	
+
 	attr = xmlHasProp(n, (const xmlChar *) lwc_string_data(name));
 	*match = attr != NULL;
 
@@ -1099,7 +1100,7 @@
 }
 
 /**
- * Callback to determine if a node is a linking element whose target has been 
+ * Callback to determine if a node is a linking element whose target has been
  * visited.
  *
  * \param pw     HTML document
@@ -1296,7 +1297,7 @@
 		if (bgcol == NULL)
 			return CSS_PROPERTY_NOT_SET;
 
-		if (nscss_parse_colour((const char *) bgcol, 
+		if (nscss_parse_colour((const char *) bgcol,
 				&hint->data.color)) {
 			hint->status = CSS_BACKGROUND_COLOR_COLOR;
 		} else {
@@ -1549,8 +1550,11 @@
 			property == CSS_PROP_BORDER_RIGHT_STYLE ||
 			property == CSS_PROP_BORDER_BOTTOM_STYLE ||
 			property == CSS_PROP_BORDER_LEFT_STYLE) {
+		bool is_table_cell = false;
+
 		if (strcmp((const char *) n->name, "td") == 0 ||
 				strcmp((const char *) n->name, "th") == 0) {
+			is_table_cell = true;
 			/* Find table */
 			for (n = n->parent; n != NULL &&
 					n->type == XML_ELEMENT_NODE;
@@ -1567,7 +1571,10 @@
 		if (strcmp((const char *) n->name, "table") == 0 &&
 				xmlHasProp(n,
 				(const xmlChar *) "border") != NULL) {
-			hint->status = CSS_BORDER_STYLE_OUTSET;
+			if (is_table_cell)
+				hint->status = CSS_BORDER_STYLE_INSET;
+			else
+				hint->status = CSS_BORDER_STYLE_OUTSET;
 			return CSS_OK;
 		}
 	} else if (property == CSS_PROP_BORDER_TOP_WIDTH ||
@@ -1575,9 +1582,11 @@
 			property == CSS_PROP_BORDER_BOTTOM_WIDTH ||
 			property == CSS_PROP_BORDER_LEFT_WIDTH) {
 		xmlChar *width;
+		bool is_table_cell = false;
 
 		if (strcmp((const char *) n->name, "td") == 0 ||
 				strcmp((const char *) n->name, "th") == 0) {
+			is_table_cell = true;
 			/* Find table */
 			for (n = n->parent; n != NULL &&
 					n->type == XML_ELEMENT_NODE;
@@ -1599,7 +1608,11 @@
 		if (width == NULL)
 			return CSS_PROPERTY_NOT_SET;
 
-		if (parse_dimension((const char *) width, false,
+		if (is_table_cell) {
+			hint->data.length.value = INTTOFIX(1);
+			hint->data.length.unit = CSS_UNIT_PX;
+			hint->status = CSS_BORDER_WIDTH_WIDTH;
+		} else if (parse_dimension((const char *) width, false,
 				&hint->data.length.value,
 				&hint->data.length.unit)) {
 			hint->status = CSS_BORDER_WIDTH_WIDTH;
@@ -1667,11 +1680,11 @@
 				return CSS_PROPERTY_NOT_SET;
 
 			if (strcasecmp((const char *) align, "center") == 0 ||
-					strcasecmp((const char *) align, 
+					strcasecmp((const char *) align,
 							"abscenter") == 0 ||
-					strcasecmp((const char *) align, 
+					strcasecmp((const char *) align,
 							"middle") == 0 ||
-					strcasecmp((const char *) align, 
+					strcasecmp((const char *) align,
 							"absmiddle") == 0) {
 				hint->status = CSS_MARGIN_AUTO;
 			} else {
@@ -1696,10 +1709,10 @@
 				} else {
 					hint->status = CSS_MARGIN_AUTO;
 				}
-			} else if (strcasecmp((const char *) align, 
+			} else if (strcasecmp((const char *) align,
 					"center") == 0) {
 				hint->status = CSS_MARGIN_AUTO;
-			} else if (strcasecmp((const char *) align, 
+			} else if (strcasecmp((const char *) align,
 					"right") == 0) {
 				if (property == CSS_PROP_MARGIN_RIGHT) {
 					hint->data.length.value = 0;
@@ -1771,13 +1784,13 @@
 
 			if (strcasecmp((const char *) align, "left") == 0) {
 				hint->status = CSS_TEXT_ALIGN_LEFT;
-			} else if (strcasecmp((const char *) align, 
+			} else if (strcasecmp((const char *) align,
 					"center") == 0) {
 				hint->status = CSS_TEXT_ALIGN_CENTER;
-			} else if (strcasecmp((const char *) align, 
+			} else if (strcasecmp((const char *) align,
 					"right") == 0) {
 				hint->status = CSS_TEXT_ALIGN_RIGHT;
-			} else if (strcasecmp((const char *) align, 
+			} else if (strcasecmp((const char *) align,
 					"justify") == 0) {
 				hint->status = CSS_TEXT_ALIGN_JUSTIFY;
 			} else {
@@ -1795,16 +1808,16 @@
 		} else if (strcmp((const char *) n->name, "caption") == 0) {
 			align = xmlGetProp(n, (const xmlChar *) "align");
 
-			if (align == NULL || strcasecmp((const char *) align, 
+			if (align == NULL || strcasecmp((const char *) align,
 					"center") == 0) {
 				hint->status = CSS_TEXT_ALIGN_LIBCSS_CENTER;
-			} else if (strcasecmp((const char *) align, 
+			} else if (strcasecmp((const char *) align,
 					"left") == 0) {
 				hint->status = CSS_TEXT_ALIGN_LIBCSS_LEFT;
-			} else if (strcasecmp((const char *) align, 
+			} else if (strcasecmp((const char *) align,
 					"right") == 0) {
 				hint->status = CSS_TEXT_ALIGN_LIBCSS_RIGHT;
-			} else if (strcasecmp((const char *) align, 
+			} else if (strcasecmp((const char *) align,
 					"justify") == 0) {
 				hint->status = CSS_TEXT_ALIGN_JUSTIFY;
 			} else {
@@ -1830,13 +1843,13 @@
 
 			if (strcasecmp((const char *) align, "center") == 0) {
 				hint->status = CSS_TEXT_ALIGN_LIBCSS_CENTER;
-			} else if (strcasecmp((const char *) align, 
+			} else if (strcasecmp((const char *) align,
 					"left") == 0) {
 				hint->status = CSS_TEXT_ALIGN_LIBCSS_LEFT;
-			} else if (strcasecmp((const char *) align, 
+			} else if (strcasecmp((const char *) align,
 					"right") == 0) {
 				hint->status = CSS_TEXT_ALIGN_LIBCSS_RIGHT;
-			} else if (strcasecmp((const char *) align, 
+			} else if (strcasecmp((const char *) align,
 					"justify") == 0) {
 				hint->status = CSS_TEXT_ALIGN_JUSTIFY;
 			} else {
@@ -1872,13 +1885,13 @@
 
 			if (strcasecmp((const char *) valign, "top") == 0) {
 				hint->status = CSS_VERTICAL_ALIGN_TOP;
-			} else if (strcasecmp((const char *) valign, 
+			} else if (strcasecmp((const char *) valign,
 					"middle") == 0) {
 				hint->status = CSS_VERTICAL_ALIGN_MIDDLE;
-			} else if (strcasecmp((const char *) valign, 
+			} else if (strcasecmp((const char *) valign,
 					"bottom") == 0) {
 				hint->status = CSS_VERTICAL_ALIGN_BOTTOM;
-			} else if (strcasecmp((const char *) valign, 
+			} else if (strcasecmp((const char *) valign,
 					"baseline") == 0) {
 				hint->status = CSS_VERTICAL_ALIGN_BASELINE;
 			} else {
@@ -1902,12 +1915,12 @@
 
 			if (strcasecmp((const char *) valign, "top") == 0) {
 				hint->status = CSS_VERTICAL_ALIGN_TOP;
-			} else if (strcasecmp((const char *) valign, 
-					"bottom") == 0 || 
-					strcasecmp((const char *) valign, 
+			} else if (strcasecmp((const char *) valign,
+					"bottom") == 0 ||
+					strcasecmp((const char *) valign,
 					"baseline") == 0) {
 				hint->status = CSS_VERTICAL_ALIGN_BASELINE;
-			} else if (strcasecmp((const char *) valign, 
+			} else if (strcasecmp((const char *) valign,
 					"texttop") == 0) {
 				hint->status = CSS_VERTICAL_ALIGN_TEXT_TOP;
 			} else if (strcasecmp((const char *) valign,
@@ -1990,8 +2003,8 @@
  *
  * \param a  Name to match
  * \param b  Colour map entry to consider
- * \return 0   on match, 
- *         < 0 if a < b, 
+ * \return 0   on match,
+ *         < 0 if a < b,
  *         > 0 if b > a.
  */
 int cmp_colour_name(const void *a, const void *b)
@@ -2217,7 +2230,7 @@
  * \param maybe_negative  Negative numbers permitted
  * \param real            Floating point numbers permitted
  * \param value           Pointer to location to receive numeric value
- * \param consumed        Pointer to location to receive number of input 
+ * \param consumed        Pointer to location to receive number of input
  *                        bytes consumed
  * \return true on success, false on invalid input
  */




More information about the netsurf-commits mailing list