Fix wxWebViewWebKit build with WebKit2 < 2.8
This allows this code to be compiled with WebKit2 2.6 included in Debian Jessie. Closes https://github.com/wxWidgets/wxWidgets/pull/519
This commit is contained in:
@@ -950,14 +950,23 @@ bool wxWebViewWebKit::IsBusy() const
|
|||||||
|
|
||||||
void wxWebViewWebKit::SetEditable(bool enable)
|
void wxWebViewWebKit::SetEditable(bool enable)
|
||||||
{
|
{
|
||||||
|
#if WEBKIT_CHECK_VERSION(2, 8, 0)
|
||||||
webkit_web_view_set_editable(m_web_view, enable);
|
webkit_web_view_set_editable(m_web_view, enable);
|
||||||
|
#else
|
||||||
|
// Not supported in older versions.
|
||||||
|
wxUnusedVar(enable);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWebViewWebKit::IsEditable() const
|
bool wxWebViewWebKit::IsEditable() const
|
||||||
{
|
{
|
||||||
|
#if WEBKIT_CHECK_VERSION(2, 8, 0)
|
||||||
gboolean editable;
|
gboolean editable;
|
||||||
g_object_get(m_web_view, "editable", &editable, NULL);
|
g_object_get(m_web_view, "editable", &editable, NULL);
|
||||||
return editable != 0;
|
return editable != 0;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWebViewWebKit::DeleteSelection()
|
void wxWebViewWebKit::DeleteSelection()
|
||||||
|
@@ -144,7 +144,11 @@ void wxWebViewWebKitExtension::GetSelectedSource(GVariant *parameters,
|
|||||||
webkit_dom_node_append_child(&div->parent_instance,
|
webkit_dom_node_append_child(&div->parent_instance,
|
||||||
&clone->parent_instance, NULL);
|
&clone->parent_instance, NULL);
|
||||||
WebKitDOMElement *html = (WebKitDOMElement*)div;
|
WebKitDOMElement *html = (WebKitDOMElement*)div;
|
||||||
|
#if WEBKIT_CHECK_VERSION(2, 8, 0)
|
||||||
gchar *text = webkit_dom_element_get_inner_html(html);
|
gchar *text = webkit_dom_element_get_inner_html(html);
|
||||||
|
#else
|
||||||
|
gchar *text = webkit_dom_html_element_get_inner_html(WEBKIT_DOM_HTML_ELEMENT(html));
|
||||||
|
#endif
|
||||||
g_object_unref(range);
|
g_object_unref(range);
|
||||||
|
|
||||||
ReturnDBusStringValue(invocation, text);
|
ReturnDBusStringValue(invocation, text);
|
||||||
@@ -161,7 +165,12 @@ void wxWebViewWebKitExtension::GetPageSource(GVariant *parameters,
|
|||||||
|
|
||||||
WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
|
WebKitDOMDocument *doc = webkit_web_page_get_dom_document(web_page);
|
||||||
WebKitDOMElement *body = webkit_dom_document_get_document_element(doc);
|
WebKitDOMElement *body = webkit_dom_document_get_document_element(doc);
|
||||||
|
#if WEBKIT_CHECK_VERSION(2, 8, 0)
|
||||||
gchar *source = webkit_dom_element_get_outer_html(body);
|
gchar *source = webkit_dom_element_get_outer_html(body);
|
||||||
|
#else
|
||||||
|
gchar *source =
|
||||||
|
webkit_dom_html_element_get_outer_html(WEBKIT_DOM_HTML_ELEMENT(body));
|
||||||
|
#endif
|
||||||
g_dbus_method_invocation_return_value(invocation,
|
g_dbus_method_invocation_return_value(invocation,
|
||||||
g_variant_new("(s)", source ? source : ""));
|
g_variant_new("(s)", source ? source : ""));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user