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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
use glib;
use glib::object::IsA;
use glib::translate::*;
use std::fmt;
use std::ptr;
use webkit2_webextension_sys;
use DOMCSSStyleSheet;
use DOMDocument;
use DOMDocumentType;
use DOMHTMLDocument;
use DOMObject;
glib_wrapper! {
pub struct DOMDOMImplementation(Object<webkit2_webextension_sys::WebKitDOMDOMImplementation, webkit2_webextension_sys::WebKitDOMDOMImplementationClass, DOMDOMImplementationClass>) @extends DOMObject;
match fn {
get_type => || webkit2_webextension_sys::webkit_dom_dom_implementation_get_type(),
}
}
pub const NONE_DOMDOM_IMPLEMENTATION: Option<&DOMDOMImplementation> = None;
pub trait DOMDOMImplementationExt: 'static {
#[cfg_attr(feature = "v2_22", deprecated)]
fn create_css_style_sheet(&self, title: &str, media: &str) -> Result<DOMCSSStyleSheet, glib::Error>;
#[cfg_attr(feature = "v2_22", deprecated)]
fn create_document<P: IsA<DOMDocumentType>>(&self, namespaceURI: Option<&str>, qualifiedName: &str, doctype: Option<&P>) -> Result<DOMDocument, glib::Error>;
#[cfg_attr(feature = "v2_22", deprecated)]
fn create_document_type(&self, qualifiedName: &str, publicId: &str, systemId: &str) -> Result<DOMDocumentType, glib::Error>;
#[cfg_attr(feature = "v2_22", deprecated)]
fn create_html_document(&self, title: &str) -> Option<DOMHTMLDocument>;
#[cfg_attr(feature = "v2_22", deprecated)]
fn has_feature(&self, feature: &str, version: &str) -> bool;
}
impl<O: IsA<DOMDOMImplementation>> DOMDOMImplementationExt for O {
fn create_css_style_sheet(&self, title: &str, media: &str) -> Result<DOMCSSStyleSheet, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let ret = webkit2_webextension_sys::webkit_dom_dom_implementation_create_css_style_sheet(self.as_ref().to_glib_none().0, title.to_glib_none().0, media.to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
}
}
fn create_document<P: IsA<DOMDocumentType>>(&self, namespaceURI: Option<&str>, qualifiedName: &str, doctype: Option<&P>) -> Result<DOMDocument, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let ret = webkit2_webextension_sys::webkit_dom_dom_implementation_create_document(self.as_ref().to_glib_none().0, namespaceURI.to_glib_none().0, qualifiedName.to_glib_none().0, doctype.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) }
}
}
fn create_document_type(&self, qualifiedName: &str, publicId: &str, systemId: &str) -> Result<DOMDocumentType, glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let ret = webkit2_webextension_sys::webkit_dom_dom_implementation_create_document_type(self.as_ref().to_glib_none().0, qualifiedName.to_glib_none().0, publicId.to_glib_none().0, systemId.to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) }
}
}
fn create_html_document(&self, title: &str) -> Option<DOMHTMLDocument> {
unsafe {
from_glib_none(webkit2_webextension_sys::webkit_dom_dom_implementation_create_html_document(self.as_ref().to_glib_none().0, title.to_glib_none().0))
}
}
fn has_feature(&self, feature: &str, version: &str) -> bool {
unsafe {
from_glib(webkit2_webextension_sys::webkit_dom_dom_implementation_has_feature(self.as_ref().to_glib_none().0, feature.to_glib_none().0, version.to_glib_none().0))
}
}
}
impl fmt::Display for DOMDOMImplementation {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "DOMDOMImplementation")
}
}