| 516 g_queue_push_tail(priv->js_queue, g_strdup(script)); |
516 g_queue_push_tail(priv->js_queue, g_strdup(script)); |
| 517 g_idle_add((GSourceFunc)process_js_script_queue, webview); |
517 g_idle_add((GSourceFunc)process_js_script_queue, webview); |
| 518 } |
518 } |
| 519 |
519 |
| 520 void |
520 void |
| 521 gtk_webview_load_html_string_with_imgstore(GtkWebView *webview, const char *html) |
521 gtk_webview_load_html_string(GtkWebView *webview, const char *html) |
| 522 { |
522 { |
| 523 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
523 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
| 524 char *html_imged; |
524 char *html_imged; |
| 525 |
525 |
| 526 if (priv->images) { |
526 if (priv->images) { |
| 541 */ |
541 */ |
| 542 void |
542 void |
| 543 gtk_webview_append_html(GtkWebView *webview, const char *html) |
543 gtk_webview_append_html(GtkWebView *webview, const char *html) |
| 544 { |
544 { |
| 545 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
545 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
| 546 char *escaped = gtk_webview_quote_js_string(html); |
546 WebKitDOMDocument *doc; |
| 547 char *script = g_strdup_printf("document.write(%s)", escaped); |
547 WebKitDOMHTMLElement *body; |
| 548 webkit_web_view_execute_script(WEBKIT_WEB_VIEW(webview), script); |
548 doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); |
| |
549 body = webkit_dom_document_get_body(doc); |
| |
550 webkit_dom_html_element_insert_adjacent_html(body, "beforeend", html, NULL); |
| 549 priv->empty = FALSE; |
551 priv->empty = FALSE; |
| 550 g_free(script); |
|
| 551 g_free(escaped); |
|
| 552 } |
552 } |
| 553 |
553 |
| 554 void |
554 void |
| 555 gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj) |
555 gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj) |
| 556 { |
556 { |