| 553 webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), html, NULL, NULL, |
553 webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), html, NULL, NULL, |
| 554 "file:///"); |
554 "file:///"); |
| 555 } |
555 } |
| 556 |
556 |
| 557 void |
557 void |
| |
558 gtk_webview_load_html_string_with_selection(GtkWebView *webview, const char *html) |
| |
559 { |
| |
560 gtk_webview_load_html_string(webview, html); |
| |
561 gtk_webview_safe_execute_script(webview, |
| |
562 "var s = window.getSelection();" |
| |
563 "var r = document.createRange();" |
| |
564 "var n = document.getElementById('caret');" |
| |
565 "r.selectNodeContents(n);" |
| |
566 "var f = r.extractContents();" |
| |
567 "r.selectNode(n);" |
| |
568 "r.insertNode(f);" |
| |
569 "n.parentNode.removeChild(n);" |
| |
570 "s.removeAllRanges();" |
| |
571 "s.addRange(r);"); |
| |
572 } |
| |
573 |
| |
574 void |
| 558 gtk_webview_append_html(GtkWebView *webview, const char *html) |
575 gtk_webview_append_html(GtkWebView *webview, const char *html) |
| 559 { |
576 { |
| 560 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
577 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
| 561 WebKitDOMDocument *doc; |
578 WebKitDOMDocument *doc; |
| 562 WebKitDOMHTMLElement *body; |
579 WebKitDOMHTMLElement *body; |