aboutsummaryrefslogtreecommitdiffstats
path: root/patches/css-stylesheet-user.patch
blob: 3b1a9c19f604b6588f45094bbf0d79d2da47f19a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Index: libgtkhtml/document/htmldocument.c
===================================================================
--- libgtkhtml/document/htmldocument.c.orig	2006-03-22 21:20:45.000000000 +0000
+++ libgtkhtml/document/htmldocument.c	2006-03-28 23:47:39.000000000 +0100
@@ -1122,3 +1122,38 @@ html_document_find_anchor (HtmlDocument 
 	else
 		return NULL;
 }
+
+void
+html_document_add_stylesheet (HtmlDocument *document, CssStylesheet *sheet)
+{
+	HtmlStyleChange style_change;
+	
+	g_return_if_fail (HTML_IS_DOCUMENT (document));
+	
+	/* Note: @import not supported for user stylesheets, due to
+	 * complications it would cause with removal.
+	 */
+	
+	document->stylesheets = g_slist_append (document->stylesheets, sheet);
+	
+	if (document->dom_document) {
+		style_change = html_document_restyle_node (document, DOM_NODE (dom_Document__get_documentElement (document->dom_document)), NULL, TRUE);
+		g_signal_emit (G_OBJECT (document), document_signals [STYLE_UPDATED], 0, DOM_NODE (dom_Document__get_documentElement (document->dom_document)), style_change);
+	}
+}
+
+void
+html_document_remove_stylesheet	(HtmlDocument *document, CssStylesheet *stylesheet)
+{
+	HtmlStyleChange style_change;
+
+	g_return_if_fail (stylesheet && HTML_IS_DOCUMENT (document));
+	
+	document->stylesheets = g_slist_remove (document->stylesheets, stylesheet);
+	
+	if (document->dom_document) {
+		style_change = html_document_restyle_node (document, DOM_NODE (dom_Document__get_documentElement (document->dom_document)), NULL, TRUE);
+		g_signal_emit (G_OBJECT (document), document_signals [STYLE_UPDATED], 0, DOM_NODE (dom_Document__get_documentElement (document->dom_document)), style_change);
+	}
+}
+
Index: libgtkhtml/document/htmldocument.h
===================================================================
--- libgtkhtml/document/htmldocument.h.orig	2006-03-22 21:20:45.000000000 +0000
+++ libgtkhtml/document/htmldocument.h	2006-03-28 23:47:28.000000000 +0100
@@ -113,6 +113,9 @@ void     html_document_update_active_nod
 void     html_document_update_focus_element (HtmlDocument *document, DomElement *element);
 DomNode *html_document_find_anchor          (HtmlDocument *doc, const gchar *anchor);
 
+void	html_document_add_stylesheet	(HtmlDocument *document, CssStylesheet *stylesheet);
+void	html_document_remove_stylesheet	(HtmlDocument *document, CssStylesheet *stylesheet);
+
 G_END_DECLS
 
 #endif /* __HTMLDOCUMENT_H__ */