r13633 dsilvers - in /trunk/libdom: bindings/hubbub/parser.c include/dom/core/document.h include/dom/html/html_document.h src/core/document.c src/core/document.h src/html/html_document.c src/html/html_document.h

netsurf at semichrome.net netsurf at semichrome.net
Sat Mar 24 22:16:06 GMT 2012


Author: dsilvers
Date: Sat Mar 24 17:16:06 2012
New Revision: 13633

URL: http://source.netsurf-browser.org?rev=13633&view=rev
Log:
Migrate quirks from html_document to document

Modified:
    trunk/libdom/bindings/hubbub/parser.c
    trunk/libdom/include/dom/core/document.h
    trunk/libdom/include/dom/html/html_document.h
    trunk/libdom/src/core/document.c
    trunk/libdom/src/core/document.h
    trunk/libdom/src/html/html_document.c
    trunk/libdom/src/html/html_document.h

Modified: trunk/libdom/bindings/hubbub/parser.c
URL: http://source.netsurf-browser.org/trunk/libdom/bindings/hubbub/parser.c?rev=13633&r1=13632&r2=13633&view=diff
==============================================================================
--- trunk/libdom/bindings/hubbub/parser.c (original)
+++ trunk/libdom/bindings/hubbub/parser.c Sat Mar 24 17:16:06 2012
@@ -755,16 +755,16 @@
 	
 	switch (mode) {
 	case HUBBUB_QUIRKS_MODE_NONE:
-		dom_html_document_set_quirks_mode(dom_parser->doc, 
-				DOM_HTML_DOCUMENT_QUIRKS_MODE_NONE);
+		dom_document_set_quirks_mode(dom_parser->doc, 
+                                             DOM_DOCUMENT_QUIRKS_MODE_NONE);
 		break;
 	case HUBBUB_QUIRKS_MODE_LIMITED:
-		dom_html_document_set_quirks_mode(dom_parser->doc, 
-				DOM_HTML_DOCUMENT_QUIRKS_MODE_LIMITED);
+		dom_document_set_quirks_mode(dom_parser->doc, 
+                                             DOM_DOCUMENT_QUIRKS_MODE_LIMITED);
 		break;
 	case HUBBUB_QUIRKS_MODE_FULL:
-		dom_html_document_set_quirks_mode(dom_parser->doc, 
-				DOM_HTML_DOCUMENT_QUIRKS_MODE_FULL);
+		dom_document_set_quirks_mode(dom_parser->doc, 
+                                             DOM_DOCUMENT_QUIRKS_MODE_FULL);
 		break;
 	}
 	

Modified: trunk/libdom/include/dom/core/document.h
URL: http://source.netsurf-browser.org/trunk/libdom/include/dom/core/document.h?rev=13633&r1=13632&r2=13633&view=diff
==============================================================================
--- trunk/libdom/include/dom/core/document.h (original)
+++ trunk/libdom/include/dom/core/document.h Sat Mar 24 17:16:06 2012
@@ -33,6 +33,16 @@
 struct lwc_string_s;
 
 typedef struct dom_document dom_document;
+
+/**
+ * Quirks mode flag
+ */
+typedef enum dom_document_quirks_mode {
+	DOM_DOCUMENT_QUIRKS_MODE_NONE,
+	DOM_DOCUMENT_QUIRKS_MODE_LIMITED,
+	DOM_DOCUMENT_QUIRKS_MODE_FULL
+} dom_document_quirks_mode;
+
 
 /* DOM Document vtable */
 typedef struct dom_document_vtable {
@@ -114,6 +124,10 @@
 	dom_exception (*dom_document_rename_node)(struct dom_document *doc,
 			struct dom_node *node, dom_string *namespace, 
 			dom_string *qname, struct dom_node **result);
+	dom_exception (*get_quirks_mode)(dom_document *doc,
+					 dom_document_quirks_mode *result);
+	dom_exception (*set_quirks_mode)(dom_document *doc,
+					 dom_document_quirks_mode quirks);
 } dom_document_vtable;
 
 static inline dom_exception dom_document_get_doctype(struct dom_document *doc,
@@ -440,4 +454,22 @@
 		(dom_document *) (d), (dom_string *) (ns), \
 		(dom_string *) (q), (dom_node **) (r))
 
+static inline dom_exception dom_document_get_quirks_mode(
+	dom_document *doc, dom_document_quirks_mode *result)
+{
+	return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
+		get_quirks_mode(doc, result);
+}
+#define dom_document_get_quirks_mode(d, r) \
+	dom_document_get_quirks_mode((dom_document *) (d), (r))
+
+static inline dom_exception dom_document_set_quirks_mode(
+	dom_document *doc, dom_document_quirks_mode quirks)
+{
+	return ((dom_document_vtable *) ((dom_node *) doc)->vtable)->
+		set_quirks_mode(doc, quirks);
+}
+#define dom_document_set_quirks_mode(d, q) \
+	dom_document_set_quirks_mode((dom_document *) (d), (q))
+
 #endif

Modified: trunk/libdom/include/dom/html/html_document.h
URL: http://source.netsurf-browser.org/trunk/libdom/include/dom/html/html_document.h?rev=13633&r1=13632&r2=13633&view=diff
==============================================================================
--- trunk/libdom/include/dom/html/html_document.h (original)
+++ trunk/libdom/include/dom/html/html_document.h Sat Mar 24 17:16:06 2012
@@ -19,16 +19,6 @@
 struct dom_nodelist;
 
 typedef struct dom_html_document dom_html_document;
-
-/**
- * Quirks mode flag
- */
-typedef enum dom_html_document_quirks_mode {
-	DOM_HTML_DOCUMENT_QUIRKS_MODE_NONE,
-	DOM_HTML_DOCUMENT_QUIRKS_MODE_LIMITED,
-	DOM_HTML_DOCUMENT_QUIRKS_MODE_FULL
-} dom_html_document_quirks_mode;
-
 
 typedef struct dom_html_document_vtable {
 	struct dom_document_vtable base;
@@ -70,10 +60,6 @@
 			dom_string *text);
 	dom_exception (*get_elements_by_name)(dom_html_document *doc,
 			dom_string *name, struct dom_nodelist **list);
-	dom_exception (*get_quirks_mode)(dom_html_document *doc,
-					 dom_html_document_quirks_mode *result);
-	dom_exception (*set_quirks_mode)(dom_html_document *doc,
-					 dom_html_document_quirks_mode quirks);
 } dom_html_document_vtable;
 
 static inline dom_exception dom_html_document_get_title(
@@ -264,23 +250,5 @@
 		dom_html_document_get_element_by_name((dom_html_document *) (d), \
 			(dom_string *) (n), (struct dom_nodelist **) (l))
 
-static inline dom_exception dom_html_document_get_quirks_mode(
-	dom_html_document *doc, dom_html_document_quirks_mode *result)
-{
-	return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
-		get_quirks_mode(doc, result);
-}
-#define dom_html_document_get_quirks_mode(d, r) \
-	dom_html_document_get_quirks_mode((dom_html_document *) (d), (r))
-
-static inline dom_exception dom_html_document_set_quirks_mode(
-	dom_html_document *doc, dom_html_document_quirks_mode quirks)
-{
-	return ((dom_html_document_vtable *) ((dom_node *) doc)->vtable)->
-		set_quirks_mode(doc, quirks);
-}
-#define dom_html_document_set_quirks_mode(d, q) \
-	dom_html_document_set_quirks_mode((dom_html_document *) (d), (q))
-
 #endif
 

Modified: trunk/libdom/src/core/document.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/core/document.c?rev=13633&r1=13632&r2=13633&view=diff
==============================================================================
--- trunk/libdom/src/core/document.c (original)
+++ trunk/libdom/src/core/document.c Sat Mar 24 17:16:06 2012
@@ -131,6 +131,7 @@
 	list_init(&doc->pending_nodes);
 
 	doc->id_name = NULL;
+	doc->quirks = DOM_DOCUMENT_QUIRKS_MODE_NONE;
 
 	err = dom_string_create_interned((const uint8_t *) "class",
 			SLEN("class"), &doc->class_string);
@@ -1374,3 +1375,19 @@
 	doc->id_name = dom_string_ref(name);
 }
 
+/*-----------------------------------------------------------------------*/
+/* Semi-internal API extensions for NetSurf */
+
+dom_exception _dom_document_get_quirks_mode(dom_document *doc,
+		dom_document_quirks_mode *result)
+{
+	*result = doc->quirks;
+	return DOM_NO_ERR;
+}
+
+dom_exception _dom_document_set_quirks_mode(dom_document *doc,
+		dom_document_quirks_mode quirks)
+{
+	doc->quirks = quirks;
+	return DOM_NO_ERR;
+}

Modified: trunk/libdom/src/core/document.h
URL: http://source.netsurf-browser.org/trunk/libdom/src/core/document.h?rev=13633&r1=13632&r2=13633&view=diff
==============================================================================
--- trunk/libdom/src/core/document.h (original)
+++ trunk/libdom/src/core/document.h Sat Mar 24 17:16:06 2012
@@ -55,7 +55,9 @@
 	dom_string *class_string;	/**< The string "class". */
 
 	dom_document_event_internal dei;
-			/**< The DocumentEVent interface */
+			/**< The DocumentEvent interface */
+	dom_document_quirks_mode quirks;
+				/**< Document is in quirks mode */
 };
 
 /* Create a DOM document */
@@ -139,6 +141,11 @@
 		dom_node *node,
 		dom_string *namespace, dom_string *qname,
 		dom_node **result);
+dom_exception _dom_document_get_quirks_mode(dom_document *doc,
+		dom_document_quirks_mode *result);
+dom_exception _dom_document_set_quirks_mode(dom_document *doc,
+		dom_document_quirks_mode result);
+
 
 dom_exception _dom_document_get_text_content(dom_node_internal *node,
 					     dom_string **result);
@@ -176,7 +183,10 @@
 	_dom_document_adopt_node, \
 	_dom_document_get_dom_config, \
 	_dom_document_normalize, \
-	_dom_document_rename_node
+	_dom_document_rename_node, \
+	_dom_document_get_quirks_mode, \
+	_dom_document_set_quirks_mode
+
 /* End of vtable */
 
 #define DOM_NODE_VTABLE_DOCUMENT \

Modified: trunk/libdom/src/html/html_document.c
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_document.c?rev=13633&r1=13632&r2=13633&view=diff
==============================================================================
--- trunk/libdom/src/html/html_document.c (original)
+++ trunk/libdom/src/html/html_document.c Sat Mar 24 17:16:06 2012
@@ -73,7 +73,6 @@
 	doc->domain = NULL;
 	doc->url = NULL;
 	doc->cookie = NULL;
-	doc->quirks = false;
 
 	return DOM_NO_ERR;
 }
@@ -348,19 +347,3 @@
 	return DOM_NOT_SUPPORTED_ERR;
 }
 
-/*-----------------------------------------------------------------------*/
-/* Semi-internal API extensions for NetSurf */
-
-dom_exception _dom_html_document_get_quirks_mode(dom_html_document *doc,
-		dom_html_document_quirks_mode *result)
-{
-	*result = doc->quirks;
-	return DOM_NO_ERR;
-}
-
-dom_exception _dom_html_document_set_quirks_mode(dom_html_document *doc,
-		dom_html_document_quirks_mode quirks)
-{
-	doc->quirks = quirks;
-	return DOM_NO_ERR;
-}

Modified: trunk/libdom/src/html/html_document.h
URL: http://source.netsurf-browser.org/trunk/libdom/src/html/html_document.h?rev=13633&r1=13632&r2=13633&view=diff
==============================================================================
--- trunk/libdom/src/html/html_document.h (original)
+++ trunk/libdom/src/html/html_document.h Sat Mar 24 17:16:06 2012
@@ -23,8 +23,6 @@
 	dom_string *domain;	/**< HTML document domain */
 	dom_string *url;	/**< HTML document URL */
 	dom_string *cookie;	/**< HTML document cookie */
-	dom_html_document_quirks_mode quirks;
-				/**< HTML document is in quirks mode */
 };
 
 /* Create a HTMLDocument */
@@ -82,10 +80,6 @@
 		dom_string *text);
 dom_exception _dom_html_document_get_elements_by_name(dom_html_document *doc,
 		dom_string *name, struct dom_nodelist **list);
-dom_exception _dom_html_document_get_quirks_mode(dom_html_document *doc,
-		dom_html_document_quirks_mode *result);
-dom_exception _dom_html_document_set_quirks_mode(dom_html_document *doc,
-		dom_html_document_quirks_mode result);
 
 
 #define DOM_HTML_DOCUMENT_VTABLE \
@@ -107,9 +101,7 @@
 	_dom_html_document_close, \
 	_dom_html_document_write, \
 	_dom_html_document_writeln, \
-	_dom_html_document_get_elements_by_name, \
-	_dom_html_document_get_quirks_mode, \
-	_dom_html_document_set_quirks_mode
+	_dom_html_document_get_elements_by_name
 
 dom_exception _dom_html_document_create_element(dom_document *doc,
 		dom_string *tag_name, dom_element **result);
@@ -148,7 +140,9 @@
 	_dom_document_adopt_node, \
 	_dom_document_get_dom_config, \
 	_dom_document_normalize, \
-	_dom_document_rename_node
+	_dom_document_rename_node,	\
+	_dom_document_get_quirks_mode,	\
+	_dom_document_set_quirks_mode
 
 #endif
 




More information about the netsurf-commits mailing list