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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/tauri-apps/gir-files)
// DO NOT EDIT

use crate::{UserContentInjectedFrames, UserStyleLevel};
use glib::translate::*;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct UserStyleSheet(Shared<ffi::WebKitUserStyleSheet>);

    match fn {
        ref => |ptr| ffi::webkit_user_style_sheet_ref(ptr),
        unref => |ptr| ffi::webkit_user_style_sheet_unref(ptr),
        type_ => || ffi::webkit_user_style_sheet_get_type(),
    }
}

impl UserStyleSheet {
  #[doc(alias = "webkit_user_style_sheet_new")]
  pub fn new(
    source: &str,
    injected_frames: UserContentInjectedFrames,
    level: UserStyleLevel,
    allow_list: &[&str],
    block_list: &[&str],
  ) -> UserStyleSheet {
    assert_initialized_main_thread!();
    unsafe {
      from_glib_full(ffi::webkit_user_style_sheet_new(
        source.to_glib_none().0,
        injected_frames.into_glib(),
        level.into_glib(),
        allow_list.to_glib_none().0,
        block_list.to_glib_none().0,
      ))
    }
  }

  #[cfg(feature = "v2_22")]
  #[cfg_attr(docsrs, doc(cfg(feature = "v2_22")))]
  #[doc(alias = "webkit_user_style_sheet_new_for_world")]
  #[doc(alias = "new_for_world")]
  pub fn for_world(
    source: &str,
    injected_frames: UserContentInjectedFrames,
    level: UserStyleLevel,
    world_name: &str,
    allow_list: &[&str],
    block_list: &[&str],
  ) -> UserStyleSheet {
    assert_initialized_main_thread!();
    unsafe {
      from_glib_full(ffi::webkit_user_style_sheet_new_for_world(
        source.to_glib_none().0,
        injected_frames.into_glib(),
        level.into_glib(),
        world_name.to_glib_none().0,
        allow_list.to_glib_none().0,
        block_list.to_glib_none().0,
      ))
    }
  }
}