+ webkit_web_view_select_all(m_web_view);
+}
+
+wxString wxWebViewWebKit::GetSelectedText() const
+{
+ WebKitDOMDocument* doc;
+ WebKitDOMDOMWindow* win;
+ WebKitDOMDOMSelection* sel;
+ WebKitDOMRange* range;
+
+ doc = webkit_web_view_get_dom_document(m_web_view);
+ win = webkit_dom_document_get_default_view(WEBKIT_DOM_DOCUMENT(doc));
+ sel = webkit_dom_dom_window_get_selection(WEBKIT_DOM_DOM_WINDOW(win));
+ range = webkit_dom_dom_selection_get_range_at(WEBKIT_DOM_DOM_SELECTION(sel),
+ 0, NULL);
+ return wxString(webkit_dom_range_get_text(WEBKIT_DOM_RANGE(range)),
+ wxConvUTF8);
+}
+
+wxString wxWebViewWebKit::GetSelectedSource() const
+{
+ WebKitDOMDocument* doc;
+ WebKitDOMDOMWindow* win;
+ WebKitDOMDOMSelection* sel;
+ WebKitDOMRange* range;
+ WebKitDOMElement* div;
+ WebKitDOMDocumentFragment* clone;
+ WebKitDOMHTMLElement* html;
+
+ doc = webkit_web_view_get_dom_document(m_web_view);
+ win = webkit_dom_document_get_default_view(WEBKIT_DOM_DOCUMENT(doc));
+ sel = webkit_dom_dom_window_get_selection(WEBKIT_DOM_DOM_WINDOW(win));
+ range = webkit_dom_dom_selection_get_range_at(WEBKIT_DOM_DOM_SELECTION(sel),
+ 0, NULL);
+ div = webkit_dom_document_create_element(WEBKIT_DOM_DOCUMENT(doc), "div", NULL);
+
+ clone = webkit_dom_range_clone_contents(WEBKIT_DOM_RANGE(range), NULL);
+ webkit_dom_node_append_child(&div->parent_instance, &clone->parent_instance, NULL);
+ html = (WebKitDOMHTMLElement*)div;
+
+ return wxString(webkit_dom_html_element_get_inner_html(WEBKIT_DOM_HTML_ELEMENT(html)),
+ wxConvUTF8);
+}
+
+void wxWebViewWebKit::ClearSelection()
+{
+ WebKitDOMDocument* doc;
+ WebKitDOMDOMWindow* win;
+ WebKitDOMDOMSelection* sel;
+
+ doc = webkit_web_view_get_dom_document(m_web_view);
+ win = webkit_dom_document_get_default_view(WEBKIT_DOM_DOCUMENT(doc));
+ sel = webkit_dom_dom_window_get_selection(WEBKIT_DOM_DOM_WINDOW(win));
+ webkit_dom_dom_selection_remove_all_ranges(WEBKIT_DOM_DOM_SELECTION(sel));
+
+}
+
+wxString wxWebViewWebKit::GetPageText() const
+{
+ WebKitDOMDocument* doc;
+ WebKitDOMHTMLElement* body;
+
+ doc = webkit_web_view_get_dom_document(m_web_view);
+ body = webkit_dom_document_get_body(WEBKIT_DOM_DOCUMENT(doc));
+ return wxString(webkit_dom_html_element_get_inner_text(WEBKIT_DOM_HTML_ELEMENT(body)),
+ wxConvUTF8);
+}
+
+void wxWebViewWebKit::RunScript(const wxString& javascript)
+{
+ webkit_web_view_execute_script(m_web_view,
+ javascript.mb_str(wxConvUTF8));