script/dom/testing/
accessibilityupdateresult.rs1use dom_struct::dom_struct;
5use js::context::JSContext;
6use script_bindings::reflector::{Reflector, reflect_dom_object};
7
8use crate::dom::bindings::codegen::Bindings::ServoTestUtilsBinding::AccessibilityUpdateResultMethods;
9use crate::dom::bindings::root::DomRoot;
10use crate::dom::globalscope::GlobalScope;
11
12#[dom_struct]
13pub(crate) struct AccessibilityUpdateResult {
14 reflector_: Reflector,
15 nodes_updated_from_dom: u32,
16 nodes_updated_from_tree: u32,
17 nodes_updated_bounds: u32,
18 nodes_in_tree_update: u32,
19}
20
21impl AccessibilityUpdateResult {
22 pub(crate) fn new_inherited(
23 nodes_updated_from_dom: u32,
24 nodes_updated_from_tree: u32,
25 nodes_updated_bounds: u32,
26 nodes_in_tree_update: u32,
27 ) -> Self {
28 Self {
29 reflector_: Reflector::new(),
30 nodes_updated_from_dom,
31 nodes_updated_from_tree,
32 nodes_updated_bounds,
33 nodes_in_tree_update,
34 }
35 }
36
37 pub(crate) fn new(
38 cx: &mut JSContext,
39 global: &GlobalScope,
40 nodes_updated_from_dom: u32,
41 nodes_updated_from_tree: u32,
42 nodes_updated_bounds: u32,
43 nodes_in_tree_update: u32,
44 ) -> DomRoot<Self> {
45 reflect_dom_object(
46 cx,
47 Box::new(Self::new_inherited(
48 nodes_updated_from_dom,
49 nodes_updated_from_tree,
50 nodes_updated_bounds,
51 nodes_in_tree_update,
52 )),
53 global,
54 )
55 }
56}
57
58impl AccessibilityUpdateResultMethods<crate::DomTypeHolder> for AccessibilityUpdateResult {
59 fn NodesUpdatedFromDom(&self) -> u32 {
60 self.nodes_updated_from_dom
61 }
62
63 fn NodesUpdatedFromTree(&self) -> u32 {
64 self.nodes_updated_from_tree
65 }
66
67 fn NodesUpdatedBounds(&self) -> u32 {
68 self.nodes_updated_bounds
69 }
70
71 fn NodesInTreeUpdate(&self) -> u32 {
72 self.nodes_in_tree_update
73 }
74}